.env.development Instant

Environment variables are key-value pairs injected into your application's process at runtime. A standard .env file might look like this:

DB_HOST=localhost
DB_USER=root
API_KEY=123-abc-456

However, hardcoding localhost in production would be catastrophic. This is where environment-specific files shine.

You can create scripts that modify behavior based on the presence of .env.development.

// package.json
"scripts": 
    "dev": "node scripts/validate-dev-env.js && NODE_ENV=development nodemon src/index.js"

The validation script checks that required .env.development keys exist before the app starts. .env.development

In the modern landscape of software development, applications rarely run in a single environment. Code moves from a developer’s local machine to a testing server, and finally to production. Each of these stages requires different configurations—different database credentials, API keys, and debug settings. One of the most effective tools for managing these variations is the environment file. Specifically, the .env.development file serves as the blueprint for your application while you are building it.

Many developers ask: "If I have .env.development, why do I also need .env.local?"

Here is the distinction:

| File | Purpose | Git status | | :--- | :--- | :--- | | .env.development | Default dev config for the entire team. Safe, non-sensitive defaults. | ✅ Commit | | .env.local | Local overrides. Your personal API key, different ports, etc. | ❌ Gitignore |

| 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+) |

Both tools have built-in support.

Example .env.development for React:

REACT_APP_API_BASE_URL=http://localhost:5000
REACT_APP_ENABLE_MOCKING=true
SKIP_PREFLIGHT_CHECK=true

.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.