The Problem with Hardcoding
We've all been there: you need an API key, a database URL, or a secret token. The quickest fix is to paste it right into the code. It works, but it's a ticking time bomb. Commit that file, push to a public repo, and your secret is exposed. Even in private repos, every developer with access now has the key, and rotating it becomes a nightmare.
Hardcoded config also makes your app brittle. You can't run different settings in dev, staging, and production without editing code. That's why environment variables exist.
What Are Environment Variables?
Environment variables are key-value pairs set outside your application, in the operating system or runtime environment. Your code reads them at runtime. This keeps secrets out of the source tree and lets you change config without touching code.






