Skip to content

Collaboration

Collaboration adds an editorial review workflow on top of a collection: an assignable editor, threaded comments, an activity feed, and, optionally, a gate that blocks publishing until a document is approved. It’s off by default. A collection only gets the review UI once it’s listed in collaboration.collections.

cms.config.ts
export default defineConfig({
collaboration: {
requireApproval: false,
collections: ["pages", { slug: "posts", requireApproval: true }],
},
collections: [...],
});

Listing a collection is the on switch. A collection absent from collaboration.collections has no review bar, no list columns, and no publish gate. pages above just gets the review UI; posts also requires approval before publishing, overriding the group default.

Option Type Default Description
collections (string | { slug, requireApproval })[] [] Which collections get collaboration. A bare slug uses the group default; an object overrides requireApproval for that collection.
requireApproval boolean false Group default: block publishing a draft-enabled document until its review is approved. Approvers bypass the gate.
approverRoles string[] ["admin"] Roles allowed to approve, request changes, and bypass the publish gate.

A document’s review state is in_progress until someone submits it for review. States: in_progressready_for_reviewapproved or changes_requested. Only approvers (approverRoles) can set approved or changes_requested. This is enforced server-side, not just hidden in the UI, so a non-approver can’t set their own draft to approved and bypass the gate.

When a collection’s resolved requireApproval is true, a non-approver can’t publish that document until its review state is approved. This only applies to collections with drafts enabled; a new document with no review yet counts as unapproved. Approvers always bypass the gate.

Comments can attach to a document as a whole or to a specific field, and can be resolved/reopened. The activity feed is derived from the audit log for that document — no separate tracking needed. Both are scoped to collaboration-enabled collections; the /api/cms/collaboration route returns 404 for any other collection.

Server-side code (hooks, scripts, integrations) can drive collaboration through the collaboration object exported from @kidecms/core, the same functions the admin UI’s API route calls:

import { collaboration } from "@kidecms/core";
await collaboration.setReviewState("posts", documentId, "approved", actor);

Available methods: getState, getStatesForDocs, assignedTo, setReviewState, submitForReview, setEditor, listComments, addComment, getComment, resolveComment, deleteComment, getActivity. submitForReview sets ready_for_review and claims the submitter as editor if none is assigned.