Introduction
Read environment variables as typed values, with zero runtime dependencies, plus zod/valibot/arktype validation.
envapt reads environment variables as typed values. You give it a key and a fallback; it returns a number, boolean, URL, Date, an array, or any type you define, instead of the string | undefined you get from process.env.
const port = .('PORT', 3000);Two ways to read
Read values functionally with Envapter, or bind them to class fields with the @Envapt decorator. Both share the same parsing, converters, and cache.
class {
@('PORT', { : ., : 3000 })
declare static readonly : number;
}What you get
- Typed values. A fallback removes
undefinedfrom the return type. Converters convert numbers, booleans, bigint, JSON, URLs, dates, durations, and arrays, or pass your own function or a Standard Schema validator (zod, valibot, arktype). - Zero runtime dependencies. envapt ships its own
.envparser, so nothing is added to your dependency tree. - The same API on Node, Bun, and Deno. See Compatibility.
.envloading built in. A per-environment file cascade,${VAR}templates, and strict / required checks.
Next
Start with the Quick Start, then the Envapter reader API.