Skip to main content

File Types by Language / Framework

Different languages and frameworks have conventions for which .env files they support. Env-Guardian works across all of them, but here’s what you’ll most commonly see:


JavaScript & TypeScript

Framework / RuntimeCommon .env filesNotes
Vanilla Node.js.envTypically just a single .env file, loaded with dotenv.
React.js (CRA).env, .env.local, .env.development, .env.production, .env.test.env.local overrides .env. Only REACT_APP_ vars are exposed.
Next.js.env, .env.local, .env.development, .env.production, .env.test.env.local is ignored by git by default. NEXT_PUBLIC_ required for client.
Nuxt.js (2).envTypically loaded with @nuxtjs/dotenv. Uses NUXT_ENV_ prefix.
Nuxt.js (3).env, .env.localWorks with runtimeConfig, uses NUXT_PUBLIC_ for client.
Vue.js (Vite projects).env, .env.local, .env.development, .env.production, .env.testRequires VITE_ prefix to be exposed.
SvelteKit.env, .env.local, .env.development, .env.productionUses PUBLIC_ prefix for client-side.
NestJS / Angular.envUsually one .env, though some teams split into .env.development and .env.production.

Other Languages

LanguageCommon .env filesNotes
Python.envOften used with python-dotenv. No strict variants by default, though projects may define .env.development etc.
Ruby (Rails).env, .env.local, .env.development, .env.test, .env.productionSupported by gems like dotenv-rails.
Shell Script.env or direct export in .bashrc / .zshrcShell scripts can source .env.
JSON configsconfig.json or secrets.jsonNot always .env style, but often used in cloud configs.
YAML configsconfig.yaml, application.yamlPopular in Kubernetes / CI/CD environments.
PHP (Laravel).envLaravel requires .env in project root; .env.example often provided.
Java (Spring Boot).env, .env.local, application.properties, application.ymlSpring can load from .env or .properties.
Kotlin.envFollows same conventions as Java.
Go.envCommon with godotenv, usually a single .env.
C# (.NET).env, appsettings.json, secrets.json.NET uses appsettings.json, but dotenv.net supports .env.

General Best Practice

  • Use .env for defaults.
  • Use .env.local for secrets that should not be committed.
  • Use .env.development, .env.production, .env.test when your framework supports environment-specific overrides.
  • Always remember to add your .env filename to .gitignore or double check that it's there already.