Single source of truth
Generate typed artifacts directly from .env.example so code, runtime validation, and documentation stay aligned.
Type-safe env generation + governance
.env.example into typed contracts and production-ready checksenv-typegen generates TypeScript, Zod, t3-env, and declaration outputs, then validates real environment sources with contract checks, drift detection, and CI-friendly reports.
Generate typed artifacts directly from .env.example so code, runtime validation, and documentation stay aligned.
Use check, diff, and doctor to enforce contracts and detect drift across local and cloud environments.
Emit machine-readable JSON reports and integrate validation into pull requests, release workflows, and deployment gates.
.env.example.$ npx env-typegen --input .env.example --output env.generated.ts
$ npx env-typegen check --env .env --contract env.contract.ts
$ npx env-typegen diff --targets .env,.env.production --contract env.contract.ts
$ npx env-typegen doctor --env .env --targets .env,.env.production --json
env-typegen is designed for teams that have moved beyond ad-hoc.env handling and need repeatable, reviewable, and typed environment contracts. Instead of relying on tribal knowledge and manual checks, you can generate strongly typed artifacts, validate every environment source, and enforce rules in CI before changes reach production.
This approach reduces deployment risk, shortens onboarding for new contributors, and gives platform teams a clear governance path across local files, cloud snapshots, and release pipelines. It is especially effective for repositories where multiple services, environments, and contributors must stay aligned over time.
dotenv loads values at runtime, but it does not enforce typed contracts or drift checks. env-typegen generates typed artifacts and adds validation commands that can be enforced in CI.
Yes. The CLI and core generators work in any Node.js/TypeScript project. You can choose only the outputs you need, including TypeScript, Zod, declaration files, or t3-env configuration.
Yes. Validation commands support cloud snapshot files from Vercel, Cloudflare, and AWS so teams can detect drift before deployment.