Getting Started
Get up and running with Hush in just a few minutes.
Prerequisites
Hush requires Node.js 18+ and delegates encryption to standard tools.
- SOPS - The standard for secret operations
- age - Modern, simple key management
- direnv - Automatic environment loading (for per-project keys)
brew install sops age direnv
# Add direnv hook to your shell (add to ~/.zshrc or ~/.bashrc)echo 'eval "$(direnv hook zsh)"' >> ~/.zshrc # for zsh# or: echo 'eval "$(direnv hook bash)"' >> ~/.bashrc # for bash
# Reload your shellsource ~/.zshrc# SOPScurl -LO https://github.com/getsops/sops/releases/download/v3.8.1/sops-v3.8.1.linux.amd64sudo mv sops-v3.8.1.linux.amd64 /usr/local/bin/sopssudo chmod +x /usr/local/bin/sops
# agecurl -LO https://github.com/FiloSottile/age/releases/download/v1.1.1/age-v1.1.1-linux-amd64.tar.gztar xzf age-v1.1.1-linux-amd64.tar.gzsudo mv age/age /usr/local/bin/
# direnvcurl -sfL https://direnv.net/install.sh | bashecho 'eval "$(direnv hook bash)"' >> ~/.bashrcsource ~/.bashrc# Using scoopscoop install sops age direnv
# Or using chocolateychoco install sops age direnvNote: Hush fully supports Windows (PowerShell/CMD). For direnv on Windows, see direnv.net for setup instructions.
Installation
pnpm add -D @chriscode/hushnpm install -D @chriscode/hushyarn add -D @chriscode/hushSetup
-
Generate an age key
Create a key pair for encrypting your secrets:
Terminal window mkdir -p ~/.config/sops/ageage-keygen -o ~/.config/sops/age/key.txtThis creates a private key at
~/.config/sops/age/key.txt. The public key is printed to the console. -
Create
.sops.yamlIn your repository root, create a SOPS configuration file:
.sops.yaml creation_rules:- encrypted_regex: '.*'age: age1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxReplace the
age:value with your public key from step 1. -
Initialize Hush
Run the init command to create
hush.yaml:Terminal window npx hush initThis auto-detects packages in your monorepo and creates a configuration file.
-
Create your source files
Terminal window # .hush (shared across environments)DATABASE_URL=postgres://localhost/mydbSTRIPE_SECRET_KEY=sk_test_xxxEXPO_PUBLIC_API_URL=${API_BASE}/v1# .hush.developmentAPI_BASE=http://localhost:8787# .hush.productionAPI_BASE=https://api.example.com -
Encrypt
Terminal window npx hush encryptThis creates encrypted versions of your source files (
.hush.encrypted, etc.) that are safe to commit. -
Set up direnv for key loading
Create a
.envrcfile in your project root:.envrc export SOPS_AGE_KEY_FILE="$HOME/.config/sops/age/keys/YOUR_PROJECT.txt"Replace
YOUR_PROJECTwith your project identifier (visible innpx hush statusunder “Local key”).Then allow direnv to load it:
Terminal window direnv allow -
Run with secrets
Terminal window npx hush run -- npm startThis decrypts secrets to memory and runs your command with them as environment variables. Secrets never touch the disk!
Verify Your Setup
Check that everything is configured correctly:
npx hush statusThis shows your configuration, encrypted files, and target distribution.
Troubleshooting
”no identity matched any of the recipients”
This is the most common error. It means SOPS can’t find your decryption key.
Most likely cause: direnv isn’t loaded.
# 1. Check that direnv is alloweddirenv allow
# 2. Verify the environment variable is setecho $SOPS_AGE_KEY_FILE # Should show the path to your key file
# 3. Test decryptionnpx hush statusnpx hush inspectIf SOPS_AGE_KEY_FILE is empty, make sure you’ve:
- Installed direnv and added the hook to your shell
- Reloaded your shell (
source ~/.zshrcor open a new terminal) - Run
direnv allowin the project directory
”age key not found”
The key file doesn’t exist. Either:
- Run
npx hush keys setupto pull from 1Password - Get the key from a team member and save it to the path shown in
npx hush status
Next Steps
- Learn about Configuration to customize your setup
- Understand Monorepo Patterns for routing secrets
- Explore AI-Native Workflow for working with AI assistants
- See the full Command Reference