.env Generator
Generate a .env.example or local .env file for Laravel, Node.js, Next.js, Django or Rails, with every secret left empty.
Choose your framework and services to get a clean, commented .env.example - secrets stay empty and nothing leaves your browser.
Passwords, keys and tokens are always left empty - fill them in on your machine. Nothing you type here leaves your browser.
More Developer Documentation / Project Tools
View all 11Never commit a real .env file - add it to .gitignore and share only .env.example.
What Is the .env Generator?
It builds a starter .env.example or local .env file for Laravel, Node.js, Next.js, Django, Rails or a generic app, with sections for the database, Redis, SMTP mail, S3 storage and a third-party API. Every password, key and token is left empty on purpose: the tool never generates, stores or transmits secrets.
Why and When to Use It
Environment variables keep configuration and secrets out of your code. A committed .env.example documents which variables exist without exposing any values, so a new developer can copy it to .env and fill in their own. Use the generator when starting a project, adding a service, or documenting the variables of an existing one.
How to Use It
- Choose the framework and whether you want a
.env.example(safe to commit) or a local.envwith development defaults. - Tick the sections you need and pick the database.
- Generate, then copy or download the file.
Example
For Laravel with MySQL, the local file contains DB_CONNECTION=mysql, DB_HOST=127.0.0.1, DB_PORT=3306 and an empty DB_PASSWORD=. For Node.js the database becomes a single DATABASE_URL.
Understanding the Output
Variable names follow each framework's own conventions, so they work with its default config files. Empty values are the ones you must fill in. In Next.js, anything prefixed NEXT_PUBLIC_ is sent to the browser, so never put a secret there.
Limitations
The file is a starting point, not a complete config for every package you use. Keep .env out of Git with the .gitignore Generator, check the syntax with the .env Validator, and for Docker Compose files use the Docker Compose Environment Validator.
.env File Examples
Node.js / Express (read with the dotenv package or node --env-file=.env):
NODE_ENV=development
PORT=3000
DATABASE_URL=postgres://app:secret@localhost:5432/app
JWT_SECRET=
CORS_ORIGIN=http://localhost:5173
Laravel:
APP_NAME="My App"
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=my_app
DB_USERNAME=root
DB_PASSWORD=
Django (with django-environ or python-dotenv):
DEBUG=True
SECRET_KEY=
ALLOWED_HOSTS=localhost,127.0.0.1
DATABASE_URL=postgres://app:secret@localhost:5432/app
Next.js - only variables starting with NEXT_PUBLIC_ reach the browser:
NEXT_PUBLIC_API_URL=https://api.example.com
DATABASE_URL=
NEXTAUTH_SECRET=
.env Syntax Rules
- One
KEY=valueper line, with no spaces around=. - Put values containing spaces or
#in double quotes:APP_NAME="My App". - Lines starting with
#are comments. - Keys are usually UPPER_SNAKE_CASE; keep them unique - a repeated key silently overrides the first one.
Check an existing file for these mistakes with the .env Validator.
.env vs .env.example
.env holds your real settings and secrets and must never be committed - add it to .gitignore. .env.example lists the same keys with empty or dummy values and is committed, so a new developer can copy it (cp .env.example .env) and fill in their own values.
Frequently Asked Questions
Explore More Tools
Keep going with related categories and our most used tools.