Frontend engineering · Configuration
Environment Variable
Also called: .env, Env vars, Environment config
Config values kept outside your code and set per environment, like API URLs and secret keys, so sensitive info isn't hardcoded.
In detail
Environment variables are like the safe at a hotel front desk. Valuables (keys, database passwords) don't go in your luggage (your code). They're stored separately and taken out when needed. Development, testing, and production can each use different values without changing the code.
Frontend projects usually put them in a .env file in the project root. Be careful: variables with prefixes like VITE_ or NEXT_PUBLIC_ get bundled into frontend code, and anyone can see them in the browser. So real secrets must never go in frontend variables. Keep them on the backend or in server-side functions.
Add .env to .gitignore and don't commit it to the repo. When deploying, enter the values again in the hosting platform's settings. After changing .env, you usually need to restart the dev server for it to take effect.
Developer infoTerm ID, DOM cues, match priority
- Term ID
eng-env-variable- DOM selectors
- No DOM cues. This concept isn't detected directly on a page.
- Priority
- 1 · when several match at the same level, the higher priority wins
- Version
- v1 · updated Sep 29, 2026