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

envcheck-dev

v1.0.0

Published

Validate .env files against .env.example — catch missing variables before runtime

Readme

envcheck

Validate .env files against .env.example --- catch missing variables before runtime.

Every dev team has this problem: someone adds a new env var to .env.example but another developer's .env is missing it, leading to a cryptic runtime error. envcheck catches that instantly.

  • Zero dependencies --- pure Node.js
  • Works in any project that uses .env files
  • CI/CD friendly with JSON output and non-zero exit codes
  • Respects NO_COLOR for accessibility

Install

# Global
npm install -g envcheck-cli

# Per-project (recommended)
npm install --save-dev envcheck-cli

Usage

# Compare .env against .env.example in current directory
envcheck

# Custom file paths
envcheck --env config/.env.local --example config/.env.example

# Strict mode: fail if .env has extra vars not in .env.example
envcheck --strict

# Fail if any variable has an empty value
envcheck --no-empty

# Combine flags
envcheck --strict --no-empty

# JSON output (for CI pipelines)
envcheck --format json

# CI mode: exit code 1 on any issue
envcheck --ci

Options

| Flag | Description | Default | |------|-------------|---------| | --env <path> | Path to the .env file | .env | | --example <path> | Path to the .env.example file | .env.example | | --strict | Fail if .env has extra vars not in .env.example | false | | --no-empty | Fail if any variable has an empty value | false | | --format json | Output results as JSON | text | | --ci | Exit code 1 on any issue (extra vars, empty values) | false | | -h, --help | Show help message | | | -v, --version | Show version number | |

Exit Codes

| Code | Meaning | |------|---------| | 0 | All checks passed | | 1 | Issues found (missing, extra in strict mode, or empty vars) | | 2 | Configuration error (file not found, unknown flag) |

CI/CD Integration

GitHub Actions

# .github/workflows/envcheck.yml
name: Environment Check
on: [push, pull_request]

jobs:
  envcheck:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
      - run: npx envcheck-cli --strict --no-empty --ci

GitLab CI

# .gitlab-ci.yml
envcheck:
  stage: validate
  image: node:20-alpine
  script:
    - npx envcheck-cli --strict --no-empty --ci
  rules:
    - changes:
        - .env.example

Pre-commit Hook

Add to your package.json:

{
  "scripts": {
    "prestart": "envcheck --strict --no-empty"
  }
}

Or with Husky:

# .husky/pre-commit
npx envcheck --strict --no-empty

JSON Output

When using --format json, envcheck outputs structured data for programmatic use:

{
  "ok": false,
  "missing": ["DATABASE_URL", "REDIS_URL"],
  "extra": ["DEBUG_MODE"],
  "empty": ["API_KEY"],
  "summary": {
    "missingCount": 2,
    "extraCount": 1,
    "emptyCount": 1
  }
}

How It Works

  1. Parses both .env and .env.example files
  2. Compares the variable names (keys) between the two files
  3. Reports missing variables (in .env.example but not in .env)
  4. Reports extra variables (in .env but not in .env.example)
  5. Optionally checks for empty values (--no-empty)
  6. Ignores comments (#) and blank lines
  7. Handles quoted values ("value" and 'value')

License

MIT --- Tate Lyman