EnvSync is an open‑source CLI that keeps every teammate's .env aligned. It syncs keys between local env files and their tracked .env.example counterparts, updating only the variable names (never the values). Perfect for shipping config updates without leaks and making sure nobody pulls missing variables again.
“Hey, can you send me the latest .env file?” 😅
EnvSync keeps every .env in lockstep with a single command.
npm install -g @passasooz/envsync
Dopo l'installazione globale, usa semplicemente envsync in qualsiasi directory.
npm install @passasooz/envsync
Dopo l'installazione locale, usa npx envsync nel tuo progetto.
git clone https://github.com/passasooz/envsync.git
cd envsync
npm install
npm install --global .
Pro tip: you can also run the CLI directly from the repo with npx envsync (after npm install) or npm run envsync -- --help.
envsync
By default, the CLI scans all files starting with .env in the current directory (e.g., .env, .env.local, .env.production, …). For each one, it creates/updates the related .example (e.g., .env.local.example, .env.production.example, …) keeping variables separated.
envsync --check
envsync --env .env --env .env.production
# or
envsync --env config/.env.local --env config/.env.production
# single file with custom example
envsync --env config/.env --example config/.env.sample
envsync --from-example
In --check mode, the CLI exits with code 1 when it finds differences between files.
The result? Every teammate keeps an up‑to‑date .env automatically, while committed examples stay ready to version.
npm test
Run the internal test suite after cloning the repo.
Right after you complete a git pull or merge, envsync --from-example runs to auto‑update your local .env files (adds new empty keys and removes obsolete ones, leaving values intact).
Use pull with merge (Git's default behavior). In case of git pull --rebase, manually run npx envsync --from-example.
Both hooks run only locally and don't affect CI, which can still use envsync --check as an additional step.
Bug fixes, ideas, and improvements are welcome! Open an issue or send a pull request — just make sure the tests (npm test) pass before shipping it.
If EnvSync has made your life easier, you can support development by buying me a beer 🍺.