Define settings with decorators and get real types, not ad‑hoc parsing. Strings, numbers, booleans, dates, arrays, and objects are coerced from env safely.
Settings managed.
Make settings first-class citizens in your application.
Define settings with decorators and get real types, not ad‑hoc parsing. Strings, numbers, booleans, dates, arrays, and objects are coerced from env safely.
Fail fast when inputs are missing or malformed, and express defaults inline or via validators so development is smooth without a huge .env.
Group env vars into settings classes (e.g., DatabaseSettings, EmailSettings) so configuration is discoverable, consistent, and reviewable.
Override fields per test with `overrideForTest()` — no process.env mutation, no module reloads. Keep tests isolated and code deterministic.
List settings, generate .env templates, JSON/YAML, values.yaml, and Compose/K8s env blocks — all derived from your classes.
Mark fields @secret to avoid accidental leaks. JSON dumps redact values while keeping structures intact for safe logging.
Use clear naming by default, with alias overrides when you need to match external env conventions.
JSON‑parse arrays and objects from env, validate shapes with Zod via the v builder, and compose rich constraints in one place.