Compare .env files and spot missing, extra, or changed variables instantly.
- Onboarding: compare
.env.exampleagainst your local.envto find missing keys - Deployments: diff staging vs production env to catch misconfigurations
- CI: fail the pipeline when env files drift apart
npm install -g envdiff-cliOr use directly with npx:
npx envdiff-cli .env .env.example# Show differences between two env files
envdiff .env .env.example
# Include matching entries
envdiff .env .env.production --all
# JSON output (for CI pipelines)
envdiff .env .env.example --json- SECRET_KEY=abc123 # missing from right file
+ NEW_FEATURE_FLAG=true # extra in right file
~ DATABASE_URL old -> new # value changed
1 missing, 1 extra, 1 changed, 5 equal
| Code | Meaning |
|---|---|
| 0 | Files are identical |
| 1 | Differences found |
Use exit codes in CI to fail on env drift:
- run: npx envdiff-cli .env.example .env.ci| Flag | Description |
|---|---|
--all |
Show equal entries too |
--json |
Output as JSON |
-h, --help |
Show help |
MIT