Define your environment schema with Zod and get immediate type safety and runtime validation. No more debugging missing environment variables in production.
import { defineEnv, z } from "nviron";
const env = defineEnv({
PORT: z.coerce.number().default(3000),
DATABASE_URL: z.string().url(),
NODE_ENV: z.enum(["development", "production"]),
});
// usage
console.log(env.PORT); // Typed & Validated!