- Install and log into the CLI.
- Run
barekey init. - Create a variable.
- Read it with
@barekey/sdk/server.
Prerequisites
- Node.js 18+ or Bun
- a Barekey account
1. Install the CLI
- npm
- pnpm
- yarn
- bun
2. Run barekey init
In your project root, run:
barekey.json for you.
The generated file looks like this:
org and stage, but the canonical keys are:
organizationprojectenvironment
3. Create a variable
Create a variable with an initial value:env set:
4. Install the SDK
- npm
- pnpm
- yarn
- bun
5. Read the variable in code
Create a shared client:barekey.json is present, the client can resolve:
organizationprojectenvironment
await barekey.get("DATABASE_URL") returns the parsed value for the variable’s declared type.
If you want metadata too, use inspect():
6. Generate SDK types
Run:@barekey/sdk package so known keys become typed in your editor.
In development, you can keep it fresh:
7. Optional: pull to .env.local
If your local workflow still expects a dotenv file:
What next
SDK guide
Full server SDK, public SDK, standalone mode, typegen, and config reference.
CLI guide
Full command reference with flags, examples, and output formats.
Local development
barekey.json, .env pull workflows, and standalone local reads.Variable kinds
Understand
secret and ab_roll.
