Quickstart
From an empty vault to your app reading its secrets, with a test at the end.
Create an application vault
In the web vault, click New vault and choose For applications. Give it a name that says who uses the vault, like “Payments API”.
An application vault stores name and value pairs, like DATABASE_URL and STRIPE_SECRET_KEY. The names are encrypted too: the server doesn’t even know which variables you have.
Store the secrets
Use New secret for each variable, or Import .env to bring in a whole file at once. The .env is read in the browser, and nothing in it leaves in plaintext.
Create an application credential
In the vault’s application access section, click Create access (only the vault’s owner sees this button), give it the name of the machine or environment (“Shop — production”, “CI”), and copy the application credential that appears.
The application credential is shown only once. If you lose it, create another access and revoke the old one. With one access per machine or environment, you can revoke one without taking down the others.
Configure the server
Set the two variables in your app’s environment: in your provider’s dashboard, in a systemd EnvironmentFile, or in a Kubernetes Secret.
COFFREBOX_URL=https://coffrebox.net
COFFREBOX_TOKEN=cfb1_app_…Don’t put the token in the repository or in the Docker image. It’s all your app needs to open the vault. The Recipes section shows how to do this in Docker, GitHub Actions, and systemd.
Load the vault
Pick a path:
- Node.js:
await Coffrebox.load()at the start of your program, with the@brunosps00/coffreboxSDK. The npm package isn’t out yet: the Node.js SDK page shows how to install it for now. - Rust:
cargo add coffreboxandcoffrebox::blocking::load()?at the start ofmain. See the Rust SDK. - Any language: install the coffre CLI and run your app with
coffre run -- <command>. See Other languages.
Check it
With the CLI, this command prints ok if the variable reached the program, without showing the value:
coffre run -- sh -c 'test -n "$DATABASE_URL" && echo ok'If something goes wrong, the message says why: a wrong or revoked token, the server is down and there’s no cache, or the response was tampered with. No error message includes values or the token.