Overview
How the CMS package is configured.
@repo/cms generates type-safe data collections from BaseHub content. It backs the marketing blog and legal pages in the web app. It is not the store for Documents — those live in the OPB Brain domain model, which is not built yet.
BaseHub is an optional integration. If BASEHUB_TOKEN is not set, CMS queries return empty arrays or null instead of throwing.
Setup
1. Create a BaseHub repository
The repository needs a schema matching the collections @repo/cms queries — Blog (Posts, Authors, Categories) and Legal Pages. See the query shapes in packages/cms/index.ts.
Once the repository exists, get its Read Token from the "Connect to your App" page:
https://basehub.com/<team-slug>/<repo-slug>/dev/main/dev:connectThe token will look something like this:
bshb_pk_<password>Keep this connection string handy, you will need it in the next step.
2. Update your environment variables
Add the token to your environment variables:
BASEHUB_TOKEN="<token>"3. Start the dev server
When you run bun dev, the CMS package will generate the type-safe BaseHub SDK, and watch changes to your CMS's schema.
Restart TS Server in your IDE for TypeScript to pick up the new types.Querying Basics
The structure of the CMS should look something like this:
- Blog
- Posts
- Authors
- Categories
- Legal PagesSo in order to get all posts, you'd write a query like this:
{
blog: {
posts: {
items: {
_title: true,
_slug: true,
authors: { _title: true }, // references the authors collection
// ...
},
},
},
}The blog and legal objects exported from @repo/cms hold the queries this repo uses. The BaseHub SDK is documented in their docs.
Revalidation
BaseHub performs on-demand revalidation when content changes.