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 typenvxpnpm add typenvxyarn add typenvx# Typenv is not yet available for GO projects.
# Support coming soon 🚀CLI Commands Overview
| Command | Description |
|---|---|
typenvx generate / gen | Generate .env, types, and meta file |
typenvx build | Generate only .env and meta JSON |
typenvx types | Generate TypeScript types only |
typenvx validate | Validate your .envx configuration |
typenvx print | Output resolved variables as JSON |
typenvx watch | Watch for changes and rebuild automatically |
Command Details
generate / gen
Generates everything: .env, envx.meta.json, and TypeScript types.
npx typenvx generate| Flag | Description |
|---|---|
--no-types | Skip TypeScript type generation |
build
Converts your .envx into a runtime-ready .env file and emits a metadata file.
npx typenvx build --overwritetypes
Generates only the TypeScript definitions based on your schema.
npx typenvx types --typesOutput src/types/envx.d.tsvalidate
Validates your .envx file against its schema to catch configuration errors before runtime.
npx typenvx validateprint
Prints resolved variables as structured JSON great for debugging logic or interpolation.
npx typenvx printwatch
Watches the input .envx file and regenerates outputs on change.
npx typenvx watch| Flag | Description |
|---|---|
--no-types | Skip generating TypeScript types |
--no-build | Skip building the .env file |
--silent | Suppress 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
| Code | Meaning |
|---|---|
0 | Success |
1 | Validation Error |
2 | Unknown/File Error |
Typenv is designed for clarity, safety, and automation in modern dev pipelines.