baseboard
Blog

When your data isn’t in Stripe: the Custom API

2 min read

Built-in providers cover the common case: users in Clerk or Supabase, payments in Stripe, files in S3. But plenty of apps keep something important at home. Credits in your own database. An in-house billing system from before Stripe. Organisations that only exist in your schema.

You could build a separate admin page for that part. Then support has two places to look again, which is the problem Baseboard is meant to solve. The Custom API is the other option: you write one endpoint, and Baseboard reads it like any other provider.

One endpoint, any mix

A Custom API connection points at one HTTPS endpoint in your app. It can serve users, billing, data or file storage, in whatever combination you turn on. Users and billing records join the Customers page by email, exactly like Clerk and Stripe do, so a person's page shows your own records next to everything else.

Baseboard doesn't store what your endpoint returns. Each read is a request, so the panel always shows what your app says right now.

What a request looks like

Every call is a POST with the operation and its input:

json
{ "operation": "billing.listSubscriptions", "input": { "cursor": null } }

Requests are signed the Standard Webhooks way, so any Standard Webhooks library can check them. Lists page with a cursor. Money is in minor units. Return an error message and the member sees it.

Only offer what you support

When you connect, Baseboard calls ping, and your endpoint lists the operations it handles. The dashboard follows that list. Ban buttons appear only for users you mark as bannable. Refunds appear only on invoices you mark refundable. The SQL editor shows up only if you list data.query. If you don't build a write, nobody sees a button for it.

Changes still go through Baseboard's permissions and audit log, so a refund through your own endpoint needs the same Allowed level as a refund in Stripe.

The SDK

The quickest way in is the SDK. It checks signatures, answers ping and runs your handlers, with every input and response typed:

ts
import { createBaseboardHandler } from 'baseboard-sdk'

export const POST = createBaseboardHandler({
  secret: process.env.BASEBOARD_SECRET,
  auth: { listUsers, listOrganizations },
  billing: { listCustomers, listSubscriptions, listInvoices },
})

It takes a web Request and returns a Response, so it works in Next.js, Hono, Workers, Bun and Deno. Not on TypeScript? The Custom API guide has every type in Python, Go and JSON Schema too.

More from the blog

See every customer in one place.

Connect a sign-in provider and a billing provider on the free plan. It reads every page and changes nothing.