Skip to main content
Dev · 283 tools

Mock .env File Generator

Generates a fake environment variable file for testing and documentation

Mock .envExample — click Generate for yours
NODE_ENV=development PORT=7501 DATABASE_URL=postgres://app:0Jh2Ub4pViwp@localhost:5432/app_dev REDIS_URL=redis://localhost:6379 API_KEY=sk_test_WRbzDFKfmIARgLtOY2Rqfr78 JWT_SECRET=78c4ab33b44568d4fbe879a2f63ef330ba56be016c833440 SESSION_SECRET=3d9f295653acc5523d1698859506fa64 SMTP_HOST=smtp.example.com SMTP_USER=mailer@example.com SMTP_PASS=ljykRhUY7vlZny9H LOG_LEVEL=debug

Generated 11 words · 375 characters

See 3 examples
  • Example 1
    NODE_ENV=development
    PORT=7501
    DATABASE_URL=postgres://app:0Jh2Ub4pViwp@localhost:5432/app_dev
    REDIS_URL=redis://localhost:6379
    API_KEY=sk_test_WRbzDFKfmIARgLtOY2Rqfr78
    JWT_SECRET=78c4ab33b44568d4fbe879a2f63ef330ba56be016c833440
    SESSION_SECRET=3d9f295653acc5523d1698859506fa64
    SMTP_HOST=smtp.example.com
    SMTP_USER=mailer@example.com
    SMTP_PASS=ljykRhUY7vlZny9H
    LOG_LEVEL=debug
  • Example 2
    NODE_ENV=development
    PORT=7889
    DATABASE_URL=postgres://app:iCH2dF7LonG1@localhost:5432/app_dev
    REDIS_URL=redis://localhost:6379
    API_KEY=sk_test_WYUISBa8ula636P49EX9dqBx
    JWT_SECRET=b62df868fc846d5892c7ff77864f6aeb29e957f225746316
    SESSION_SECRET=3cfbab3010855ad3f0c8237b49d19c8f
    SMTP_HOST=smtp.example.com
    SMTP_USER=mailer@example.com
    SMTP_PASS=7bqPnCQXiyNnEM3G
    LOG_LEVEL=debug
  • Example 3
    NODE_ENV=development
    PORT=7100
    DATABASE_URL=postgres://app:QQ1xG5TkQkbh@localhost:5432/app_dev
    REDIS_URL=redis://localhost:6379
    API_KEY=sk_test_xK33guFsw9voxh1yhfxCIOXo
    JWT_SECRET=b7df69e735c1319025c310ac99fd58908cb54bbae3fde42f
    SESSION_SECRET=a8be8be80eb9f7ee52b20738e00419f6
    SMTP_HOST=smtp.example.com
    SMTP_USER=mailer@example.com
    SMTP_PASS=yrC7JZyPsJ13qMIc
    LOG_LEVEL=debug

About this generator

Every project needs an .env.example file — a template that shows contributors which environment variables the application expects, with placeholder values safe to commit. Writing one by hand means revisiting it every time a new key is added, and it is easy to accidentally include a real secret. This tool generates a realistic example file with plausible keys and random values, ready to commit as-is. The output includes 11 common variables covering node environment, port, database URL, Redis URL, API key, JWT secret, session secret, SMTP configuration, and log level. Secrets like JWT_SECRET and SESSION_SECRET are random hex strings of appropriate length. The API key uses the sk_test_ prefix to signal test status. The port is randomised between 3000 and 8999. Paste it directly into .env.example and commit it. The values point to nothing — the database URL, SMTP host, and API key are all fictional — making it safe to share publicly. Your team fills in their own real values locally and keeps those out of version control.

How to use

  1. Click Generate to produce a mock .env file.
  2. Copy it into an .env.example or doc.
  3. Replace the values with real ones locally.
  4. Keep real secrets out of version control.

Use Cases

  • •Creating an .env.example for a repo
  • •Documenting required configuration
  • •Seeding a local development setup
  • •Testing how an app loads config
  • •Demoing environment variables safely

Tips

  • →Commit only an example, never real secrets.
  • →Replace every placeholder in your own env.
  • →Use it to document required config.
  • →Add .env to your .gitignore.

FAQ

is it safe to share this file

Yes — every secret in it is randomly generated and connects to nothing, so there is no real credential to leak. That is exactly what makes it suitable for documentation, tutorials, and an .env.example committed to a repo.

what variables does the generated file include

The output includes NODE_ENV, PORT, DATABASE_URL (postgres), REDIS_URL, API_KEY, JWT_SECRET, SESSION_SECRET, SMTP_HOST, SMTP_USER, SMTP_PASS, and LOG_LEVEL. These 11 keys cover a typical web application's configuration surface.

why not commit a real .env file

A real .env holds live secrets — database passwords, API keys, signing secrets — that grant access to your systems. Committing it exposes those secrets in your history forever. Commit only an example file with fake values, and keep the real one out of version control.

You might also like

Popular tools from other categories that share themes with this one.