.env.development.local
What is .env.development.local and why it matters
.env.development.local is a dotenv-style environment file commonly used in JavaScript/Node and frontend projects (Create React App, Vite, Next.js, etc.) to store development-only environment variables that should override other development settings on a single machine. It fits into a conventional dotenv hierarchy where different files target different environments and scopes (e.g., .env, .env.development, .env.production, .env.local).
Create React App (CRA)
CRA has native support for this pattern. When you run npm start, it automatically loads:
.env.env.development.env.local.env.development.local(highest priority) All variables must be prefixed withREACT_APP_.
5. Security and .gitignore
The most important rule regarding .env.development.local is ignoring it. .env.development.local
When you initialize a project, you should ensure your .gitignore file includes the following lines:
# .gitignore
# Local env files
.env.local
.env.development.local
.env.test.local
.env.production.local
Why?
If you commit this file, you defeat the purpose of the .local suffix. You risk exposing secrets (API keys, database passwords) on GitHub/GitLab, and you force your local configuration onto your teammates. What is
3. Do Not Use in Production Servers
The .local suffix implies a physical developer machine. Never upload .env.development.local to a cloud VM, Docker container, or PaaS like Heroku or Vercel. Use the platform's native environment variable configuration panel instead.
The Naming Breakdown
.env: The standard file for default values..development: Specifies that these variables apply only when the application is running in "development" mode (e.g., runningnpm start)..local: The most critical part. This indicates that the file is for local overrides and should not be committed to the repository.
Next.js
Next.js has a built-in loader for .env files. they work fine
- Supported: Yes.
- Special behavior: Next.js blurs the line between server and browser. Variables are inlined at build time.
- Caution: In Next.js,
.env.development.localis loaded duringnext dev. However, to expose a variable to the browser, you still need theNEXT_PUBLIC_prefix. - Best practice: Use
.env.development.localfor local API keys that should never reach version control.
When to use it
- You need a per-developer override during development that should never be committed.
- You want to keep team-wide development defaults in .env.development but allow individuals to customize without editing that file.
- You run services locally with credentials that must not be shared (local API tokens, database passwords).
"Is this a Windows problem?"
File names starting with a dot (.) are hidden on Unix/Mac. On Windows, they work fine, but Git Bash or PowerShell may hide them by default. Use ls -Force or dir /a.
Get our monthly newsletter for the latest business insights.
Dynamics Solution is a leading Microsoft partner company delivering customer success centric Microsoft Dynamics 365 solutions in Europe (UK), Gulf (UAE, Saudi Arabia & Bahrain) and Asia (Malaysia, India, Pakistan).
Microsoft Dynamics 365
- Dynamics 365 Finance
- Dynamics 365 Human Resource
- Dynamics 365 Supply Chain Management
- Dynamics 365 Commerce
- Dynamics 365 Sales
- Dynamics 365 Marketing
- Dynamics 365 Customer Service
- Microsoft Dynamics 365 Business Central
- Dynamics 365 Field Service
- Dynamics 365 Project Operations
- Dynamics 365 Project Service Automation
- Artificial Intelligence
- Mixed Reality

