Introduction
env-typed-guard is a high-performance runtime safety layer for configuration correctness in Node.js applications.
The Problem
In production, missing or malformed environment variables are silent killers. Typos in .env files or forgotten variables in CI/CD pipelines often lead to runtime crashes that are hard to debug.
Type Safety
Full IntelliSense for your environment object based on your schema.
Fail-Fast
Application exits immediately on startup if configuration is invalid.
Quick Example
import { defineEnv } from "env-typed-guard";
const env = defineEnv({
PORT: { type: "number", defaultValue: 3000 },
DATABASE_URL: { type: "string" },
});
console.log(env.PORT); // 3000 (typed as number)