--- title: Overview description: How the CMS is configured in kreogen. product: CMS type: reference summary: How the CMS is configured in kreogen. related: - /en/docs/packages/cms/components - /en/docs/packages/cms/metadata --- # Overview kreogen has a dedicated CMS package that can be used to generate type-safe data collections from your content. This approach provides a structured way to manage your content while maintaining full type safety throughout your application. By default, kreogen uses [BaseHub](https://basehub.com) as the CMS. BaseHub is an optional integration, and the whole package surface degrades without it: with no `BASEHUB_TOKEN` the queries return empty arrays or `null`, and the components render nothing. That is worth stating as one property rather than two, because it used to be true of only half of it — the queries degraded and `Feed` threw, which is exactly how `/legal/*` shipped a 500 in a project generated with `cms` and no token. ## Setup Here's how to quickly get started with your new CMS. ### 1. Create a repository with the expected schema There is no kreogen-branded BaseHub template to fork. The queries in `packages/cms/index.ts` expect two collections, and any repository providing them will work: | Collection | Used for | | ---------------- | ------------------------------------ | | `PostsItem` | The blog | | `LegalPagesItem` | Terms, privacy and other legal pages | The exact fields each query selects are the `fragmentOn` calls at the top of that file — `_slug`, `_title`, `date`, `image`, `authors`, `categories` and the body. Generated types live in `packages/cms/basehub-types.d.ts` and are committed, so a schema mismatch shows up as a typecheck failure rather than as an empty page at runtime. Once the repository exists, get your Read Token from the "Connect to your App" page: ``` https://basehub.com///dev/main/dev:connect ``` The token will look something like this: ``` bshb_pk_ ``` Keep this connection string handy, you will need it in the next step. ### 2. Update your environment variables Update your [environment variables](/en/docs/setup/env) to use the new BaseHub token. For example: ```ts apps/web/.env BASEHUB_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. You might need to run `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: ```txt - Blog - Posts - Authors - Categories - Legal Pages ``` So in order to get all posts, you'd write a query like this: ```ts { blog: { posts: { items: { _title: true, _slug: true, authors: { _title: true }, // references the authors collection // ... }, }, }, } ``` Starter queries are provided for you in the `cms` package, within the `blog` and `legal` objects. You can read more about the BaseHub SDK in [their docs](https://docs.basehub.com/nextjs-integration/). ## Revalidation A key part of any good CMS integration is the ability to revalidate content when it changes. To do that, BaseHub comes with automatic [on-demand revalidation](https://docs.basehub.com/nextjs-integration/environments-and-caching#on-demand-revalidation-recommended). --- For a semantic overview of all documentation, see [/sitemap.md](/sitemap.md) For an index of all available documentation, see [/llms.txt](/llms.txt)