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

envvet

v0.1.0

Published

Validate a project's .env against a contract so missing, extra, or empty variables are caught locally and in CI.

Readme

envvet

Validate your .env against a contract so missing, extra, or empty variables are caught — locally and in CI.

envvet compares your real .env file against a committed .env.example (the contract). It tells you which keys the example expects but your .env is missing, which keys your .env defines that the example doesn't know about (extra), and which required keys are present but empty. It exits non-zero on problems, so it drops straight into a CI pipeline as a gate.

  • Zero config — auto-detects .env and .env.example in the current directory.
  • One tiny dependency (picocolors for output).
  • Ships a library API as well as the CLI.
  • Works with any project that uses dotenv-style files — not framework-specific.

Why

The .env.example in your repo is supposed to document every variable the app needs. In practice it drifts: someone adds a variable to their local .env and forgets the example, or a teammate clones the repo, copies the example, and ships with a blank API_KEY. envvet turns that implicit contract into something you can actually enforce.

Install

pnpm add -D envvet
# or
npm install --save-dev envvet
# or
yarn add -D envvet

Run it without installing:

npx envvet

Usage

From a project root containing .env and .env.example:

envvet
Missing (1)
  • LOG_LEVEL

Empty (1)
  • API_KEY

Extra (1)
  • EXTRA_THING

On success:

All environment variables present.

Options

| Flag | Default | Description | | ------------------ | -------------- | ---------------------------------------------------- | | --env <path> | .env | Path to the env file to check. | | --example <path> | .env.example | Path to the contract file. | | --allow-extra | false | Don't fail on keys present in .env but not example.| | --json | false | Emit machine-readable JSON. | | -h, --help | | Show help. | | -v, --version | | Show the version. |

Exit codes

| Code | Meaning | | ---- | -------------------------------------------------------------- | | 0 | All environment variables present. | | 1 | Problems found (missing / empty, or extra when not allowed). | | 2 | Runtime error (e.g. the example file could not be read). |

A missing .env is treated as a normal failure (every key is reported missing), not a runtime error — only an unreadable example file produces exit code 2.

CI

Add a check to your pipeline so a drifted contract fails the build. GitHub Actions:

name: env

on: [push, pull_request]

jobs:
  envvet:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
      # In CI you usually only commit .env.example, so check the example
      # against itself, or against an .env you materialise from secrets.
      - run: npx envvet --env .env.example --example .env.example

Library API

import { parseEnv, compareEnv } from "envvet";
import type { CompareResult } from "envvet";

const env = parseEnv("FOO=bar\nexport BAZ='qux'");
// → { FOO: "bar", BAZ: "qux" }

const result: CompareResult = compareEnv({
  env,
  example: { FOO: "", BAZ: "", MISSING: "" },
  allowExtra: false,
});
// → { missing: ["MISSING"], extra: [], empty: [], ok: false }

parseEnv(text: string): Record<string, string>

A small, robust dotenv parser. Handles KEY=value, export KEY=value, single- and double-quoted values (with \n/\t/\r escapes inside double quotes), empty values, # comments (full-line and trailing on unquoted values), blank lines, and = characters inside values.

compareEnv(options): CompareResult

interface CompareOptions {
  env: Record<string, string>;
  example: Record<string, string>;
  allowExtra?: boolean;
}

interface CompareResult {
  missing: string[]; // in example, absent from env
  extra: string[];   // in env, absent from example
  empty: string[];   // in both, but empty in env
  ok: boolean;       // overall pass/fail given allowExtra
}

License

MIT © 2026 Abdulmunim Jemal