Skip to main content

Shared server client

Create one shared server client module:
This works especially well when:
  • barekey.json is committed
  • developers use barekey auth login
  • production sets BAREKEY_ACCESS_TOKEN

Production auth pattern

Use a real deployment secret:
Then:
This avoids depending on a local CLI session in production.

Local developer pattern

Commit barekey.json and have every developer run:
That gives you:
  • CLI commands without repeating flags
  • SDK reads without manually wiring tokens
  • generated types in the local editor

Pull-file pattern

If a tool only understands dotenv files:
Re-run it whenever upstream values change.

Batch-read pattern

Read a group of startup values together:

Experiment pattern

Use deterministic ab_roll reads:

Public-variable pattern

Use the public client for browser-safe reads: