Compatibility

Runtime support, engine versions, module formats, and how decorators behave on Node, Bun, and Deno.

envapt runs on Node, Bun, and Deno with the same API and zero runtime dependencies. The functional reader API works on every runtime with no build step. The @Envapt decorator is TypeScript-only and has per-runtime requirements, covered below.

Engine versions

RuntimeMinimum
Node>=20
Bun>=1.3
Deno>=2.5

Each release is tested against Node 20, 22, and 24, plus Bun and Deno.

Install

pnpm add envapt

The Deno tab installs from JSR; you can also use the npm specifier with deno add npm:envapt.

Module formats

envapt ships both ESM and CommonJS with type definitions for each, so import and require both resolve. There are no runtime dependencies.

Decorators per runtime

@Envapt is a legacy TypeScript decorator, so it needs experimentalDecorators. The functional API does not, so if you cannot enable the flag on a given runtime, the readers still work.

Node. Transpile with your usual toolchain (tsc, tsx, and so on) with:

tsconfig.json
{ "compilerOptions": { "experimentalDecorators": true } }

Deno. Enable the same flag in deno.json:

deno.json
{ "compilerOptions": { "experimentalDecorators": true } }

Bun. The functional API works when you run a .ts file directly. The decorator does not.

DANGER

Bun emits TC39 (Stage 3) decorators and ignores experimentalDecorators (bun#27575), so @Envapt does not work when you run a .ts entry through Bun directly. The functional API (Envapter.get, getNumber, and the rest) is unaffected. To use the decorator on Bun, precompile with tsc, tsdown, or Vite and run the compiled JavaScript.

On this page