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

envapt

v8.0.0

Published

Type-safe config for TypeScript. Read typed values from any source, process.env, .env files, Cloudflare Workers bindings, browser bundles, or any object you supply. Zero runtime dependencies, one API across Node, Bun, Deno, Workers, and the browser. TC39

Readme

envapt returns config as the type you asked for instead of the string | undefined you get raw, with a fallback that removes undefined from the return type. It reads from whatever source you bind. On Node, Bun, and Deno that is process.env and your .env files, bound on import. On Cloudflare Workers, in the browser, or for a secrets object you fetched at boot, you bind the source with Envapter.useSource(...).

import { Envapter } from 'envapt';

const port = Envapter.getNumber('PORT', 3000); // number, not string | undefined

Read the docs →

What you get

  • Typed values. A fallback removes undefined from the return type. Built-in converters cover numbers, booleans, bigint, JSON, URLs, regular expressions, dates, durations, and arrays, or pass your own function or a Standard Schema validator (zod, valibot, arktype).
  • Any source. A source is any object with a readVars() method, so you can bind process.env, a Cloudflare Workers binding, a browser bundle, or a secrets payload you fetched from a store at boot. On Node, Bun, and Deno one binds on import.
  • Zero runtime dependencies. The reader, converters, and built-in .env parser are self-contained, so nothing is added to your dependency tree.
  • Runs on Node, Bun, Deno, Cloudflare Workers, and the browser. Node >=20, Bun >=1.3, Deno >=2.5 (ESM and CJS). The portable build resolves through the package exports conditions.
  • .env loading built in on Node. The default Node source adds a per-environment file cascade, ${VAR} templates, and strict / required checks. Off Node there is no filesystem, so you bind another source with Envapter.useSource(...) and read with the same typed API.

Install

npm install envapt
pnpm add envapt
yarn add envapt
bun add envapt
deno add jsr:@materwelon/envapt

Quick start

Read values functionally with Envapter, or bind them to class fields with the @Envapt decorator. Both share the same parsing, converters, and cache.

Functional

Read a value from any call site, in JavaScript or TypeScript. No build step. On Node the source is bound for you. On Workers and in the browser, call Envapter.useSource(...) first.

import { Envapter, Converters } from 'envapt';

const port = Envapter.getNumber('PORT', 3000);
const origins = Envapter.getUsing('ALLOWED_ORIGINS', Converters.array(), []);

On Cloudflare Workers, env is importable at module scope, so bind it once in a config module, and in the browser seed a PortableSource from the object your bundler injects.

import { env } from 'cloudflare:workers';
import { Envapter, PortableSource } from 'envapt';

Envapter.useSource(new PortableSource(env));

export const apiToken = Envapter.get('API_TOKEN');

Decorator

Bind a value to a class field with a TC39 accessor decorator. No experimentalDecorators flag, and it runs on Bun and Deno from .ts directly.

import { EnvNum } from 'envapt';

class Config {
    @EnvNum('PORT', 3000)
    static accessor port: number;
}

The legacy (experimentalDecorators) decorators are exported from envapt/legacy.

Agent skill

Install the envapt agent skill so AI coding tools use the correct API:

npx skills add materwelonDhruv/envapt