Configuration
Author your CMS schema in content.config.ts, or any module your app loads before createCmsRuntime. Every builder on this page is stable and comes from the timbl package.
defineCMS
Top-level config: collections, globals, plugins, and optional adapter overrides.
import { defineCMS, defineCollection, defineGlobal } from "timbl";import { createSeoPlugin } from "@timbl/plugin-seo";
export default defineCMS({ collections: [/* ... */], globals: [/* ... */], plugins: [createSeoPlugin({ collections: ["posts"] })], // adapters: { database, storage, auth, ... } — optional overrides});defineCollection
Each collection has a unique key, human labels, and a fields array. There is no separate timestamps or slugField option: add date / slug fields explicitly if you need them.
defineCollection({ key: "posts", labels: { singular: "Post", plural: "Posts" }, fields: [ { key: "title", type: "text", required: true }, { key: "slug", type: "slug", required: true }, { key: "body", type: "markdown" }, { key: "publishedAt", type: "date" }, ],});Built-in field types
Supported type values: text, slug, textarea, markdown, number, boolean, date, select, relation, upload, group, array. Plugins may register additional types via definePlugin({ fields: [...] }).
- Select:
options: ["draft", "published", ...] - Relation:
to: "otherCollectionKey", optionalmany: true - Group: nested
fields: [...] - Array:
of: { type: "text", ... }(one inner field schema)
Hooks (collection / global)
Optional hooks on a collection or global use the same hook map as plugins (beforeValidate, afterChange, etc.). Handlers receive operation context from the registry.
defineGlobal
Singleton documents (site settings, navigation trees, etc.).
defineGlobal({ key: "siteSettings", label: "Site Settings", fields: [ { key: "siteName", type: "text", required: true }, { key: "tagline", type: "textarea" }, ],});Loading config at runtime
The default startCms / createCmsRuntime flow resolves config from your project root (content.config.ts by default). Override with CMS_CONFIG_PATH or pass config / configPath into createCmsRuntime (see runtime types).