Getting Started

These steps install and connect @businessdash/sdk 0.9.50. After setup, choose between consuming platform data, rendering a Live BusinessDash form, or declaring a unified database/validation/form tree in your repository.


Before you start: connect your site

The fastest way to get every value you need is the guided wizard in your dashboard — it creates each credential and hands you a copy-paste .env block.

In your BusinessDash dashboard, open Settings → Web Content SDK (open it). Pick your site, create a secret key + publishable token + revalidation webhook, and copy the assembled .env. Secrets are shown once, so copy as you go.

Each variable maps to a spot in the dashboard:

.env variableWhat it isWhere in the dashboard
NEXT_PUBLIC_BD_SITE_IDThe site UUID this app rendersSite Builder ▸ Developer ▸ Site ID
BD_API_KEYSecret key (sk_…) — server-onlySite Builder ▸ Developer ▸ Secret keys
NEXT_PUBLIC_BD_PKPublishable token (pk_…) — browser-safeSite Builder ▸ Developer ▸ Publishable tokens
BD_REVALIDATION_SECRETWebhook HMAC (whsec_…) — server-onlyThe wizard, or Settings ▸ Integrations
NEXT_PUBLIC_BD_PACKAGE_API_BASE_URLWhere BusinessDash is hostedDefaults to production

Your .env ends up looking like:

# Non-secret + browser-safe (the browser needs these)
NEXT_PUBLIC_BD_PACKAGE_API_BASE_URL=https://businessdash.us/api/package/v1
NEXT_PUBLIC_BD_SITE_ID=your-site-uuid
NEXT_PUBLIC_BD_PK=pk_...

# Server-only secrets — never prefix these with NEXT_PUBLIC_
BD_API_KEY=sk_...
BD_REVALIDATION_SECRET=whsec_...

SITE_ID and the base URL aren't secret, so each uses a single NEXT_PUBLIC_ variable (the browser needs them); the API key and revalidation secret stay server-only. No site yet? Create one in the Site Builder first — the wizard links you there.

Use the apex https://businessdash.us host. The www host redirects across origins, which can drop an authorization header and can break browser CORS preflights.

Starter templates ship with .env.example — copy it to .env and paste the wizard's block. The SDK content needs no database, so DATABASE_URL is optional. As a last step, verify your domain in Settings → Organization so this org owns the domain your publishable token is locked to.

The SDK starters use slug="general-inquiry" for the contact form — a platform-default form that's available to every org without any dashboard setup. See Forms → Zero-setup contact form for how the fallback works.


Option 1: Clone a starter

The fastest path. Each framework has a starter template with the SDK already wired up — just clone, install, and go.

Select your framework with the picker in the navbar above. Every code example across the docs will update to match your choice.

There are starters beyond JavaScript — Laravel, Phoenix, Vapor, Swift, Flutter, Kotlin, and React Native. They talk to the same REST surface with a hand-written client, and each platform changes what a starter can assume about keys and storage. See Starter Templates.

git clone --depth 1 https://github.com/businessdash/SDK-Starter-Templates.git my-app
cd my-app/React-Bun
cp .env.example .env
pnpm install

Then copy the .env.example to .env, fill in the values from the section above, and run the dev server — you're live.


Option 2: Install manually

Add the SDK to an existing project.

Make sure you've completed the API key setup above first.

1. Install the package

npm install @businessdash/sdk

During the alpha, pin the documentation baseline explicitly (the command tracks the version selected in the navbar):

npm install @businessdash/sdk@0.9.90
pnpm add @businessdash/sdk@0.9.90
yarn add @businessdash/sdk@0.9.90
bun add @businessdash/sdk@0.9.90
npx jsr add @businessdash/sdk@0.9.90

2. Create a client

// src/client.ts — browser-side proxy calls
const BIO_ENDPOINT = "/api/bd";

function api(path: string, body?: unknown) {
  return fetch(`${BIO_ENDPOINT}${path}`, {
    method: body ? "POST" : "GET",
    headers: body ? { "Content-Type": "application/json" } : undefined,
    body: body ? JSON.stringify(body) : undefined,
  }).then((r) => r.json());
}

export const bd = {
  forms: {
    schema: (slug: string) => api(`/forms/${slug}/schema`),
    submit: (slug: string, data: unknown) =>
      api(`/forms/${slug}/submit`, data),
  },
};

3. Make your first call

const schema = await bd.forms.schema('contact')

From here you can fetch data, render forms, embed a chatbot, and more — see the Feature Integration guides for each surface.

Choose your next path