Environment Variable
ELI5 — The Vibe Check
An environment variable is a setting you inject into your app from outside the code, like a sticky note you attach before it runs. Database passwords, API keys, which environment you're in — all in env vars. This way the same code can behave differently in dev vs production without changing the code itself.
Real Talk
Environment variables are key-value pairs set in the runtime environment and accessible to a process. They externalize configuration from code, following the 12-Factor App methodology. Sensitive values like secrets should never be hardcoded in source code but instead passed via env vars or a secrets manager.
Show Me The Code
# .env file (never commit this!)
DATABASE_URL=postgres://user:pass@localhost/mydb
API_KEY=sk-abc123
NODE_ENV=development
# Access in code
const db = process.env.DATABASE_URL;
When You'll Hear This
"Set the API key as an environment variable — never hardcode it." / "The app is reading the wrong environment variable in prod."
Related Terms
Docker
Docker is like a lunchbox for your app.
Environment
An environment is a complete setup where your app runs — a specific combination of servers, databases, config, and code.
Infrastructure as Code
ClickOps means building your cloud infrastructure by clicking buttons in AWS console.
Secret
A secret is an environment variable that's extra sensitive — API keys, passwords, tokens. The rule is simple: secrets NEVER go in your code or git history.