@long260398/envx
v0.1.0
Published
CLI tool to validate, diff, and sync .env files against .env.example
Downloads
28
Maintainers
Readme
envx
Never deploy with a broken
.envagain — validate, diff, and sync environment files in one command.
Demo
$ envx check
✗ Missing keys (2):
- DATABASE_URL
- REDIS_URL
⚠ Empty values (1):
~ APP_KEY
3 issues found
$ envx sync
Added 2 keys to .env:
+ DATABASE_URL=
+ REDIS_URL=
$ envx check
✓ .env is validFeatures
- Catch broken deploys early — spot missing keys before they cause production errors
- Visual diff — see exactly what's different between
.envand.env.exampleat a glance - One-command sync — copy missing keys from
.env.exampleto.envautomatically - Safe by default —
--dry-runpreviews all changes before writing anything - Custom paths — works with any naming convention (
--env,--exampleflags) - Zero config — drop it into any project, no setup required
Getting Started
Prerequisites
- Node.js 18+
Install globally
npm install -g @long260398/envxOr run without installing
npx @long260398/envx checkUsage
# Check for missing or empty keys
envx check
# Show a visual diff
envx diff
# Add missing keys from .env.example to .env
envx sync
# Preview sync without writing
envx sync --dry-run
# Use custom file paths
envx check --env .env.staging --example .env.example
envx diff --env .env.staging --example .env.staging.exampleIn CI pipelines
# GitHub Actions — fail the build if .env is out of sync
- run: npx @long260398/envx checkIn package.json scripts
{
"scripts": {
"env:check": "envx check",
"env:sync": "envx sync --dry-run",
"predev": "envx check"
}
}Stack
| | | |---|---| | Language | TypeScript 5 | | Runtime | Node.js 18+ | | CLI framework | Commander | | Output | Chalk |
Contributing
Pull requests are welcome. For major changes, open an issue first to discuss what you'd like to change.
License
Support
If envx saves you from a broken deploy, consider sponsoring on GitHub.
