| Crates.io | dotenvk |
| lib.rs | dotenvk |
| version | 0.1.0 |
| created_at | 2025-09-15 13:20:08.50471+00 |
| updated_at | 2025-09-15 13:20:08.50471+00 |
| description | A pragmatic CLI tool for managing .env files with a focus on simplicity, security, and reliability |
| homepage | https://github.com/durableprogramming/dotenvk |
| repository | https://github.com/durableprogramming/dotenvk |
| max_upload_size | |
| id | 1839940 |
| size | 5,175,946 |
A pragmatic CLI tool for managing .env files with a focus on simplicity, security, and reliability.
dotenvk provides a straightforward command-line interface for editing environment files. Built with Rust for performance and safety, it handles common tasks like setting variables, generating secure passwords, and exporting configurations.
cargo install dotenvk
Or build from source:
git clone https://github.com/durableprogramming/dotenvk.git
cd dotenvk
cargo build --release
Set environment variables:
dotenvk set DATABASE_URL=postgres://localhost/mydb API_KEY=secret123
Remove variables:
dotenvk unset OLD_KEY DEPRECATED_VAR
List all keys:
dotenvk keys
Generate secure random passwords:
# Basic 32-character password (letters only)
dotenvk randomize API_SECRET
# Include numbers and symbols
dotenvk randomize DB_PASSWORD --numeric --symbol --length 48
# Generate XKCD-style passphrase (requires xkcdpass)
dotenvk randomize ADMIN_PASSPHRASE --xkcd
Export as bash script:
dotenvk export
# or
dotenvk export --format bash
Export as JSON:
dotenvk export --format json
By default, dotenvk operates on .env in the current directory. Use -f or --file to specify a different file:
dotenvk -f .env.production set NODE_ENV=production
dotenvk -f config/.env.local keys
This tool embodies a practical approach to software development:
# Set up a new project
dotenvk set NODE_ENV=development PORT=3000
dotenvk randomize JWT_SECRET SESSION_SECRET --length 64 --symbol
# Export for local development
eval $(dotenvk export)
# Generate secure production credentials
dotenvk -f .env.production randomize \
DATABASE_PASSWORD \
REDIS_PASSWORD \
API_SECRET \
--length 48 --numeric --symbol
# Export as JSON for container orchestration
dotenvk -f .env.production export --format json > secrets.json
# Rotate all password fields
dotenvk randomize $(dotenvk keys | grep -E '(PASSWORD|SECRET|KEY)')
Contributions are welcome. This project values:
Please ensure all tests pass and add new tests for any new functionality.
MIT License - see LICENSE file for details.
Built with excellent Rust crates:
clap for CLI parsinganyhow for error handlingserde for JSON serializationrand for secure random generation