Stop shipping broken environments.
Catch missing, empty, and undocumented .env variables before they cause issues.
A teammate clones the repo. You renamed a variable last week. The app starts, fails silently, and nobody knows why.
dotenv-checker runs in one command and tells you exactly what's wrong.
- Scans your entire project for every
.env*file automatically - Detects missing, empty, and undocumented keys
- Compares any two env files directly: staging vs production, local vs CI
- Zero config, no setup required
- 1 dependency (
chalk)
git clone https://github.com/tanguykonan/dotenv-checker.git
cd dotenv-checker
npm install -g .dotenv-checker is then available anywhere in your terminal.
NOTE: You can delete the repository from your computer.
Recursively finds every .env* file, pairs each one with its .env.example, and reports all issues at once.
dotenv-checker
dotenv-checker --dir ./backendNo .env.example needed. Useful for diffing environments or branches.
dotenv-checker --compare .env.staging .env.productiondotenv-checker --env .env.local --example .env.example| Flag | Default | Description |
|---|---|---|
--dir <path> |
. |
Root directory for project scan |
--env <path> |
.env |
Path to your env file |
--example <path> |
.env.example |
Path to your example file |
--compare <A> <B> |
- | Compare two env files side by side |
--verbose, -v |
false | Also show valid / shared keys |
--help, -h |
- | Show usage |
| Code | Meaning |
|---|---|
0 |
No issues found |
1 |
One or more issues detected |
2 |
File not found or invalid arguments |
Works well in CI pipelines: exit code 1 blocks the pipeline when .env is out of sync.
# GitHub Actions
- name: Check .env consistency
run: dotenv-checker --env .env.ci --example .env.exampledotenv-checker/
├── src/
│ ├── cli.js # entry point, argument parsing, mode selection
│ ├── parser.js # reads and decodes .env files into a Map
│ ├── checker.js # compares two Maps and categorizes keys
│ ├── reporter.js # formats and prints results with chalk
│ └── scanner.js # recursively finds all .env* files in the project
├── tests/
│ └── test.js # test suite for parser and checker
└── assets/ # screenshots used in this README
MIT - tanguykonan


