Getting Started
Typenv delivers the .envx standard a typed, validated, and expressive replacement for legacy .env files.
Typenv · Reinventing environment configuration
Typenv does not wrap classic .env files it supersedes them with the compact, self‑documenting .envx format.
Why migrate?
| Concern | Legacy .env | Typenv (.envx) |
|---|---|---|
| Type safety | — | Built‑in → string, number, boolean, url, enum, … |
| Validation | Manual runtime checks | CLI / runtime validation; fails fast |
| Documentation | None | Inline description blocks → IDE hover docs |
| Logic support | — | Expressions, conditionals, interpolation |
| Developer feedback | Typo ships to prod | Compile‑time errors + IntelliSense |
.envx is backward‑compatible rename your existing file and add schema blocks incrementally.
A quick look
# Conditional value
API_URL = ${NODE_ENV} === "dev" ? "http://localhost:3000" : "https://api.myapp.com"
# Interpolated string
FULL_API_URL = "${API_URL}?token=${API_TOKEN}"
# Schema block
[API_URL]
type = "url"
description = """Base URL that changes with the environment."""Current status
- Target runtimes: TypeScript / JavaScript
- Tooling: NPM package
typenvx, CLInpx typenv, VS Code extension Envx for VSCode - Roadmap: Community‑driven ports for Go, Python, Rust, … (PRs welcome!)
Zero‑to‑prod in four steps
npm i typenvxDefine variables with the new syntax.
Append [VAR] sections for types, validation, docs.
npx typenvx generateLoading variables in code
import { EnvVars } from "@/types/envx";
import { getEnvx } from "typenvx";
export const envx = getEnvx<EnvVars>()The env object is fully typed no more string casting or manual parsing.