A compact CLI for managing multiple .env environments per project.
The name comes from "env" + the Polish diminutive suffix "-ik" — something small and self-contained.
- [done]
envik init— scans the project root for.envfiles, moves them into.envik/, createsdefault.envif none found - [done]
envik list— lists available environments in.envik/ - [done]
envik use <name>— copies.envik/<name>.envto the active.env - [done]
envik current— shows which environment is currently active - [wip] Global config and database paths — config (
config.json) and the tracking database (envik.db) are currently written to CWD; the intent is to store them in OS-appropriate paths via thedirectoriescrate so state is truly global across projects - [planned] Backup with timestamps
- [planned] Env file encryption
- [planned] Sharing environments across team members
- [planned] CI/CD integration for fetching environments remotely
Managing multiple .env files (dev, staging, prod) usually means manually
renaming files or maintaining ad-hoc scripts. envik handles this with a
single use command that copies the right environment into place, while
tracking which one is active per project.
I built this to learn Rust and solve a problem I kept running into in my own projects. It is not trying to replace direnv or dotenv-vault — it is a focused, local-first tool that does one thing.
- Rust 2024 — single self-contained binary, no runtime dependency
- clap (derive) — CLI argument parsing
- redb — embedded key-value store; no SQL, tracks active environment per project path
- serde + serde_json — config serialization to human-readable JSON
- anyhow — error handling
- colored — terminal color output
Not published to crates.io yet. Build from source:
git clone <repo>
cd envik-cli
cargo build --release
Basic usage in a project:
# initialize envik — discovers and organizes .env files
envik init
# list available environments
envik list
# switch to an environment
envik use dev
# check which environment is currently active
envik current
your-project/
.envik/
dev.env # stored environment
prod.env
config.json # optional, project-local config overrides
.env # active file, written by 'envik use'
envik use copies the content of .envik/<name>.env to .env and records
the active environment in a redb database keyed by project path.
Config is two-layered: global defaults merged with optional per-project
overrides from .envik/config.json. Local values take precedence.
- redb over SQLite — no external dependency; the use case is a single key-value lookup (project path → active env name), not relational data
- File copy, not symlink —
usewrites content directly to.envso the result is transparent to tools that read.envwithout following symlinks