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
| Feature | Call |
|---|---|
| Blog | bf.posts.list(), bf.posts.getBySlug(slug) |
| Categories, post types, menus | bf.categories.list(), bf.navigations.get('main') |
| Site details | bf.workspace.get() |
| Contact form | bf.submissions.create({ name, email, message }) |
| Analytics | bf.analytics.install() |
| Live chat | bf.liveChat.install({ config }) (see Live chat) |
| Bookings | bf.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.