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

@hevar/env-generator

v1.0.1

Published

CLI to generate .env files for monorepo apps from a single JSON config with profiles, environments, and interactive mode

Readme

env-generator

Single source of truth for .env files across a monorepo.

Define all env vars in one env.json, organized by app, group, and environment. Run one command, get the right .env files everywhere.

Setup

npm install env-generator

Create an env.json in your project root (see env.template.json for the structure):

{
  "web": {
    "outputPath": "apps/web/.env",
    "database": {
      "local": {
        "DATABASE_URL": "postgresql://localhost:5432/myapp"
      },
      "staging": {
        "DATABASE_URL": "postgresql://staging-host:5432/myapp"
      },
      "prod": {
        "DATABASE_URL": ""
      }
    },
    "general": {
      "local": {
        "NODE_ENV": "development",
        "PORT": "3000"
      },
      "staging": {
        "NODE_ENV": "production",
        "PORT": "3000"
      },
      "prod": {
        "NODE_ENV": "production",
        "PORT": "3000"
      }
    }
  }
}

Each top-level key is an app. Inside each app, outputPath says where the .env file goes, and everything else is a "group" of related variables (database, auth, general, whatever makes sense for you). Each group has environments (local, staging, prod — or whatever you call yours).

Usage

# set everything to local
npx env-generator local

# set everything to staging
npx env-generator staging

# mix and match — local for everything, but staging for the cms
npx env-generator local --cms=staging

# interactive mode — pick environment per group with a nice UI
npx env-generator -i

# preview what would be generated without writing anything
npx env-generator local --dry-run

Profiles

If you find yourself repeatedly using the same combination of environments, create a profiles.json:

{
  "dev": {
    "description": "Local dev with staging CMS",
    "*": "local",
    "web": {
      "cms": "staging"
    }
  },
  "all-local": {
    "description": "Everything local",
    "*": "local"
  }
}

Then use them:

npx env-generator -p dev
npx env-generator -l         # list available profiles

Config location

By default it looks for env.json and profiles.json in the current directory. If your config lives somewhere else, use --config:

npx env-generator --config packages/env local

Output paths in env.json are always resolved from where you run the command (your project root), not from the config directory.

Secrets

Keep prod secrets out of version control. Put empty strings as placeholders in env.json for sensitive values — the tool will warn you about them. Fill them in locally or inject them in CI. You can also keep a separate env.json out of git and point to it with --config.