First project
The fastest way to adopt pw-env is to keep the shape of your .env file, then let the CLI fill in secrets at runtime.
1. Create the project env file
Use empty values for variables that should be loaded from the default backend:
DATABASE_URL=
API_KEY=Mix in explicit references when a key should always come from a specific backend:
DATABASE_URL=op://Development/my-app/database_url
API_KEY=bw://env-secrets/my-app/api_key
LOG_LEVEL=debugPlaintext values are left alone until you migrate them. Add # pw-env:ignore when a local value should never be treated as a migration candidate.
2. Create the global config
Start from the built-in template:
$ pw-env config-template > ~/.config/pw-env/config.tomlPick a default backend for empty values.
[defaults]
backend = "op"
[defaults.op]
vault = "Development"[defaults]
backend = "bw"
[defaults.bw]
folder = "env-secrets"[defaults]
backend = "gpg"
[defaults.gpg]
file_pattern = ".env.gpg"
recipient = "your-email@example.com"3. Export the values into your shell
eval "$(pw-env export . --shell bash)"pw-env export . --shell fish | sourceInvoke-Expression (& pw-env export . --shell powershell)The first time a project .env would trigger secret fetching, pw-env asks you to approve it. The default approval is tied to the current .env hash, so changing the file causes a new approval prompt.
4. Inspect what pw-env sees
pw-env load .
pw-env checkpw-env load shows how each entry was classified before printing masked export output with only a short value prefix, which makes it a good first debugging command. Add --reveal only when you intentionally need to inspect the full resolved values.
5. Install automatic loading when you are ready
eval "$(pw-env init bash)"eval "$(pw-env init zsh)"pw-env init fish | sourceInvoke-Expression (& pw-env init powershell)Add the same command to your shell startup file so the hook is installed in every new session. For PowerShell, add it to your $PROFILE file.
To enable tab completion for pw-env commands, generate the completion script once and source it from the same startup file:
eval "$(pw-env completions bash)"eval "$(pw-env completions zsh)"pw-env completions fish | sourceInvoke-Expression (& pw-env completions powershell)See Shell integration for the full hook behavior.
See the full flow
This screencast walks through the same setup end to end with a GPG-backed project: create the global config, migrate plaintext secrets, install the shell hook, and watch values load and clear automatically as you move between project directories.

Next steps
Move to Shell integration when you want automatic loading on cd, or to Migrating plaintext secrets if your current .env file still contains credentials.
