Every .env read in one place
Guides, head-to-head comparisons, and stack-specific examples. Start with whatever matches your problem.
Guides
8 entriesA complete guide to .env files — what they are, how runtimes load them, why they matter, and how to use them safely across Node.js, Next.js, Django, and more.
Rules for .env files: what to commit, what to rotate, how to structure secrets across dev, staging and production, and the mistakes that cause outages.
Every way to load a .env file: dotenv/config, Node's --env-file flag, Vite, Next.js, webpack, Django, Rails, Laravel and Go. Load order and overrides explained.
The NEXT_PUBLIC_ prefix decides whether an env variable is shipped to the browser or kept on the server. Here's how it works, when to use it, and the traps.
Step-by-step: keep .env out of git from day one, and what to do when a secret leaks into your commit history. Includes rotation checklist.
Fix .env file errors fast: why variables are undefined, why values are wrong or cut off, and why it works locally but not in production. 12 causes with exact fixes.
Add a secret in Settings, reference it with ${{ secrets.NAME }}, keep it masked and rotate it safely. Repo vs environment vs org secrets, plus OIDC.
Add, pull and manage Vercel environment variables: Production vs Preview vs Development, Sensitive variables, vercel env pull and the CLI.
Compare
8 entriesdotenv loads .env inside your app at runtime. direnv loads per-directory env into your shell. Comparison of use cases, trade-offs, and when you want both.
When does a plain .env stop being enough? Honest comparison of .env files against Doppler, Infisical, and Hashicorp Vault. Cost, setup, audit, rotation.
Both Next.js and Vite inline prefixed env vars at build time. Same idea, different names, slightly different semantics. What to use when, and the gotchas.
How .env files map to Kubernetes Secrets and ConfigMaps. When to split, when to combine, and how to avoid the classic base64-is-not-encryption trap.
An honest comparison of dotenv and config-based libraries (node-config, convict, zod-env). Trade-offs around validation, type safety, and schema enforcement.
When .env wins, when JSON wins, and why most teams end up with a hybrid. Comparison of parsing cost, type safety, ergonomics, and CI/CD friendliness.
Plain .env files vs Doppler: an honest comparison of cost, setup, team workflows, audit logs and rotation — plus Doppler alternatives.
HashiCorp Vault alternatives compared: OpenBao, Infisical, Doppler, AWS/GCP/Azure secret stores and SOPS, by features, self-hosting and dynamic secrets.
Framework examples
14 entriesEvery Node.js service starts with a .env file. This generator produces one for Express, Fastify, or Koa — with a Postgres connection string, a securely generated JWT secret, and a log-level knob.
Next.js reads .env.local automatically — no import needed. This generator produces a complete file for the most common Next 15 stack: NextAuth for auth, Supabase for data, Stripe for payments.
Django projects traditionally used settings.py for config, but that pattern leaks secrets into git. This generator produces a .env compatible with python-dotenv or django-environ — with Postgres, Redis, Celery, and SMTP already structured.
Rails ships with encrypted credentials, but dotenv-rails is still the path of least resistance for local dev. This generator produces a .env with database, Redis, Sidekiq, and secret keys.
Vite uses VITE_ prefixes to decide which variables ship to the browser. This generator produces a React .env with the right prefixes and the most common third-party client keys (Supabase, PostHog, Sentry).
Modern Python services (FastAPI, Flask, litestar) all consume .env via python-dotenv or Pydantic's BaseSettings. This generator produces a .env with the idiomatic keys — SECRET_KEY, DATABASE_URL, REDIS_URL, ALLOWED_ORIGINS.
Go apps typically use godotenv (joho/godotenv) or envconfig (kelseyhightower/envconfig) to load .env. This generator produces a Go-idiomatic .env with PORT, DATABASE_URL, JWT_SECRET, and CORS origins.
docker-compose auto-loads a .env file from the same directory as the compose file. Variables can be referenced in compose.yml as ${VAR}. This generator produces a compose-idiomatic .env.
Kubernetes separates config into two primitives: ConfigMaps (non-sensitive) and Secrets (sensitive). This generator produces a .env you can feed directly into kubectl create secret generic --from-env-file or split into a ConfigMap.
Stripe ships three keys per environment — publishable, secret, and webhook signing. This generator produces a .env block with the right prefixes (sk_test_, pk_test_, whsec_) and comments so you don't accidentally mix test and live values.
Firebase has two halves: the public client config (safe in the browser) and the Admin SDK service account (server-only). This generator keeps them separated with the right NEXT_PUBLIC_ prefixes so you don't leak admin credentials.
Supabase gives you four things per project: URL, anon key, service-role key, and JWT secret. The first two are client-safe (protected by Row Level Security). The last two are server-only and bypass RLS entirely.
Most AI apps use OpenAI + at least one vector DB. This generator produces a .env covering OpenAI, Anthropic, and Pinecone — the default AI stack for 2026.
Laravel reads .env via vlucas/phpdotenv during bootstrap. This generator produces a Laravel 11 compatible file with APP_KEY, MySQL, Redis, queue, and mailer settings.