Two weeks ago I deployed a service that crashed on the first request. Not because the code was wrong — because process.env.DATABASE_URL was undefined and nobody caught it until a user hit the endpoint.

I've made this mistake enough times to recognize the pattern: environment variables in Node.js are string | undefined. TypeScript shrugs. Validation is your problem. Most teams don't do it, or they scatter it across 15 files with parseInt() and ?? operators.

The Three Lies process.env Tells You

1. "This variable exists"

const dbUrl = process.env.DATABASE_URL