Strapi

Use Strapi when collections and single types drive pages, layouts, or locale-specific content.

Install

For CLI scans, @cms-lab/cli includes the bundled adapter. Add @cms-lab/core for defineConfig. Install @cms-lab/strapi only when importing the adapter directly in project code or tests.

pnpm add -D @cms-lab/cli @cms-lab/core
pnpm add -D @cms-lab/strapi

Config

import { defineConfig, strapiRelationSlug } from "@cms-lab/core";

export default defineConfig({
  site: {
    url: "http://localhost:3000",
    healthPath: "/en",
  },
  framework: { type: "next", router: "pages" },
  cms: {
    provider: "strapi",
    url: "http://localhost:1337",
    token: process.env.STRAPI_TOKEN,
    locale: "en",
    collections: [
      { type: "page", endpoint: "pages", uidField: "slug" },
      { type: "article", endpoint: "articles", uidField: "slug" },
    ],
    singleTypes: [{ type: "navbar", endpoint: "navbar" }],
  },
  routes: [
    { type: "page", pattern: "/:slug", getPath: (doc) => "/" + doc.uid },
    {
      type: "article",
      pattern: "/blog/:topic/:slug",
      getPath: (doc) => {
        const topic = strapiRelationSlug(doc.data, "topic") ?? "uncategorized";
        return "/blog/" + topic + "/" + doc.uid;
      },
    },
  ],
});

UID and URL field mapping

Use uidField when the route key lives in a custom nested CMS field. Use urlField when the CMS stores the public permalink. Both read dotted paths from document.data.

cms: {
  provider: "strapi",
  collections: [
    {
      type: "product",
      endpoint: "products",
      uidField: "routing.slug",
      urlField: "routing.url",
    },
  ],
}

CI command

npx @cms-lab/cli doctor
npx @cms-lab/cli scan --ci --report --fail-on error

Provider caveats

  • The adapter requests populate=* and paginates collection responses.
  • Single types are scanned for content diagnostics but are non-routable by default.
  • Deep cross-document business rules are tracked separately from route and field checks.

Check the adapter maturity matrix before using this provider as a strict deploy gate.