Skip to main content
Barekey supports two good local-development workflows:
  1. centralized Barekey plus CLI login
  2. standalone local .env files 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:
SDK:
In this setup the SDK resolves:
  • scope from barekey.json
  • auth from your stored CLI login unless BAREKEY_ACCESS_TOKEN is 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:
Then use:
In standalone mode the SDK reads local .env* files instead of calling the API.

barekey.json reference

Search behavior

Barekey searches upward from the current working directory until it finds a barekey.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:
Or JSON:
Add pulled files to .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
Values are normalized into uppercase Barekey keys. Example:
These can resolve like:
  • DATABASE_URL
  • FEATURE_ENABLED
  • DEVELOPMENT_LOCAL_LAUNCH_AT

Choosing between pull and standalone mode

Production recommendation

For production, prefer centralized SDK reads with BAREKEY_ACCESS_TOKEN. Use local pull files or standalone mode for local development only.