zorath-env
Built by Zorath -- infrastructure for builders.
A tiny, fast CLI that makes .env sane.
zenv validates environment variables from a schema, generates docs, and helps keep config consistent across dev/staging/prod.
Why
.env files drift. Teams copy/paste secrets. CI fails late. Docs go stale.
zenv makes your schema the source of truth.
Schema is the source of truth. Docs and examples should be generated from it.
Works with any stack
zenv is language-agnostic. Use it with Node.js, Python, Go, Ruby, Rust, Java, PHP, or any project that uses .env files. It's a standalone binary with zero runtime dependencies.
Install
Via cargo (recommended)
From source
Run locally
Quick start
- Create a schema:
- Validate your
.env:
- Generate docs:
Commands
zenv check
Validates .env against env.schema.json.
- exits
0if valid - exits
1if invalid (CI-friendly)
zenv docs
Generates documentation for all env vars in the schema.
zenv init
Creates env.schema.json from .env.example (best-effort inference, you refine types after).
zenv version
Shows installed version and optionally checks for updates.
Files
By default, zenv looks for:
.env(optional).env.example(optional)env.schema.json(preferred)
Env file fallback
If .env doesn't exist, zenv check will automatically try:
.env.local.env.development.env.development.local
This is useful for Next.js and other frameworks that use .env.local for secrets.
You can override paths:
Schema format (v0.2)
env.schema.json is a JSON object where each key is an env var name.
Example:
Supported types:
stringintfloatboolurlenum
Validation rules
Add constraints with the validate field:
Schema inheritance
Schemas can extend other schemas:
.env features
Variable interpolation
Reference other variables with ${VAR} or $VAR:
BASE_URL=https://api.example.com
API_ENDPOINT=${BASE_URL}/v2
Multiline values
Use quoted strings for multiline:
SSH_KEY="-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEA...
-----END RSA PRIVATE KEY-----"
Escape sequences
Double-quoted strings support \n, \t, \r, \\, \"
Example output
Success
Validation errors
)
Pre-commit hook
# .git/hooks/pre-commit (make executable)
#!/usr/bin/env bash
if [; then
if ; then
||
else
||
fi
fi
Connect
More from Zorath: edgeurl.io/p/zorl-engine
License
MIT