EnvWarden
Keep your .env files in sync with .env.example automatically. EnvWarden warns you the moment a key is missing, extra, or empty — right inside VS Code.
How it works
EnvWarden scans your workspace for env files (.env, .env.local, etc.) and compares each one against its template (.env.example, .env.sample, etc.) in the same folder. Diagnostics appear instantly in the Problems panel and as underlines in the editor — no manual checks needed.
Example
Say your .env.example looks like this:
DATABASE_URL=
JWT_SECRET=
PORT=3000
REDIS_URL=
And your .env is:
DATABASE_URL=postgres://localhost/mydb
PORT=3000
EnvWarden will flag:
- Warning —
JWT_SECRET and REDIS_URL are missing from .env
- Hint —
DATABASE_URL has an empty value (if warnOnEmptyValues is on)
You'll see a count in the status bar at the bottom: ⚠ EnvWarden: 2 issues
Commands
Open the Command Palette (Ctrl+Shift+P / Cmd+Shift+P) and run:
| Command |
What it does |
EnvWarden: Validate Environment Files |
Re-scans all env files in the workspace and updates the Problems panel |
EnvWarden: Sync Missing Keys into .env |
Appends all missing keys (with empty values) to your .env file |
You can also click the EnvWarden status bar item (bottom-right) to trigger a validate at any time.
Quick Fix
When you see the "Missing keys" warning on a .env file, a quick fix lightbulb appears. Click it (or press Ctrl+.) and select:
Add missing keys from template
This inserts the missing keys at the bottom of your .env file without touching anything else. You just fill in the values.
Diagnostics explained
| Severity |
Meaning |
| Warning |
Key is in the template but missing from your .env |
| Info |
Key is in your .env but not declared in the template |
| Hint |
Key is present but has an empty value |
Settings
Go to Settings (Ctrl+,) and search for EnvWarden to configure:
| Setting |
Default |
Description |
envwarden.exampleFileNames |
[".env.example", ".env.sample", ".env.template"] |
Files treated as the source-of-truth template |
envwarden.envFileNames |
[".env", ".env.local", ".env.development", ".env.production"] |
Files validated against the template |
envwarden.warnOnEmptyValues |
true |
Warn when a key exists but has no value |
Example: custom template name
If your project uses .env.defaults as the template:
"envwarden.exampleFileNames": [".env.defaults"]
Example: add a custom env file
If you also want to validate .env.staging:
"envwarden.envFileNames": [".env", ".env.local", ".env.staging"]
EnvWarden parses standard KEY=VALUE dotenv files:
# Comments are ignored
DATABASE_URL=postgres://localhost/db
JWT_SECRET="my secret" # quoted values are supported
export PORT=3000 # export prefix is tolerated
Blank lines, comments, export prefixes, and single/double quoted values are all handled correctly.