Directus
Use Directus when explicit collections hold route fields, SEO fields, and catalog content.
Install
For CLI scans, @cms-lab/cli includes the bundled adapter. Add @cms-lab/core for defineConfig. Install @cms-lab/directus 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/directus
Config
import { defineConfig } from "@cms-lab/core";
export default defineConfig({
site: { url: "http://localhost:3000" },
framework: { type: "next", router: "app" },
cms: {
provider: "directus",
url: "http://localhost:8055",
token: process.env.DIRECTUS_TOKEN,
collections: [
{ type: "branch", collection: "branches", uidField: "slug" },
{ type: "menu_item", collection: "menu_items", uidField: "slug" },
{ type: "category", collection: "menu_categories", uidField: "slug" },
{ type: "pricing", collection: "item_branch_pricing", uidField: "id", routable: false },
],
},
routes: [
{ type: "branch", pattern: "/branches/:slug", getPath: (doc) => "/branches/" + doc.uid },
{ type: "menu_item", pattern: "/menu/:slug", getPath: (doc) => "/menu/" + 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: "directus",
collections: [
{
type: "page",
collection: "pages",
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
- Collections are explicit; cms-lab does not discover every Directus collection automatically.
- Run cms-lab init --cms directus --router pages for a starter config.
- Status handling uses common status values such as published, publish, and live.
- Use routable: false for relation-heavy collections that should be checked for fields without producing route-unmapped diagnostics.
Check the adapter maturity matrix before using this provider as a strict deploy gate.
For a larger relational setup, read the Directus restaurant catalog example.