CLI Reference

Typenv CLI - build, validate, and type‑generate .envx files.

Typenv CLI

The Typenv CLI ships with the typenvx package and exposes the executable name typenv
(alias typenvx). Every command is built to be predictable, type-safe, and production-ready.

Install

npm i typenvx
pnpm add typenvx
yarn add typenvx
# Typenv is not yet available for GO projects.
# Support coming soon 🚀

CLI Commands Overview

CommandDescription
typenvx generate / genGenerate .env, types, and meta file
typenvx buildGenerate only .env and meta JSON
typenvx typesGenerate TypeScript types only
typenvx validateValidate your .envx configuration
typenvx printOutput resolved variables as JSON
typenvx watchWatch for changes and rebuild automatically

Command Details

generate / gen

Generates everything: .env, envx.meta.json, and TypeScript types.

npx typenvx  generate
FlagDescription
--no-typesSkip TypeScript type generation

build

Converts your .envx into a runtime-ready .env file and emits a metadata file.

npx typenvx  build --overwrite

types

Generates only the TypeScript definitions based on your schema.

npx typenvx  types --typesOutput src/types/envx.d.ts

validate

Validates your .envx file against its schema to catch configuration errors before runtime.

npx typenvx  validate

print

Prints resolved variables as structured JSON great for debugging logic or interpolation.

npx typenvx  print

watch

Watches the input .envx file and regenerates outputs on change.

npx typenvx  watch
FlagDescription
--no-typesSkip generating TypeScript types
--no-buildSkip building the .env file
--silentSuppress console output

Configuration File

You can centralize config using envx.config.json:

{
  "input": "./.envx",
  "outputs": {
    "env": "./.env",
    "types": "./types/envx.ts",
    "metaFilePath": "."
  },
  "overwrite": true
}

CLI flags override config file values.


Exit Codes

CodeMeaning
0Success
1Validation Error
2Unknown/File Error

Typenv is designed for clarity, safety, and automation in modern dev pipelines.