Registry / devops / envase

envase

JSON →
library1.5.0jsnpmunverified

Type-safe environment variable validation library (v1.5.0) that follows the Standard Schema specification, making it compatible with validation libraries like Zod, Valibot, and Arktype. It parses and validates environment variables from process.env, providing clear error messages and TypeScript type inference. Published as an ES-only package with npm release cadence; differentiates by plugging into the Standard Schema ecosystem, allowing reuse of existing schemas and tooling (e.g., TypeBox, Effect/Schema via adapters).

npm install envase
INSTALL
IMPORT
SIG · ENVASE
E
envase
devopsjavascriptv1.5.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

env
import { env } from 'envase';
const { env } = require('envase');
ESM-only; CommonJS require not supported.
parseEnv
import { parseEnv } from 'envase';
import { parseEnv } from 'envase/parse';
Direct import from main entry.
EnvaseError
import { EnvaseError } from 'envase';
Export available, but may not be needed if using standard schema errors.

Shows how to use env() with a Zod schema to parse and validate environment variables, with defaults and type inference.

import { env } from 'envase'; import { z } from 'zod'; const schema = z.object({ NODE_ENV: z.enum(['development', 'production', 'test']).default('development'), PORT: z.coerce.number().positive().int().default(3000), DATABASE_URL: z.string().url(), API_KEY: z.string().min(1), }); const safeEnv = env(schema); console.log(safeEnv.PORT); // number console.log(safeEnv.NODE_ENV); // 'development' | 'production' | 'test'
Debug
Known issues
gotchaprocess.env values are always strings; use z.coerce for numbers, booleans, etc.
fix
Use z.coerce.number(), z.coerce.boolean() or transform from string.
affects: >=0.0.0
gotchaenv() throws on missing required variables without default; catch to handle errors.
fix
Wrap in try/catch or use parseEnv() which returns Result type.
affects: >=0.0.0
breakingVersion 1.x requires Standard Schema v1; upgrade if using older standard-schema.
fix
Ensure standard-schema dependency is at version 1.x.
affects: >=1.0.0 <2.0.0
Errors
Common errors & fixes
Error: Cannot find module 'envase'
Trying to require envase with CommonJS
fix
Use ESM imports (import) or ensure package.json type: module.
TypeError: env is not a function
Mis-importing env as default export
fix
Use named import: import { env } from 'envase';
Upgrade
Version history
1.5.0latest on npm
Audit
Dependencies
standard-schemarequiredStandard Schema spec for interoperability
Agent activity
11 hits · last 30 days
node
10
Amazon
1
Resources
packageenvase
envase — npm install envase · libregistry