# shadcn-labs/pdfcn architecture

> Architecture diagram of the GitHub repository shadcn-labs/pdfcn, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shadcn-labs/pdfcn
- Repository: https://github.com/shadcn-labs/pdfcn

## Overview

pdfcn is a React PDF component and block library paired with a documentation and customization site. A developer explores examples or presets, adapts registry components, and renders documents with either Forme or Takumi; the site also offers live previews, theme editing, and machine-readable discovery. The worker path is supported by excerpts; other registry and integration links are documented capabilities or tree-based subsystem boundaries, so those links are marked unverified where appropriate.

Main entry points: [`apps/web/registry`](https://github.com/shadcn-labs/pdfcn/tree/main/apps/web/registry) (Component registry), [`apps/web/app/(app)/(root)/page.tsx`](https://github.com/shadcn-labs/pdfcn/blob/main/apps/web/app/(app)/(root)/page.tsx) (Documentation site), [`apps/web/components/playground/worker.ts`](https://github.com/shadcn-labs/pdfcn/blob/main/apps/web/components/playground/worker.ts) (Render worker), [`apps/web/components/playground/use-render-worker.ts`](https://github.com/shadcn-labs/pdfcn/blob/main/apps/web/components/playground/use-render-worker.ts) (Render worker hook)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_site["Docs and discovery"]
  node_docs["Documentation site<br/>[page.tsx]"]
  node_agent_resources["Agent resources<br/>[route.ts]"]
  node_mcp_tools["MCP tools"]
end

subgraph group_authoring["PDF authoring"]
  node_registry["Component registry"]
  node_forme["Forme base<br/>[registry.ts]"]
  node_takumi["Takumi base<br/>[registry.ts]"]
  node_blocks["Document blocks"]
end

subgraph group_rendering["Preview and rendering"]
  node_playground["Live playground<br/>[takumi-preview.tsx]"]
  node_worker_hook["Render worker hook"]
  node_worker["Render worker<br/>[worker.ts]"]
  node_code_eval["Code evaluation<br/>[evaluate.ts]"]
  node_pdf_inspection["PDF inspection<br/>[inspect-pdf.ts]"]
  node_output_panel["Preview output<br/>[output-panel.tsx]"]
  node_pdf_routes["PDF render routes"]
  node_pdf_result["Rendered PDF"]
  node_forme_endpoint["Forme endpoint<br/>[route.tsx]"]
  node_takumi_endpoint["Takumi endpoint<br/>[route.tsx]"]
end

subgraph group_themes["Themes and customization"]
  node_themes["Theme presets"]
  node_theme_builder["Theme builder<br/>[theme-controls.tsx]"]
  node_theme_preview["Theme previews<br/>[theme-preview.tsx]"]
end

node_developer(("Developer"))

node_developer -->|"explores examples"| node_docs
node_docs -.->|"documents components"| node_registry
node_developer -->|"copies components"| node_registry
node_registry -->|"supports rendering"| node_forme
node_registry -->|"supports rendering"| node_takumi
node_registry -->|"provides blocks"| node_blocks
node_docs -->|"previews components"| node_playground
node_developer -.->|"customizes themes"| node_theme_builder
node_theme_builder -->|"selects presets"| node_themes
node_themes -.->|"provides themes"| node_theme_preview
node_playground -->|"requests rendering"| node_worker_hook
node_worker_hook -->|"posts render request"| node_worker
node_worker -->|"evaluates code"| node_code_eval
node_worker -->|"inspects bytes"| node_pdf_inspection
node_worker -->|"transfers PDF bytes"| node_pdf_result
node_worker_hook -->|"displays result"| node_output_panel
node_forme_endpoint -.->|"returns PDF"| node_pdf_result
node_takumi_endpoint -.->|"returns PDF"| node_pdf_result
node_docs -.->|"publishes discovery"| node_agent_resources
node_developer -.->|"uses tools"| node_mcp_tools

click node_docs "https://github.com/shadcn-labs/pdfcn/blob/main/apps/web/app/(app)/(root)/page.tsx"
click node_agent_resources "https://github.com/shadcn-labs/pdfcn/blob/main/apps/web/app/llms.txt/route.ts"
click node_mcp_tools "https://github.com/shadcn-labs/pdfcn/tree/main/apps/web/components/web-mcp"
click node_registry "https://github.com/shadcn-labs/pdfcn/tree/main/apps/web/registry"
click node_forme "https://github.com/shadcn-labs/pdfcn/blob/main/apps/web/registry/bases/forme/registry.ts"
click node_takumi "https://github.com/shadcn-labs/pdfcn/blob/main/apps/web/registry/bases/takumi/registry.ts"
click node_blocks "https://github.com/shadcn-labs/pdfcn/tree/main/apps/web/registry/bases"
click node_themes "https://github.com/shadcn-labs/pdfcn/tree/main/apps/web/registry/themes"
click node_theme_builder "https://github.com/shadcn-labs/pdfcn/blob/main/apps/web/components/theme-builder/theme-controls.tsx"
click node_theme_preview "https://github.com/shadcn-labs/pdfcn/blob/main/apps/web/components/theme-preview.tsx"
click node_playground "https://github.com/shadcn-labs/pdfcn/blob/main/apps/web/components/playground/takumi-preview.tsx"
click node_worker_hook "https://github.com/shadcn-labs/pdfcn/blob/main/apps/web/components/playground/use-render-worker.ts"
click node_worker "https://github.com/shadcn-labs/pdfcn/blob/main/apps/web/components/playground/worker.ts"
click node_code_eval "https://github.com/shadcn-labs/pdfcn/blob/main/apps/web/components/playground/evaluate.ts"
click node_pdf_inspection "https://github.com/shadcn-labs/pdfcn/blob/main/apps/web/components/playground/inspect-pdf.ts"
click node_output_panel "https://github.com/shadcn-labs/pdfcn/blob/main/apps/web/components/playground/output-panel.tsx"
click node_pdf_routes "https://github.com/shadcn-labs/pdfcn/tree/main/apps/web/app/api/pdf"
click node_forme_endpoint "https://github.com/shadcn-labs/pdfcn/blob/main/apps/web/app/api/pdf/forme/route.tsx"
click node_takumi_endpoint "https://github.com/shadcn-labs/pdfcn/blob/main/apps/web/app/api/pdf/takumi/route.tsx"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_docs,node_agent_resources,node_mcp_tools toneBlue
class node_registry,node_forme,node_takumi,node_blocks toneAmber
class node_playground,node_worker_hook,node_worker,node_code_eval,node_pdf_inspection,node_output_panel,node_pdf_routes,node_pdf_result,node_forme_endpoint,node_takumi_endpoint toneMint
class node_themes,node_theme_builder,node_theme_preview toneRose
class node_developer toneIndigo
```

## Components

### Docs and discovery

- [Documentation site](https://github.com/shadcn-labs/pdfcn/blob/main/apps/web/app/(app)/(root)/page.tsx): `apps/web/app/(app)/(root)/page.tsx`
- [Agent resources](https://github.com/shadcn-labs/pdfcn/blob/main/apps/web/app/llms.txt/route.ts): `apps/web/app/llms.txt/route.ts`
- [MCP tools](https://github.com/shadcn-labs/pdfcn/tree/main/apps/web/components/web-mcp): `apps/web/components/web-mcp`

### PDF authoring

- [Component registry](https://github.com/shadcn-labs/pdfcn/tree/main/apps/web/registry): `apps/web/registry`
- [Forme base](https://github.com/shadcn-labs/pdfcn/blob/main/apps/web/registry/bases/forme/registry.ts): `apps/web/registry/bases/forme/registry.ts`
- [Takumi base](https://github.com/shadcn-labs/pdfcn/blob/main/apps/web/registry/bases/takumi/registry.ts): `apps/web/registry/bases/takumi/registry.ts`
- [Document blocks](https://github.com/shadcn-labs/pdfcn/tree/main/apps/web/registry/bases): `apps/web/registry/bases`

### Preview and rendering

- [Live playground](https://github.com/shadcn-labs/pdfcn/blob/main/apps/web/components/playground/takumi-preview.tsx): `apps/web/components/playground/takumi-preview.tsx`
- [Render worker hook](https://github.com/shadcn-labs/pdfcn/blob/main/apps/web/components/playground/use-render-worker.ts): `apps/web/components/playground/use-render-worker.ts`
- [Render worker](https://github.com/shadcn-labs/pdfcn/blob/main/apps/web/components/playground/worker.ts): `apps/web/components/playground/worker.ts`
- [Code evaluation](https://github.com/shadcn-labs/pdfcn/blob/main/apps/web/components/playground/evaluate.ts): `apps/web/components/playground/evaluate.ts`
- [PDF inspection](https://github.com/shadcn-labs/pdfcn/blob/main/apps/web/components/playground/inspect-pdf.ts): `apps/web/components/playground/inspect-pdf.ts`
- [Preview output](https://github.com/shadcn-labs/pdfcn/blob/main/apps/web/components/playground/output-panel.tsx): `apps/web/components/playground/output-panel.tsx`
- [PDF render routes](https://github.com/shadcn-labs/pdfcn/tree/main/apps/web/app/api/pdf): `apps/web/app/api/pdf`
- **Rendered PDF**
- [Forme endpoint](https://github.com/shadcn-labs/pdfcn/blob/main/apps/web/app/api/pdf/forme/route.tsx): `apps/web/app/api/pdf/forme/route.tsx`
- [Takumi endpoint](https://github.com/shadcn-labs/pdfcn/blob/main/apps/web/app/api/pdf/takumi/route.tsx): `apps/web/app/api/pdf/takumi/route.tsx`

### Themes and customization

- [Theme presets](https://github.com/shadcn-labs/pdfcn/tree/main/apps/web/registry/themes): `apps/web/registry/themes`
- [Theme builder](https://github.com/shadcn-labs/pdfcn/blob/main/apps/web/components/theme-builder/theme-controls.tsx): `apps/web/components/theme-builder/theme-controls.tsx`
- [Theme previews](https://github.com/shadcn-labs/pdfcn/blob/main/apps/web/components/theme-preview.tsx): `apps/web/components/theme-preview.tsx`

### Other components

- **Developer**

## Connections

- Developer → Documentation site: explores examples (evidence: `README.md`)
- Documentation site → Component registry: documents components
- Developer → Component registry: copies components (evidence: `README.md`)
- Component registry → Forme base: supports rendering (evidence: `README.md`)
- Component registry → Takumi base: supports rendering (evidence: `README.md`)
- Component registry → Document blocks: provides blocks (evidence: `README.md`)
- Documentation site → Live playground: previews components (evidence: `README.md`)
- Developer → Theme builder: customizes themes
- Theme builder → Theme presets: selects presets (evidence: `apps/web/components/theme-builder/theme-controls.tsx`)
- Theme presets → Theme previews: provides themes
- Live playground → Render worker hook: requests rendering (evidence: `apps/web/components/playground/takumi-preview.tsx`)
- Render worker hook → Render worker: posts render request (evidence: `apps/web/components/playground/use-render-worker.ts`)
- Render worker → Code evaluation: evaluates code (evidence: `apps/web/components/playground/worker.ts`)
- Render worker → PDF inspection: inspects bytes (evidence: `apps/web/components/playground/worker.ts`)
- Render worker → Rendered PDF: transfers PDF bytes (evidence: `apps/web/components/playground/worker.ts`)
- Render worker hook → Preview output: displays result (evidence: `apps/web/components/playground/takumi-preview.tsx`)
- Forme endpoint → Rendered PDF: returns PDF
- Takumi endpoint → Rendered PDF: returns PDF
- Documentation site → Agent resources: publishes discovery
- Developer → MCP tools: uses tools
