
Security News
Software Engineering Daily Podcast: Feross on AI, Open Source, and Supply Chain Risk
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.
Snapshot and restore project .env files. Simple, fast, and
minimal.
Package name:
snaps-backCommand:env-snapsandsnaps-backThis package installs two CLI commands namedenv-snapsandsnaps-back. Both run the same tool — use whichever name you prefer.
.env file (secrets and configs)
changes between dev, staging, prod, etc..env gets messy and error-prone..env to files like .env.dev.snap and lets you quickly load them back.You are never forced to learn a complex system---these are just plain text files in your repo folder.
Local (recommended):
npm install --save-dev snaps-back
This gives you npx env-snaps ... inside your project.
Global (optional):
npm install --global snaps-back
Then you can run env-snaps ... anywhere.
.env.<name>.snap in your chosen
directory..env).--dir <path>, orENV_SNAPS_DIR.Examples:
.env.dev.snap
.env.staging.snap
.env.prod.snap
-d, --dir <path>: Directory to read/write .env and snapshotsENV_SNAPS_DIR to avoid repeating the flag)save <name>Save the current .env to .env.<name>.snap.
Options: - -f, --force: Overwrite the snapshot if it already exists.
npx env-snaps save dev
npx snaps-back save dev
More examples:
# Save current .env as .env.dev.snap
npx env-snaps save dev
# Overwrite if exists
npx env-snaps save dev --force
load <name>Load .env.<name>.snap into .env.
Options: - --backup: If a .env exists, first back it up to
.env.backup.
Example:
# Load .env.dev.snap into .env
npx env-snaps load dev
# Backup existing .env -> .env.backup before loading
npx env-snaps load dev --backup
listList all available .env.*.snap files.
Example:
npx env-snaps list
diff <name1> <name2>Show a line-by-line diff between two snapshots.
Options: - --color (default) / --no-color
Example:
# Compare dev vs staging
npx env-snaps diff dev staging
# Force no color (useful for CI or logs)
npx env-snaps diff dev staging --no-color
parseInt(value, 10) in your own scripts to avoid octal parsing
surprises.# Save snapshots for multiple environments
npx env-snaps save dev
npx env-snaps save staging
npx env-snaps save prod
# Switch to dev quickly (backup current .env first)
npx env-snaps load dev --backup
# List what you have
npx env-snaps list
# See what changed between dev and staging
npx env-snaps diff dev staging
Where are the files stored?
Right alongside your .env by default (or in the folder you pass via
--dir / ENV_SNAPS_DIR).
Is it safe to commit snapshots?
Treat them like your .env --- if they contain secrets, do not
commit them. Use .gitignore if needed.
Does the tool merge .env files?
No. It's intentionally minimal: it saves, loads, lists, and diffs.
FAQs
CLI to snapshot and restore .env files
The npm package snaps-back receives a total of 1 weekly downloads. As such, snaps-back popularity was classified as not popular.
We found that snaps-back demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.

Security News
GitHub has revoked npm classic tokens for publishing; maintainers must migrate, but OpenJS warns OIDC trusted publishing still has risky gaps for critical projects.

Security News
Rust’s crates.io team is advancing an RFC to add a Security tab that surfaces RustSec vulnerability and unsoundness advisories directly on crate pages.