# af/envalid

Environment variable validation for Node, Bun, and other compatible JS runtimes

Repository: https://github.com/af/envalid
Canonical: https://ross.abutalabs.com/products/envalid
Language: TypeScript
License: MIT
License Family: permissive
Topics: node, nodejs, environment, validation, javascript, bun
Last push: 2026-08-21T13:33:57+00:00

## Health v2 (maintenance only)
Score: 83/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 98, release rhythm 55, longevity 100
- inputs: {"age_days": 5025, "days_push": 12, "days_rel": 85, "gap_med": 332, "n_releases_24m": 2}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1588, forks 68 (observed 2026-08-28T04:05:07.992988+00:00)

## What it is
Envalid is a small TypeScript library for validating and accessing environment variables in Node.js, Bun, and other compatible JavaScript runtimes. It ensures programs only run when required environment variables are present and valid, providing a type-safe, immutable API for env access.

## Use cases
- validate environment variables in a node app
- fail fast when required env vars are missing
- parse env vars into typed values like booleans and numbers
- enforce allowed choices for NODE_ENV
- load and validate .env config with dotenv
- get type-safe access to process.env in TypeScript

## When to choose
- you want zero-dependency, type-safe env validation for Node or Bun
- you need executable documentation of your app's environment requirements
- you want immutable, sanitized env objects with custom validators and reporters

## When to avoid
- you need full config management beyond environment variables
- you're not on a JavaScript runtime
- you only need simple dotenv loading without validation

## Facets
- artifact type: library
- maturity: stable
- function: form-handling, configuration-management, developer-tools
- domain: developer-tools, backend
- platform: bun, cross-platform
- tags: environment-variables, env-validation, typescript, dotenv, zero-dependency, nodejs

## Member repositories
- af/envalid (main) score 83

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:05:07.992988+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T03:54:59.923698+00:00, confidence not recorded.
  - readme: https://github.com/af/envalid (fetched 2026-08-28T04:05:07.992988+00:00, sha ca431a72ef3b)
  - registry_npm: https://registry.npmjs.org/envalid (fetched 2026-08-29T11:25:56.006360+00:00, sha ab212b359312)
- Data as of 2026-08-30T08:39:29.467469+00:00.
