mirror of
https://github.com/complexcaresolutions/frontend.blogwoman.de.git
synced 2026-03-17 15:04:01 +00:00
docs: add contracts package reference to CLAUDE.md
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
2500b8b16f
commit
f92601a1d4
1 changed files with 36 additions and 0 deletions
36
CLAUDE.md
36
CLAUDE.md
|
|
@ -33,6 +33,42 @@ NEXT_PUBLIC_UMAMI_HOST=https://analytics.c2sgmbh.de
|
|||
NEXT_PUBLIC_UMAMI_WEBSITE_ID=<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
|
||||
|
|
|
|||
Loading…
Reference in a new issue