envx is a local-first CLI for working with .env files in Rust projects.
It covers the basic file operations, encryption support, diffing, template expansion, and shell completions.
initcreates a starter.envand updates.gitignorelist,get,set, anddeletemanage keysencryptanddecrypthandle.env.agediffcompares env files without printing valuesviewopens an interactive TUI to view .env filescheckverifies.envagainst.env.examplemergeapplies.env.localor another file on top of.envexpandresolves${VAR}and$VARreferences inside valuescompletionsgenerates bash, zsh, or fish completion scripts
cargo buildFor a release binary:
cargo build --releaseIf you have the Rust toolchain installed, you can build and install directly with Cargo:
cargo install local-envx Use the included release script to compile the binary and copy it into your preferred directory (defaults to ~/.local/bin if not specified):
INSTALL_DIR="$HOME/.local/bin" bash scripts/install.shenvx init
envx list
envx view
envx get DATABASE_URL
envx set API_KEY secret-value
envx delete API_KEY
envx diff .env .env.example
envx check
envx encrypt --delete
envx decryptenvx has several intelligent behaviors designed for both seamless workflow and strict security:
- Auto-Decryption for Reads: If a plaintext
.envis missing but an encrypted.env.agefile exists, all read commands (view,list,get,check,expand,diff) will automatically detect it, prompt for your passphrase if needed, and decrypt it entirely in-memory. This means you can interact with your encrypted environments natively without ever risking writing a plaintext file to disk. - Write Guards: If
.envis missing but.env.ageexists, modifying commands (set,delete,merge) will block and instruct you to decrypt the file first. This prevents you from accidentally creating a desynced plaintext file while your encrypted file is ignored. - Masked by Default:
envx listmasks all secret values by default (KEY=***) to prevent shoulder-surfing. Useenvx list --revealto interactively unmask them.
Merge a local override file into .env:
envx merge .env.localExpand template references in a file:
envx expand .env --output .env.expandedTemplate expansion resolves references in the same document, so values like these work:
HOST=localhost
PORT=5432
DATABASE_URL=postgres://${HOST}:${PORT}/appGenerate a completion script for your shell:
envx completions bash
envx completions zsh
envx completions fishRedirect the output into the location used by your shell completion system.
The repository is set up for release builds through cargo build --release and the install script above.
For tagged releases, build the release binary and publish the generated artifact alongside the source tag.