Ferret out missing .env keys before they bite you in production.
potto is a small, meticulous CLI tool — named after the nocturnal primate that never misses a thing — that keeps your .env and .env.example files in sync. Catch missing keys locally, in CI, or as a pre-commit hook.
You add a new secret to .env. You forget to add it to .env.example. A teammate pulls your branch, runs the app, and gets a cryptic crash at runtime. Or worse, it breaks in CI three minutes before a deploy.
Sound familiar?
potto compares your .env against .env.example in one command, shows you exactly which keys are missing with color-coded output, and can auto-fix .env.example for you.
$ potto
-> Checking .env against .env.example
FAIL 2 key(s) in .env are MISSING from .env.example (teammates can't run the app)
- STRIPE_SECRET_KEY
- REDIS_URL
WARN 1 key(s) in .env.example are MISSING from .env (you may need to set these)
- FEATURE_FLAG_NEW_UI
Run `potto sync` to fix .env.example automatically.
cargo install pottoThen run it in any project:
pottocargo install pottogit clone https://github.com/iamkorun/potto
cd potto
cargo install --path .Pre-built binaries for Linux, macOS, and Windows are available on the Releases page.
# Linux (x86_64)
curl -L https://github.com/iamkorun/potto/releases/latest/download/potto-linux-x86_64.tar.gz | tar xz
sudo mv potto /usr/local/bin/
# macOS (Apple Silicon)
curl -L https://github.com/iamkorun/potto/releases/latest/download/potto-darwin-aarch64.tar.gz | tar xz
sudo mv potto /usr/local/bin/Compare .env against .env.example. Files are auto-discovered in the current directory.
potto
# or
potto checkWith explicit paths:
potto check --env apps/api/.env --example apps/api/.env.exampleOutput — in sync:
-> Checking .env against .env.example
OK All 12 key(s) are in sync.
Output — out of sync:
-> Checking .env against .env.example
FAIL 2 key(s) in .env are MISSING from .env.example (teammates can't run the app)
- STRIPE_SECRET_KEY
- REDIS_URL
WARN 1 key(s) in .env.example are MISSING from .env (you may need to set these)
- FEATURE_FLAG_NEW_UI
Run `potto sync` to fix .env.example automatically.
Append missing keys from .env to .env.example — values are stripped, only key names are written.
potto sync-> Adding 2 key(s) to .env.example
+ STRIPE_SECRET_KEY=
+ REDIS_URL=
OK 2 key(s) added to .env.example
If .env.example doesn't exist yet, potto creates it from scratch.
Compare any two env files directly — useful for multi-environment setups.
potto compare .env.staging .env.productionComparing .env.staging vs .env.production
+ 1 key(s) only in .env.staging:
+ STAGING_DEBUG_MODE
+ 2 key(s) only in .env.production:
+ CDN_URL
+ SENTRY_DSN
| Code | Meaning |
|---|---|
0 |
Files are in sync |
1 |
Files are out of sync |
2 |
File read/write error |
Exit code 1 on out-of-sync makes potto perfect for CI gates and pre-commit hooks.
- Zero config — auto-discovers
.envand.env.examplein the current directory - Color-coded output — FAIL (red), WARN (yellow), OK (green) at a glance
- Auto-sync —
potto syncappends missing keys with blank values, never touches existing entries - Arbitrary file comparison —
potto compareworks on any two env files - CI-friendly exit codes — gates pipelines without extra scripting
- Quiet mode —
--quiet/-qsuppresses output, relying only on exit codes - Safe — never reads or exposes secret values, only key names
- Fast — single Rust binary, no runtime, no dependencies to install
- Explicit paths —
--envand--exampleflags override auto-discovery
| Flag | Short | Description |
|---|---|---|
--quiet |
-q |
Suppress all output, exit code only (great for CI) |
--verbose |
-v |
Show file discovery paths and extra detail |
--env <path> |
Path to .env file (overrides auto-discovery) | |
--example <path> |
Path to .env.example file (overrides auto-discovery) | |
--help |
-h |
Show help |
--version |
-V |
Show version |
Add potto to .git/hooks/pre-commit to block commits when .env.example is out of sync:
#!/bin/sh
potto check --quiet
if [ $? -ne 0 ]; then
echo ""
echo "Commit blocked: .env is out of sync with .env.example"
echo "Run 'potto sync' to fix, then re-commit."
exit 1
fiMake it executable:
chmod +x .git/hooks/pre-commitOr use with pre-commit by adding to .pre-commit-config.yaml:
repos:
- repo: local
hooks:
- id: potto
name: potto — check .env sync
entry: potto
language: system
pass_filenames: falseBlock merges when .env.example falls behind:
name: CI
on: [push, pull_request]
jobs:
env-sync:
name: Check .env sync
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install potto
run: cargo install potto
- name: Check .env.example is up to date
run: |
cp .env.example .env # use example as the reference env in CI
potto checkFor monorepos, run potto per package:
- name: Check env sync (api)
run: potto check --env apps/api/.env --example apps/api/.env.exampleContributions are welcome.
- Fork the repo
- Create a feature branch:
git checkout -b feat/my-feature - Make your changes and add tests
- Run
cargo test— all tests must pass - Submit a pull request
Please follow Conventional Commits for commit messages.
MIT — see LICENSE.
