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

@neerav34/env-doctor

v1.0.10

Published

The eslint of environment variables — catch missing env vars before they hit production

Downloads

1,727

Readme

env-doctor

The eslint of environment variables — catch missing env vars before they hit production.

env-doctor-web.vercel.app · npm · GitHub Action · VS Code Extension

npm version CI License: MIT

The Problem

Developers lose hours debugging "works on my machine" failures caused by missing, misconfigured, or undocumented environment variables. env-doctor gives you a fast, zero-config CLI that scans your codebase, detects all env var references, and cross-checks them against your .env and .env.example files.

VS Code Extension

Get inline squiggles directly in your editor — no terminal needed. Install env-doctor from the VS Code Marketplace.

Features

  • Zero config — works out of the box on Node.js, Python, Go, Rust, Ruby, PHP, and Shell projects
  • Multi-language detectionprocess.env, os.environ, os.Getenv, env::var, ENV[], and more
  • CI-ready — meaningful exit codes (0 = clean, 1 = errors, 2 = warnings, 3 = fatal)
  • Three output formats — pretty terminal output, JSON for tooling, Markdown for PR comments
  • Auto-fix--fix updates .env.example automatically
  • Health scoringdoctor command gives a 0–100 score with trend tracking

Installation

npm install -g @neerav34/env-doctor
# or use without installing
npx @neerav34/env-doctor check

Quick Start

# Check for discrepancies
env-doctor check

# Generate / update .env.example from your code
env-doctor init

# Full diagnostic with health score
env-doctor doctor

Commands

env-doctor check

Scans your codebase and reports all environment variable discrepancies.

env-doctor check [options]

Options:
  --fix                    Auto-update .env.example to match code references
  --strict                 Treat warnings as errors (exit 1)
  --env-file <path>        Path to .env file (default: .env)
  --example-file <path>    Path to .env.example file (default: .env.example)
  --ignore <patterns...>   Additional glob patterns to skip
  --format <fmt>           Output format: pretty | json | markdown (default: pretty)
  --no-color               Disable ANSI color output
  --root <path>            Project root directory (default: cwd)

Exit codes: | Code | Meaning | |------|---------| | 0 | All clear | | 1 | ERROR-level issues found (or --strict with warnings) | | 2 | Only WARN-level issues | | 3 | Fatal error (crash, bad arguments) |

env-doctor init

Generates or updates .env.example from all env var references found in your code.

env-doctor init [options]

Options:
  --env-file <path>        Source .env file (default: .env)
  --example-file <path>    Target file (default: .env.example)
  --with-comments          Add source file comments to each variable
  --ignore <patterns...>   Additional glob patterns to skip
  --no-color               Disable ANSI color output
  --root <path>            Project root directory

env-doctor doctor

Full diagnostic with a health score (0–100) and trend analysis vs. previous scans.

env-doctor doctor [options]

Same flags as check. Stores scan history in .env-doctor/cache.json.

What It Detects

| Check | Severity | Description | |-------|----------|-------------| | Missing Required | ERROR | Var referenced in code but absent from both .env and .env.example | | Missing Optional | WARN | Var referenced in code and in .env.example but not in .env | | Unused Variable | WARN | Var defined in .env but never referenced in code | | Example Drift | WARN | Var in .env but not in .env.example (or vice versa) |

Supported Languages

| Language | Detected Patterns | |----------|------------------| | JavaScript / TypeScript | process.env.VAR, process.env['VAR'], import.meta.env.VAR | | Python | os.environ['VAR'], os.environ.get('VAR'), os.getenv('VAR') | | Go | os.Getenv("VAR") | | Rust | env::var("VAR") | | Ruby | ENV['VAR'] | | PHP | $_ENV['VAR'], getenv('VAR') | | Shell / Docker | ${VAR} in .sh, Dockerfile, docker-compose.yml |

CI Integration

GitHub Actions

- name: Check environment variables
  run: npx env-doctor check --strict --format markdown >> $GITHUB_STEP_SUMMARY

GitLab CI

env-check:
  script:
    - npx env-doctor check --strict

Output Examples

Pretty (default)

  ERRORS (1)

  ✗  DATABASE_URL  [Missing Required]
     DATABASE_URL is referenced in 2 location(s) but not defined in .env or .env.example
     └─ src/db.ts:14  const pool = new Pool({ connectionString: process.env.DATABASE_URL });
     → Add DATABASE_URL to .env.example

  WARNINGS (2)

  ⚠  OLD_API_KEY  [Unused Variable]
     OLD_API_KEY is defined in .env but never referenced in source code
     → Remove OLD_API_KEY from .env or check for typos in variable name

  Scanned 142 files in 45ms

JSON (--format json)

{
  "success": false,
  "summary": { "errors": 1, "warnings": 2, "scannedFiles": 142, "duration": 45 },
  "issues": [...]
}

Development

git clone https://github.com/your-username/env-doctor.git
cd env-doctor
npm install
npm run dev -- check          # run in dev mode
npm test                      # run tests
npm run build                 # build to dist/
npm run dogfood               # run against itself

License

MIT © Neerav Jha