npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

snaps-back

v0.0.1

Published

CLI to snapshot and restore .env files

Downloads

10

Readme

snaps-back icon

env-snaps

npm Install Publish Install size Downloads License platform node cli deps typescript

Snapshot and restore project .env files. Simple, fast, and minimal.

Package name: snaps-back Command: env-snaps and snaps-back This package installs two CLI commands named env-snaps and snaps-back. Both run the same tool — use whichever name you prefer.


Why this exists

  • When you work on a project, your .env file (secrets and configs) changes between dev, staging, prod, etc.
  • Manually copying/renaming .env gets messy and error-prone.
  • env-snaps saves snapshots of your .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.


Install

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.


Snapshots (what & where)

  • A snapshot is a plain file: .env.<name>.snap in your chosen directory.
  • By default, snapshots live in your project root (same folder as .env).
  • You can override the directory via:
    • global flag --dir <path>, or
    • environment variable ENV_SNAPS_DIR.

Examples:

.env.dev.snap
.env.staging.snap
.env.prod.snap

Commands & Flags

Global options

  • -d, --dir <path>: Directory to read/write .env and snapshots
    (Tip: can also set ENV_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.

Example (works with either command)

npx env-snaps save dev

or

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

list

List 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

Windows notes

  • Works fine in PowerShell and CMD.
  • If you pass numbers to any flags in the future, prefer parseInt(value, 10) in your own scripts to avoid octal parsing surprises.
    (This CLI doesn't parse numbers itself, but it's good practice.)

Minimal dependencies


Examples

# 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

FAQ

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.