{"id":18320,"library":"evp-ts","title":"evp-ts","description":"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.","status":"active","version":"1.1.1","language":"javascript","source_language":"en","source_url":"https://github.com/fumieval/evp-ts","tags":["javascript","typescript"],"install":[{"cmd":"npm install evp-ts","lang":"bash","label":"npm"},{"cmd":"yarn add evp-ts","lang":"bash","label":"yarn"},{"cmd":"pnpm add evp-ts","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM-only. No CommonJS support.","wrong":"const EVP = require('evp-ts')","symbol":"EVP","correct":"import { EVP } from 'evp-ts'"},{"note":"EVP.infer is a type utility on the imported EVP namespace, not a separate export.","wrong":"type Config = Infer<typeof parser>","symbol":"EVP.infer","correct":"type Config = EVP.infer<typeof parser>"},{"note":"All parsers are methods on the EVP object, not named exports.","wrong":"import { string } from 'evp-ts'","symbol":"EVP.string","correct":"import { EVP } from 'evp-ts'; const s = EVP.string()"}],"quickstart":{"code":"import { EVP } from 'evp-ts';\n\nconst parser = EVP.object({\n  API_ENDPOINT: EVP.string(),\n  API_TOKEN: EVP.string().secret(),\n  HTTP_PORT: EVP.number(),\n  DEBUG_MODE: EVP.boolean().default(false),\n  DB_HOST: EVP.string().default('localhost').env('MYSQL_HOST'),\n  DB_PORT: EVP.number().default(3306).env('MYSQL_PORT'),\n});\n\ntype Config = EVP.infer<typeof parser>;\nconst config: Config = parser.parse();\n\nconsole.log(config.API_ENDPOINT); // => string\nconsole.log(config.HTTP_PORT);    // => number\nconsole.log(config.DEBUG_MODE);   // => false (default)","lang":"typescript","description":"Shows parsing environment variables with types, defaults, secret masking, and custom env names."},"warnings":[{"fix":"Update usage to align with v1.x: EVP.infer<typeof parser> now returns the inferred config object type directly.","message":"EVP.infer changed from returning a tuple to a single type in v1.0.0","severity":"breaking","affected_versions":"<1.0.0"},{"fix":"Use EVP.string() with custom validation if you need other truthy/falsy strings.","message":"EVP.boolean() accepts 'yes'/'no' as truthy/falsy; this is unconfigurable and may not match all locales","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Check for undefined or use .default() to ensure a value.","message":"parse() does not throw on missing optional fields; it returns undefined for those keys","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Be careful not to log the config object directly in production.","message":"Secret values are hashed with SHA-256 in logs; only the hash is shown, but the actual value is still accessible in code","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Only use EVP.infer in TypeScript type annotations: type T = EVP.infer<typeof parser>","cause":"EVP.infer is a type-level utility, not a runtime function. It cannot be used in JavaScript files or at runtime.","error":"TypeError: EVP.infer is not a function"},{"fix":"Ensure tsconfig.json has 'strict' or 'esModuleInterop' enabled. Try reinstalling: npm install evp-ts","cause":"Missing @types/evp-ts or not installed with TypeScript (but package ships types). Possibly bundler misconfiguration.","error":"Cannot find module 'evp-ts' or its corresponding type declarations."},{"fix":"Use the ESM import syntax: import { EVP } from 'evp-ts'","cause":"Using CommonJS require without destructuring correctly, or running in a non-ESM environment without transpilation.","error":"ReferenceError: EVP is not defined"},{"fix":"Set the variable or add .default(value) or .optional() to the parser definition.","cause":"Required environment variable not set and no default with .default() or .optional().","error":"Error: Environment variable API_TOKEN is missing and no default provided"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}