Environment variables store configuration values — database passwords, API keys — outside of your application's actual code.
Why Not Just Hardcode Them?
Hardcoded secrets end up in version control history, visible to anyone with repository access, and require a code change to update. Environment variables avoid both problems.
How .env Files Work
A .env file stores these variables locally in a simple key-value format, loaded into the application at startup — and it should always be excluded from version control to keep secrets private.
Español
Deutsch