Skip to main content

Install

Try it without a vault

The local provider reads a gitignored JSON file, so you can see the mechanism work before wiring up AWS or Bitwarden.
1

Create a mock vault

.secrefs.local.json
Add .secrefs.local.json to your .gitignore. It holds real values — it is the one file in this workflow that does.
2

Write a reference instead of a value

.env
This file is safe to commit.
3

Run your app through SecRefs

Your app reads process.env.DB_PASSWORD exactly as before. Nothing downstream changes.

Point it at a real vault

Swap the provider segment. Nothing else about your app changes:
.env
SecRefs uses the credentials you already have — the AWS credential chain, a Bitwarden machine account token, VAULT_TOKEN. It never asks you to put a credential in its own config. See AWS, Bitwarden, and Vault.

Use it as a library

Check before you deploy

check validates every reference it can see and never returns a plaintext value, so it is safe to run in CI:
It catches a typo’d path before it pages someone at 3am.

Load time vs use time

init() and expandString() behave differently when a secret rotates. The difference matters — read this before choosing.