Skip to content

Environment Variable

Easy — everyone uses thisCI/CD & DevOps

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

Made with passive-aggressive love by manoga.digital. Powered by Claude.