All posts
Productivity5 June 20264 min read

Organising .env variables at scale with Variable Groups

The 30-variable wall

Every project starts simple. Three or four variables: a database URL, an API key, maybe a port number. The .env file is tiny and easy to navigate.

Then the project grows.

You add Stripe. Then SendGrid. Then Redis. Then you integrate with three third-party APIs. You add feature flags. You add OAuth for Google and GitHub. Suddenly you have 40, 60, 80 variables — and your .env file looks like this:

bash
PORT=3000
DATABASE_URL=postgres://localhost:5432/myapp
REDIS_URL=redis://localhost:6379
JWT_SECRET=abc123
JWT_EXPIRES_IN=7d
GOOGLE_CLIENT_ID=894-xxxx.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=GOCSPX-xxxx
GITHUB_CLIENT_ID=Iv1.xxxx
GITHUB_CLIENT_SECRET=xxxx
STRIPE_SECRET_KEY=sk-live-xxxx
STRIPE_WEBHOOK_SECRET=whsec_xxxx
STRIPE_PRICE_ID_MONTHLY=price_xxxx
OPENAI_API_KEY=sk-xxxx
OPENAI_MODEL=gpt-4o
SENDGRID_API_KEY=SG.xxxx
SENDGRID_FROM_EMAIL=hello@myapp.com
AWS_ACCESS_KEY_ID=AKIA-xxxx
AWS_SECRET_ACCESS_KEY=xxxx
AWS_REGION=eu-west-2
AWS_S3_BUCKET=myapp-uploads
SLACK_WEBHOOK_URL=https://hooks.slack.com/xxxx
FEATURE_NEW_DASHBOARD=true
FEATURE_BETA_API=false

Try finding the right variable in that. Scroll. Squint. Control+F. It works, technically — but it slows you down every time.


The comment header convention

Experienced developers discovered a simple fix years ago: use comment headers as section dividers.

bash
# ── Server ──────────────────────────────────────────────
PORT=3000
NODE_ENV=development

# ── Database ─────────────────────────────────────────────
DATABASE_URL=postgres://localhost:5432/myapp
REDIS_URL=redis://localhost:6379

# ── Auth ─────────────────────────────────────────────────
JWT_SECRET=abc123
JWT_EXPIRES_IN=7d
GOOGLE_CLIENT_ID=894-xxxx
GOOGLE_CLIENT_SECRET=GOCSPX-xxxx
GITHUB_CLIENT_ID=Iv1.xxxx
GITHUB_CLIENT_SECRET=xxxx

# ── Payments ─────────────────────────────────────────────
STRIPE_SECRET_KEY=sk-live-xxxx
STRIPE_WEBHOOK_SECRET=whsec_xxxx
STRIPE_PRICE_ID_MONTHLY=price_xxxx

This is much better. You can scan to the right section in seconds. The file is self-documenting. New team members understand the structure immediately.

The problem: when you're editing the raw file, you still have to manually scroll through everything. You can't collapse sections, search within a group, or get a bird's-eye view of what groups exist.


How ENV Manager Pro reads your groups

ENV Manager Pro detects your comment headers automatically and turns them into a collapsible, searchable sidebar panel. It supports four comment styles, all commonly used in the wild:

FormatExample
Triple-equals`# === DATABASE ===`
Brackets`# [PAYMENTS]`
ALL CAPS`# DATABASE`

You don't change your .env format. You don't add metadata. You don't install a separate config file. ENV Manager Pro just reads what's already there.

Once detected, the sidebar shows:

🗄 DATABASE         (4 variables)
🔑 AUTH             (6 variables)  ▼ expanded
   JWT_SECRET       ••••••••
   JWT_EXPIRES_IN   7d
   GOOGLE_CLIENT_ID ••••••••
   ...
💳 PAYMENTS         (3 variables)
☁️  AWS              (4 variables)
📧 EMAIL            (2 variables)
🚩 FEATURE FLAGS    (4 variables)

The emoji icons are assigned automatically based on the group name — no config required.


Smart icon assignment

The icon-to-group mapping uses keyword matching on the group name:

KeywordsIcon
db, database, postgres, mysql, mongo🗄
auth, jwt, oauth, session, login🔑
aws, s3, lambda, ec2☁️
api, key, token, secret🔌
email, mail, smtp, sendgrid📧
stripe, payment, billing💳
slack, discord, webhook🔔
feature, flag, toggle🚩

If no keyword matches, it falls back to a generic 📁 icon.


Search within groups

The real productivity gain comes from search. When you type in the search bar, ENV Manager Pro filters across all groups simultaneously and shows which group each match belongs to:

Search: "stripe"

💳 PAYMENTS
   STRIPE_SECRET_KEY      ••••••••
   STRIPE_WEBHOOK_SECRET  ••••••••
   STRIPE_PRICE_ID        price_xxxx

No more Ctrl+F in a text editor that shows you 40 unrelated lines before the one you want.


The right group structure for most projects

After working with hundreds of .env files, here's the structure that works best for a typical web application:

bash
# === SERVER ===
PORT=3000
NODE_ENV=development

# === DATABASE ===
DATABASE_URL=
REDIS_URL=

# === AUTH ===
JWT_SECRET=
JWT_EXPIRES_IN=7d
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=

# === PAYMENTS ===
STRIPE_SECRET_KEY=
STRIPE_WEBHOOK_SECRET=

# === EMAIL ===
SENDGRID_API_KEY=
FROM_EMAIL=

# === STORAGE ===
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_REGION=
S3_BUCKET=

# === FEATURE FLAGS ===
FEATURE_NEW_UI=false
FEATURE_BETA_API=false

This structure scales cleanly from 10 variables to 100. New developers understand it at a glance. You always know where to look.


One last tip: add groups early

The best time to add section headers to a .env file is at the start of a project, when you only have 5–10 variables. It takes 30 seconds and saves significant mental overhead as the project grows. Don't wait until you have 60 variables and need to retroactively categorise everything.

Manage your secrets the right way

ENV Manager Pro is free to install — no account, no config, works in 30 seconds.