Registry / http-networking / evp-ts

evp-ts

JSON →
library1.1.1jsnpmunverified

Lightweight environment variable parser for TypeScript, inspired by Zod and Haskell's EVP. Current stable version 1.1.1 is actively maintained with regular releases. Supports nested object parsing, type inference, secret masking, default values, optional fields, and dotenv-style help generation. Key differentiators: low dependency footprint, comprehensive error reporting that continues parsing all variables, and explicit logging with secret hashing. Alternative to dotenv with stronger typing and validation, but less mature ecosystem.

npm install evp-ts
INSTALL
IMPORT
SIG · EVP-TS
E
evp-ts
http-networkingjavascriptv1.1.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

EVP
import { EVP } from 'evp-ts'
const EVP = require('evp-ts')
ESM-only. No CommonJS support.
EVP.infer
type Config = EVP.infer<typeof parser>
type Config = Infer<typeof parser>
EVP.infer is a type utility on the imported EVP namespace, not a separate export.
EVP.string
import { EVP } from 'evp-ts'; const s = EVP.string()
import { string } from 'evp-ts'
All parsers are methods on the EVP object, not named exports.

Shows parsing environment variables with types, defaults, secret masking, and custom env names.

import { EVP } from 'evp-ts'; const parser = EVP.object({ API_ENDPOINT: EVP.string(), API_TOKEN: EVP.string().secret(), HTTP_PORT: EVP.number(), DEBUG_MODE: EVP.boolean().default(false), DB_HOST: EVP.string().default('localhost').env('MYSQL_HOST'), DB_PORT: EVP.number().default(3306).env('MYSQL_PORT'), }); type Config = EVP.infer<typeof parser>; const config: Config = parser.parse(); console.log(config.API_ENDPOINT); // => string console.log(config.HTTP_PORT); // => number console.log(config.DEBUG_MODE); // => false (default)
Debug
Known issues
breakingEVP.infer changed from returning a tuple to a single type in v1.0.0
fix
Update usage to align with v1.x: EVP.infer<typeof parser> now returns the inferred config object type directly.
affects: <1.0.0
deprecatedEVP.boolean() accepts 'yes'/'no' as truthy/falsy; this is unconfigurable and may not match all locales
fix
Use EVP.string() with custom validation if you need other truthy/falsy strings.
affects: >=1.0.0
gotchaparse() does not throw on missing optional fields; it returns undefined for those keys
fix
Check for undefined or use .default() to ensure a value.
affects: >=1.0.0
gotchaSecret values are hashed with SHA-256 in logs; only the hash is shown, but the actual value is still accessible in code
fix
Be careful not to log the config object directly in production.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: EVP.infer is not a function
EVP.infer is a type-level utility, not a runtime function. It cannot be used in JavaScript files or at runtime.
fix
Only use EVP.infer in TypeScript type annotations: type T = EVP.infer<typeof parser>
Cannot find module 'evp-ts' or its corresponding type declarations.
Missing @types/evp-ts or not installed with TypeScript (but package ships types). Possibly bundler misconfiguration.
fix
Ensure tsconfig.json has 'strict' or 'esModuleInterop' enabled. Try reinstalling: npm install evp-ts
ReferenceError: EVP is not defined
Using CommonJS require without destructuring correctly, or running in a non-ESM environment without transpilation.
fix
Use the ESM import syntax: import { EVP } from 'evp-ts'
Error: Environment variable API_TOKEN is missing and no default provided
Required environment variable not set and no default with .default() or .optional().
fix
Set the variable or add .default(value) or .optional() to the parser definition.
Upgrade
Version history
1.1.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
22 hits · last 30 days
node
20
Amazon
1
OpenAI (training)
1
Resources
evp-ts — npm install evp-ts · libregistry