.env File
Stores environment-specific configuration as key-value pairs. Never commit .env files with secrets to version control.
Syntax
environments-and-security
KEY=value
DB_URL=postgres://user:pass@host/dbExample
environments-and-security
# .env.example (commit this)
DATABASE_URL=
JWT_SECRET=
NODE_ENV=development
PORT=3000
ALLOWED_ORIGINS=http://localhost:3000
# .env (never commit — add to .gitignore)
DATABASE_URL=postgres://admin:s3cr3t@localhost:5432/myapp
JWT_SECRET=super-long-random-string-here