From f92601a1d49ee60d122082f48fcd119fa45074ba Mon Sep 17 00:00:00 2001 From: CCS Admin Date: Sun, 15 Feb 2026 01:11:10 +0000 Subject: [PATCH] docs: add contracts package reference to CLAUDE.md Co-Authored-By: Claude Opus 4.6 --- CLAUDE.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/CLAUDE.md b/CLAUDE.md index 96758d9..ff6259f 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -33,6 +33,42 @@ NEXT_PUBLIC_UMAMI_HOST=https://analytics.c2sgmbh.de NEXT_PUBLIC_UMAMI_WEBSITE_ID= ``` +## Shared Contracts Package + +This project uses `@c2s/payload-contracts` for the API client layer. + +**Architecture:** +- `src/lib/cms.ts` — Shared PayloadClient instance (tenant: blogwoman, ID: 9) +- `src/lib/api.ts` — API functions powered by contracts client +- `src/lib/types.ts` — Local type aliases (simplified for component compatibility) + +**Contracts Repo:** `github:complexcaresolutions/payload-contracts` + +```typescript +// How the API client works (src/lib/cms.ts) +import { createPayloadClient } from "@c2s/payload-contracts/api-client" +export const cms = createPayloadClient({ + baseUrl: process.env.NEXT_PUBLIC_PAYLOAD_URL!, + tenantId: process.env.NEXT_PUBLIC_TENANT_ID!, +}) + +// Usage in api.ts — tenant isolation is automatic +const page = await cms.pages.getPage("home") +const posts = await cms.posts.getPosts({ type: "blog", limit: 10 }) +const nav = await cms.navigation.getNavigation("header") +``` + +**Type Bridge:** Local types in `types.ts` use simplified interfaces (e.g., `meta` instead of `seo`). The api.ts bridges between contracts types and local types via `as unknown as`. This will be cleaned up when components are aligned with real CMS types. + +**Block Catalog:** See `node_modules/@c2s/payload-contracts/docs/BLOCK_CATALOG.md` for all 43 block definitions. + +**Updating Contracts:** +```bash +pnpm update @c2s/payload-contracts +# Check for work orders in node_modules/@c2s/payload-contracts/work-orders/ +``` + + ## Architecture ### Directory Structure