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?

ConcernLegacy .envTypenv (.envx)
Type safetyBuilt‑in → stringnumberbooleanurlenum, …
ValidationManual runtime checksCLI / runtime validation; fails fast
DocumentationNoneInline description blocks → IDE hover docs
Logic supportExpressions, conditionals, interpolation
Developer feedbackTypo ships to prodCompile‑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, CLI npx 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 typenvx

Define variables with the new syntax.

Append [VAR] sections for types, validation, docs.

npx typenvx generate

Loading 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.