- centralized Barekey plus CLI login
- standalone local
.envfiles through the server SDK
Workflow 1: centralized Barekey with local login
This is the most ergonomic team workflow.Step 1: log in once
Step 2: commit barekey.json
Step 3: use either the CLI or SDK
CLI:- scope from
barekey.json - auth from your stored CLI login unless
BAREKEY_ACCESS_TOKENis set
Workflow 2: standalone local .env mode
Use this when you want the Barekey SDK API but do not want network-backed reads for local work.
Set:
.env* files instead of calling the API.
barekey.json reference
| Key | Type | Required in centralized mode | Required in standalone mode | Notes |
|---|---|---|---|---|
organization | string | Yes | No | canonical org key |
project | string | Yes | No | project slug |
environment | string | Yes | No | stage name |
org | string | No | No | alias for organization |
stage | string | No | No | alias for environment |
config.mode | "centralized" or "standalone" | No | No | defaults to "centralized" |
config.typegen | "semantic" or "minimal" | No | No | standalone resolves to minimal |
Search behavior
Barekey searches upward from the current working directory until it finds abarekey.json.
That matters in monorepos because:
- one repo-root config can serve many packages
- standalone mode uses the discovered config directory as the local env root
Pulling to .env.local
If your framework expects dotenv files, use:
.gitignore:
How standalone .env loading behaves
The SDK reads local env files from the standalone root directory.
The tests cover patterns such as:
.env.env.local.env.<environment>.local
DATABASE_URLFEATURE_ENABLEDDEVELOPMENT_LOCAL_LAUNCH_AT
Choosing between pull and standalone mode
| Approach | Best for |
|---|---|
barekey env pull --out .env.local | frameworks that already load dotenv files |
BarekeyClient with config.mode: "standalone" | code that wants one SDK API locally and remotely |
| centralized SDK with CLI-session auth | teams that want the real Barekey flow during local development |
Production recommendation
For production, prefer centralized SDK reads withBAREKEY_ACCESS_TOKEN.
Use local pull files or standalone mode for local development only.
