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

stackdiff

v0.1.0

Published

Dump environment variables and diff them between snapshots

Readme

⚡ stackdiff

npm version license

Snapshot, dump, and diff your environment variables. Detect installed tool versions. Beautiful colored output with spinners.

Install

npm install -g stackdiff

Or use with npx:

npx stackdiff dump

Commands

| Command | Description | |---------|-------------| | stackdiff dump | Dump all current environment variables (sorted, colored) | | stackdiff save <name> | Save current env as a named snapshot | | stackdiff diff <a> [b] | Diff snapshot a vs snapshot b (or current env if b omitted) | | stackdiff list | List all saved snapshots with timestamps | | stackdiff delete <name> | Delete a saved snapshot | | stackdiff search <pattern> | Search env vars by key or value (regex supported) | | stackdiff export [name] | Export env (or snapshot) as .env file format | | stackdiff stats [name] | Show summary stats (var count, PATH entries, sizes) | | stackdiff versions | Detect and display installed tool versions | | stackdiff containers | Show Docker/Podman containers, images, volumes, networks | | stackdiff help | Show help |

Usage Examples

Dump current environment

stackdiff dump

Outputs all variables sorted alphabetically with colored KEY=value formatting and a total count.

Save & compare snapshots

# Save env before making changes
stackdiff save before

# ... install something, change PATH, etc. ...

# See what changed
stackdiff diff before

Output shows added (green), removed (red), and changed (yellow) variables with before/after values.

Compare two snapshots

stackdiff save dev
stackdiff save prod
stackdiff diff dev prod

View environment stats

stackdiff stats
Environment stats (current):
  Total variables:  68
  Total value size: 4131 chars
  PATH entries:     50
  Longest key:      NuGetPackageSourceCredentials_vsts
  Longest value:    Path (2291 chars)

Search variables

stackdiff search PATH

Search for variables whose key or value matches a regex pattern (case-insensitive).

Export as .env file

# Export current env
stackdiff export > .env

# Export a snapshot
stackdiff export prod > prod.env

Outputs variables in KEY="value" format with proper escaping, suitable for use with dotenv or Docker.

Delete a snapshot

stackdiff delete old-snapshot

Detect tool versions

stackdiff versions
Detected tool versions:

  node    v22.17.0
  npm     11.11.0
  npx     11.11.0
  pnpm    10.33.0
  git     git version 2.48.1.windows.1
  python  Python 3.13.0
  java    openjdk version "23.0.2" 2025-01-21
  dotnet  10.0.203
  docker  Docker version 29.2.1, build a5c7197

Detected tools: node, npm, npx, yarn, pnpm, git, python, java, dotnet, docker (skips any not installed).

Docker/Podman containers

stackdiff containers
Container runtime: docker

┌ Containers (2)
│  my-api image=node:22-alpine Up 3 hours
│  my-db image=postgres:16 Up 3 hours

┌ Images (5)
│  node:22-alpine 187MB
│  postgres:16 430MB
│  redis:7-alpine 40MB
│  ...

┌ Volumes (1)
│  pgdata local

┌ Networks (3)
│  bridge bridge
│  host host
│  my-app-net bridge

Automatically detects whether Docker or Podman is available and displays all containers (running and stopped), images, volumes, and networks.

Programmatic API

const { dumpEnv, saveSnapshot, loadSnapshot, diffEnv, searchEnv, exportEnv, deleteSnapshot, getVersions, detectContainerRuntime, getContainerInfo } = require('stackdiff');

// Get all env vars as a formatted string
console.log(dumpEnv());

// Save/load snapshots
saveSnapshot('./snap.json');
const env = loadSnapshot('./snap.json');

// Diff two env objects
const result = diffEnv(envA, envB);
// result = { added: ['NEW_VAR'], removed: ['OLD_VAR'], changed: ['MODIFIED_VAR'] }

// Search env vars by pattern (regex, case-insensitive)
const matches = searchEnv('node', process.env);
// matches = [{ key: 'NODE_ENV', value: 'production' }, ...]

// Export as .env format string
const dotenv = exportEnv(process.env);

// Delete a snapshot
deleteSnapshot('./snap.json'); // returns true/false

// Get installed tool versions
const versions = getVersions();
// versions = [{ name: 'node', version: 'v22.17.0' }, ...]

// Docker/Podman info
const runtime = detectContainerRuntime(); // 'docker', 'podman', or null
const info = getContainerInfo();
// info = { runtime, containers: [...], images: [...], volumes: [...], networks: [...] }

Snapshots

Snapshots are stored in .stackdiff/ in the current working directory as JSON files. Add .stackdiff/ to your .gitignore if you don't want to commit them.

.stackdiff/

Requirements

  • Node.js >= 16.0.0

License

MIT