Env-Doctor Logo

Env-Doctor

Scan & Diagnose .env Files

Diagnose & Audit Your Environment Variables

Env-Doctor is a CLI tool to scan your project for environment variables, detect missing or unused keys, and ensure your project runs safely and efficiently.

Get Started

Scan Your Project

Automatically find all environment variables used in your files (process.env, import.meta.env, and $env imports).

Detect Missing Keys

Compare used keys with your .env files and highlight missing or unused keys quickly.

Framework Friendly

Supports Node.js, Vite, Next.js, Astro, SvelteKit, and other modern frameworks seamlessly.

How to Use

Install globally or locally and run the CLI command:

npm install -g envdoc
envdoc diagnose
      

It will scan your current working directory, read all .env files, and output:

Example Output

Used keys in code: [ 'PORT', 'DEBUG', 'DB_HOST', 'API_SECRET', 'API_KEY' ]
Keys defined in .env files: ["API_KEY", "DB_URL", "SECRET"]
WARNING: Missing keys in .env file(s):  ["AUTH_TOKEN"]
WARNING: Unused keys in .env file(s):  ["SECRET"]
      

Tips for Best Practice

Contributing

Contributions, issues, and feature requests are welcome! Check the GitHub repository.

License

MIT License