Skip to Content
Packages@loop/cms

@loop/cms

Shared Payload CMS configuration consumed by any Loop app running Payload. Provides generic collections, access rules, hooks, and Clerk SSO authentication.

Installation

pnpm add @loop/cms

Collections

Generic collections reusable across Loop brands:

import { Users, Media, Pages, BlogPosts, FAQs, HelpArticles, Testimonials, ResearchPapers, COAs } from '@loop/cms/collections';
CollectionDescription
UsersCMS admin users (auto-created from Clerk)
MediaUploaded files and images
PagesStatic pages
BlogPostsBlog articles with rich text
FAQsFrequently asked questions
HelpArticlesHelp center content
TestimonialsCustomer testimonials
ResearchPapersResearch paper references
COAsCertificates of Analysis

Access Rules

import { isAuthenticated, isAdmin, isAdminOrEditor, isStaff, publicReadStaffWrite, adminOnlyField, editorField } from '@loop/cms/access'; // Use in collection config const MyCollection = { slug: 'my-collection', access: { read: publicReadStaffWrite, create: isAdminOrEditor, update: isAdminOrEditor, delete: isAdmin, }, fields: [ { name: 'title', type: 'text' }, adminOnlyField({ name: 'internalNotes', type: 'textarea' }), ], };

Hooks

Cache Revalidation

import { makeRevalidateHook } from '@loop/cms/hooks'; const MyCollection = { slug: 'my-collection', hooks: { afterChange: [makeRevalidateHook('my-collection')], }, };

When a document is created/updated, this hook calls revalidateTag('my-collection') to purge the Next.js cache.

Knowledge Base Sync

import { syncCOAToKnowledgeBase, removeCOAFromKnowledgeBase } from '@loop/cms/hooks';

Automatically syncs COA content to the vector knowledge base for Luna AI search.

Clerk Auth Strategy

import { clerkStrategy } from '@loop/cms/auth/clerk-strategy';

Integrates Clerk SSO with Payload CMS authentication. Users are auto-provisioned in Payload on first login based on their Clerk publicMetadata.adminRole.

Used By

@loop/cms is exclusively used by the admin application:

  • @loop/admin — Payload CMS collections, access rules, hooks, and authentication