Brandfine Docs
SDK

Installation

Two packages — the core SDK and an optional Astro adapter.

npm install @brandfine/client
# Optional, only on Astro projects:
npm install @brandfine/client-astro

Both packages ship to public npm with provenance attestations — installs are verified against this repo's CI runs.

What's in each

@brandfine/client

Framework-agnostic. Works in any environment with fetch (Node 18+, browser, Bun, Cloudflare Workers, Deno).

ModuleWhat it exports
@brandfine/clientcreateBrandfineClient, BrandfineApiError, all types
@brandfine/client/cachecreateCache, createKeyedCache
@brandfine/client/resolverspickLocale, localizePath, stripLocalePrefix, isLocale, resolveNavigation
@brandfine/client/webhookcreateBrandfineWebhookHandler, verifyWebhookSecret, parseWebhookPayload

@brandfine/client-astro

Astro adapter. Re-shapes the SDK's Request → Response webhook handler into Astro's APIRoute shape, plus a readBrandfineEnv() helper for the import.meta.env / process.env dual-source quirk.

Versioning

Pre-1.0 (0.x.y) is the unstable phase — minor bumps can contain breaking changes (per npm's pre-1.0 semver convention). Pin precisely with ~0.1.0 if you want patches only; use ^0.1.0 to accept all 0.1.x patches automatically.

After 1.0, normal semver applies — breaking changes in major, additive in minor, fixes in patch.

On this page