.env.example Template Builder

Generate a documented .env.example for team onboarding

Takes a list of environment variables with descriptions and example values and outputs a commented .env.example file, optionally grouped into sections, so new teammates know exactly what to configure.

Why commit a .env.example instead of .env?

The real .env holds secrets and must stay out of version control. The .env.example lists every required key with safe placeholder values so a new developer knows what to fill in without ever exposing live credentials.

A .env.example file is the contract between your codebase and anyone setting it up. This builder turns a list of variables, descriptions, and sample values into a tidy, commented template that documents exactly what each key is for.

How it works

Each environment variable becomes a KEY=value line. When you supply a description it is emitted as a comment immediately above the key, prefixed with #, which dotenv and every compatible loader ignore at parse time:

# Postgres connection string used by Prisma
DATABASE_URL=postgresql://user:pass@localhost:5432/app

# Secret used to sign session JWTs (32+ chars)
JWT_SECRET=replace-with-a-long-random-string

Values containing a space are wrapped in double quotes so they parse as a single value; simple values stay unquoted for readability. Variable names are optionally upper-cased and stripped of invalid characters, matching the conventional SCREAMING_SNAKE_CASE style.

Tips and notes

Never put a working secret in the example file — use clear placeholders such as your-api-key-here. Commit .env.example and add .env to your .gitignore. On a new machine, developers run cp .env.example .env and fill in the blanks. Grouping keys under section banners (Database, Auth, Third-party APIs) keeps a large file scannable.