Courses / Portfolio & Interview Prep
6. Environment configuration files (.env)
Managing environment-specific configuration securely and reproducibly using .env patterns.
JavaScript
Environment configuration files (.env)
A .env file stores configuration values (like API keys and ports) outside your code so the app can run differently per environment without changing source files.
"I want to run the same code locally, in CI, and in production without embedding secrets or changing code."
A .env file is a simple plaintext key=value file loaded into process.env at runtime (typically via dotenv) to keep environment-specific settings and secrets out of source control.
"I want to run the same code locally, in CI, and in production without embedding secrets or changing code."
A .env file is a simple plaintext key=value file loaded into process.env at runtime (typically via dotenv) to keep environment-specific settings and secrets out of source control.