dotenv2types

Paste a .env → production-shaped env.ts with Zod schema, types-only file, and .env.example with comments. No signup. LLM-named. +Enter to generate.

.env
Up to 50 KB · 20 generations / hour / IP · free
env.ts — save as src/env.ts
// Zod-validated env.ts will appear here
types.ts — save as src/env-types.ts
// Type-only Env will appear here
.env.example — replace your existing one
# .env.example with comments will appear here
Single email when v1.2 ships. No drip, no marketing.
Use these in your project

1. Save the panels as src/env.ts (with Zod runtime), src/env-types.ts (types-only), and .env.example at your repo root.

2. Install Zod (peer-dep for the schema file):

npm i zod

3. Load + validate at app start:

import { env } from "./env";

console.log(`Server starting on port $${env.PORT}`);

If a required env var is missing or mis-typed, the import throws with the failing key — fail-fast at boot beats process.env.X! exploding in production.