How puckeditor/puck works
Puck is a modular visual editor for authoring React pages with application-owned components and data. The main workflow is configuring components and fields, editing page data in the Puck interface, publishing that data through the host application, then rendering it as a React page. The graph also preserves documented React-framework usage and sampled slot, Contentful-field, and AI integration capabilities. Core runtime wiring beyond the supplied excerpts is represented conservatively; unsampled relationships are omitted.
Main entry points: Puck/index.tsx Puck editor · Render/index.tsx React renderer · index.ts Editor state · Data.tsx Page data
Components 24
Visual authoring
- Component config
packages/core/types/Config.tsx - Puck editor
packages/core/components/Puck/index.tsx - Editor panels
packages/core/components/Puck/components/Layout/index.tsx - Canvas and drop zones
packages/core/components/Puck/components/Canvas/index.tsx - Layer outline
packages/core/components/LayerTree/index.tsx - Publish callback
packages/core/components/Puck/index.tsx - Demo component config
apps/demo/config/server.tsx
Page rendering
- React renderer
packages/core/components/Render/index.tsx - Slot renderer
packages/core/components/SlotRender/server.tsx - Server rendering
packages/core/components/ServerRender/index.tsx
Data and fields
- Editor state
packages/core/store/index.ts - State actions
packages/core/reducer/index.ts - Page data operations
packages/core/lib/data - Field controls
packages/core/components/AutoField/index.tsx - Rich text editing
packages/core/components/RichTextEditor/index.ts - Page data
packages/core/types/Data.tsx
Integrations
- Contentful field
packages/field-contentful/index.ts - Contentful service
- Puck AI handler
recipes/next-ai/app/api/puck/[...all]/route.ts - Puck Cloud
- Next.js recipe
recipes/next/app/[...puckPath]/page.tsx - React Router recipe
recipes/react-router/app/routes/puck-splat.tsx
Other components
- Editor user
- Host application
Connections 28
- Editor user → Puck editor: edits pages
- Host application → Puck editor: provides config and data
- Puck editor → Editor panels: renders interface
- Puck editor → Canvas and drop zones: renders canvas
- Puck editor → Editor state: manages state
- Canvas and drop zones → Editor state: updates page
- Layer outline → Editor state: updates structure
- Editor panels → Field controls: edits fields
- Field controls → Contentful field: uses field adapter
- Contentful field → Contentful service: fetches entries
- Editor state → State actions: dispatches actions
- State actions → Page data operations: changes page data
- Editor state → Page data: holds
- Puck editor → Publish callback: publishes data
- Publish callback → Host application: passes page data
- Host application → Page data: persists
- Host application → React renderer: renders saved page
- React renderer → Component config: uses config
- React renderer → Page data: uses data
- React renderer → Slot renderer: renders slots
- Slot renderer → Component config: resolves components
- Server rendering → React renderer: server-renders
- Host application → Puck AI handler: routes AI requests
- Puck AI handler → Puck Cloud: delegates requests
- Next.js recipe → Puck editor: hosts editor
- React Router recipe → Puck editor: hosts editor
- Demo component config → Component config: defines components
- Rich text editing → Page data: edits rich text