.env.development May 2026
| File | Git? | Typical use |
|------|------|--------------|
| .env.development | yes | shared dev defaults |
| .env.development.local | no | local overrides |
| .env | yes | base defaults (all envs) |
| .env.production | yes | production only |
Use .env.development to make your npm run dev experience consistent, safe, and configurable.
.env.development is an environment file that stores variables exclusively for your development environment (e.g., localhost). It is commonly used with libraries like dotenv (Node.js) or frameworks like React (CRA), Vue, and Next.js. .env.development
Solution: Double-check your .gitignore. Add:
.env.local
.env.*.local
.env.production
# But keep .env.development if it has safe defaults
Before you decide to use one giant .env file for everything, consider the dangers: | File | Git
Next.js loads .env.development automatically during next dev. Variables are inlined at build time. To expose to the browser, prefix with NEXT_PUBLIC_.
Example .env.development for Next.js:
NEXT_PUBLIC_GA_TRACKING_ID=UA-DEV-123456
DATABASE_URL=postgresql://user:pass@localhost:5432/dev_db
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_...
Imagine every time you run npm run dev, your code sends a request to a paid third-party API (like Twilio or OpenAI). You would burn through your budget in an afternoon. The .env.development file allows you to substitute real APIs with mock endpoints or local sandboxes.
# .env.production
PAYMENT_GATEWAY=https://api.stripe.com/v1
| Problem | Solution |
|---------|----------|
| Variables are undefined | Ensure prefix (e.g., REACT_APP_) if using a frontend framework |
| .env.development ignored in production | Check framework's env file loading rules – most ignore it when NODE_ENV=production |
| Changes not applied | Restart the dev server |
| dotenv overrides existing process.env | Use override: true (dotenv 16+) | .env.development
Tools like Doppler, HashiCorp Vault, and Infisical now sync to local .env.development files dynamically. Your .env.development becomes a symlink or a generated file that pulls from a cloud vault (but only for dev secrets).