brandfinedocs
Concepts

Static sites

Use Brandfine from a site with no server runtime (Vite SPA, Astro static export, Hugo, plain HTML), straight from the browser with the site key.

The site key (brandfine_pk_…) is safe in a web page, so a site with no server at all uses the SDK straight from the browser. It reads published content and does what visitors do; it can't write anything or read anything private.

import { createBrandfineClient } from '@brandfine/client'

// Fine in client code: the site key is public by design.
const bf = createBrandfineClient({
  apiKey: import.meta.env.VITE_BRANDFINE_API_KEY,
})

What works from the browser

FeatureCall
Blogbf.posts.list(), bf.posts.getBySlug(slug)
Categories, post types, menusbf.categories.list(), bf.navigations.get('main')
Site detailsbf.workspace.get()
Contact formbf.submissions.create({ name, email, message })
Analyticsbf.analytics.install()
Live chatbf.liveChat.install({ config }) (see Live chat)
Bookingsbf.appointments.getAvailability(), bf.appointments.createRequest(…)

Content reads are metered per visitor IP (3000 a minute), which no real visitor gets near.

What needs a server

Only one thing: verified visitors. Showing a logged-in person their own chats and bookings needs a token signed with the identity secret, and that secret must never be in a page. A static site has no logged-in users of its own, so this rarely matters. If yours does, sign the token in a serverless function and pass it to the page.

Keeping a static build fresh

A site that bakes content in at build time needs a rebuild when you publish. Point the workspace's Publish notifier (workspace page → Access) at your host's deploy hook (Netlify, Vercel, Cloudflare Pages all have one); Brandfine calls it on every publish. A site that reads content in the browser at runtime needs nothing: it always shows the latest published version.

On this page