envdoc
v1.0.2
Published
Env Doctor: Diagnose, validate, and audit your .env files and environment variables in seconds.
Maintainers
Readme
Env Doctor
Diagnose, validate, and audit your environment variables across your entire project.
Env Doctor scans all your
.envfiles and your source code to catch missing and unused environment variables.
Features
Recursively finds all
.envfiles in your projectScans source files (
.js,.ts,.jsx,.tsx,.mjs,.cjs)Detects environment usage via:
process.env.KEY/process.env["KEY"]import.meta.env.KEY$env/static/*orastro:env/*imports
Reports missing and unused keys
Pretty output with spinners and colors
Installation
npm install -g envdocUsage
Run inside any project:
envdoc diagnoseThat’s it — Env Doctor will automatically:
- Find all
.envfiles - Parse them
- Scan your codebase for environment variable usage
- Compare → Report missing & unused keys
Example
Project structure:
my-app/
├─ src/
│ ├─ index.js
│ └─ utils.ts
├─ .env
└─ .env.local.env file:
PORT=3000
DATABASE_URL=
DEBUG_MODE=truesrc/index.js:
console.log(process.env.PORT);
console.log(process.env.DATABASE_URL);Run:
envdoc diagnoseOutput:
SUCCESS: Found 2 .env file(s).
SUCCESS: Parsed all .env files (3 unique keys found).
SUCCESS: Scan complete.
Used keys in code: [ 'PORT', 'DATABASE_URL' ]
Keys defined in .env files: [ 'PORT', 'DATABASE_URL', 'DEBUG_MODE' ]
WARNING: Missing keys in .env file(s): [ 'DATABASE_URL' ]
WARNING: Unused keys in .env file(s): [ 'DEBUG_MODE' ]🛠 CLI
| Command | Description |
| --------------------- | ---------------------------------------------------- |
| envdoc diagnose | Scan your project and report missing/unused env keys |
more commands coming soon
Contributing
- Fork the repo
- Create a branch (
git checkout -b feature/my-feature) - Commit your changes (
git commit -m "Add feature") - Push (
git push origin feature/my-feature) - Open a Pull Request
License
MIT License © 2025 Adarsh Antony
