Quick Start
Get env-typed-guard running in your project in under 2 minutes.
1. Install
npm install env-typed-guard2. Create your config
import { defineEnv } from "env-typed-guard";
export const env = defineEnv({
PORT: { type: "number", defaultValue: 3000 },
NODE_ENV: {
type: "enum",
validValues: ["dev", "prod", "test"],
defaultValue: "dev"
}
});3. Expected Output
If PORT is missing and no default is provided, your app will exit with:
Environment validation failed:
• [env-typed-guard] PORT is required but missing
• [env-typed-guard] PORT is required but missing