Configuration
cms-lab is deliberately config-first. Route mappings live in your repo so the scanner follows the same assumptions as your Next.js app.
Example
import { defineConfig } from "@cms-lab/core";
export default defineConfig({
site: { url: "http://localhost:3000" },
framework: { type: "next", router: "app" },
cms: {
provider: "prismic",
repositoryName: "my-repo",
accessToken: process.env.PRISMIC_ACCESS_TOKEN,
},
routes: [
{ type: "page", pattern: "/:uid", getPath: (doc) => "/" + doc.uid },
{ type: "article", pattern: "/articles/:uid", getPath: (doc) => "/articles/" + doc.uid },
],
checks: {
fields: {
required: [
{ type: "page", path: "title" },
{ type: "article", path: "title", severity: "warning" },
],
},
},
});Keys
| Key | Required | Meaning |
|---|---|---|
site.url | yes | The local, preview, or staging URL that route probes hit. |
framework | yes | Use { type: "next", router: "app" }. |
cms | yes | Prismic, Strapi, Directus, and WordPress provider settings. |
routes | yes | Content type to path mapping. Use getPath when a route is not a simple UID pattern. |
checks | no | Enable, disable, or configure check groups. |
Adapter examples
Adapter configs use the same route and check model. Strapi and Directus declare collections; WordPress declares REST content types. The adapters preserve native CMS fields in document.data, so route mappings and required-field checks can use provider-specific values when your app needs them.
cms: {
provider: "strapi",
url: "http://localhost:1337",
token: process.env.STRAPI_TOKEN,
collections: [{ type: "page", endpoint: "pages" }],
}
cms: {
provider: "directus",
url: "http://localhost:8055",
token: process.env.DIRECTUS_TOKEN,
collections: [{ type: "page", collection: "pages" }],
}
cms: {
provider: "wordpress",
url: "http://localhost:8080",
contentTypes: [{ type: "post", endpoint: "posts" }],
}Required fields
Field checks are project-specific. Use them for CMS values that your app assumes exist at render time.
checks: {
seo: {
metaTitle: true,
metaDescription: true,
},
a11y: {
imgAlt: true,
},
fields: {
required: [
{ type: "page", path: "title" },
{ type: "article", path: "author.name", severity: "warning" },
],
},
}Path formatRequired field paths are read from
document.data. Use dotted paths for nested objects, for example author.name.Provider fieldsSEO and image checks understand the common native shapes from the bundled adapters, including Strapi
seo.metaTitle, Directus seo.title, WordPress yoast_head_json, Strapi alternativeText, Directus image descriptions, and WordPress alt_text.