# topjohnnywu/pdf-censor-redaction architecture

> Architecture diagram of the GitHub repository topjohnnywu/pdf-censor-redaction, 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/topjohnnywu/pdf-censor-redaction
- Repository: https://github.com/topjohnnywu/pdf-censor-redaction

## Overview

PDF Censor Studio is a client-side PDF redaction app. Users load a PDF, mark regions for redaction (including across pages), optionally extract DO numbers with OCR, and export a rasterized PDF; templates support reusable layouts. The principal runtime is concentrated in one React component, so several domain-stage nodes share its source path. The README documents PDF.js, Tesseract.js, and the privacy-preserving browser workflow; the excerpts show the app entry point, sample-PDF generation, page rendering calls, and jsPDF export. OCR internals are not excerpted.

Main entry points: [`components/pdf-censor-studio.tsx`](https://github.com/topjohnnywu/pdf-censor-redaction/blob/main/components/pdf-censor-studio.tsx) (Studio interface), [`app/page.tsx`](https://github.com/topjohnnywu/pdf-censor-redaction/blob/main/app/page.tsx) (App entry), [`lib/sample-pdf.ts`](https://github.com/topjohnnywu/pdf-censor-redaction/blob/main/lib/sample-pdf.ts) (Sample PDF)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["App experience"]
  node_app["App entry<br/>[page.tsx]"]
  node_studio["Studio interface"]
end

subgraph group_document["PDF workflow"]
  node_pdfjs["PDF.js"]
  node_load["PDF loading"]
  node_render["Page rendering"]
  node_canvas["Browser canvas"]
  node_redaction["Redaction regions"]
  node_ocr["DO extraction"]
  node_tesseract["Tesseract.js"]
  node_export["Sanitized PDF export"]
  node_jspdf["jsPDF"]
end

subgraph group_tools["Supporting tools"]
  node_templates["Layout templates"]
  node_results["DO results"]
  node_sample["Sample PDF<br/>[sample-pdf.ts]"]
end

node_user(("PDF user"))

node_user -->|"opens"| node_app
node_app -->|"loads"| node_studio
node_studio -->|"accepts PDF"| node_load
node_studio -->|"loads sample"| node_sample
node_load -->|"decodes"| node_pdfjs
node_pdfjs -->|"renders pages"| node_render
node_render -->|"draws pages"| node_canvas
node_studio -->|"marks regions"| node_redaction
node_redaction -->|"burns into pages"| node_export
node_studio -->|"requests extraction"| node_ocr
node_ocr -->|"recognizes text"| node_tesseract
node_ocr -->|"produces numbers"| node_results
node_studio -->|"manages layouts"| node_templates
node_export -->|"creates PDF"| node_jspdf

click node_app "https://github.com/topjohnnywu/pdf-censor-redaction/blob/main/app/page.tsx"
click node_studio "https://github.com/topjohnnywu/pdf-censor-redaction/blob/main/components/pdf-censor-studio.tsx"
click node_load "https://github.com/topjohnnywu/pdf-censor-redaction/blob/main/components/pdf-censor-studio.tsx"
click node_render "https://github.com/topjohnnywu/pdf-censor-redaction/blob/main/components/pdf-censor-studio.tsx"
click node_redaction "https://github.com/topjohnnywu/pdf-censor-redaction/blob/main/components/pdf-censor-studio.tsx"
click node_ocr "https://github.com/topjohnnywu/pdf-censor-redaction/blob/main/components/pdf-censor-studio.tsx"
click node_templates "https://github.com/topjohnnywu/pdf-censor-redaction/blob/main/components/pdf-censor-studio.tsx"
click node_export "https://github.com/topjohnnywu/pdf-censor-redaction/blob/main/components/pdf-censor-studio.tsx"
click node_results "https://github.com/topjohnnywu/pdf-censor-redaction/blob/main/components/pdf-censor-studio.tsx"
click node_sample "https://github.com/topjohnnywu/pdf-censor-redaction/blob/main/lib/sample-pdf.ts"

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_app,node_studio,node_user toneBlue
class node_pdfjs,node_load,node_render,node_canvas,node_redaction,node_ocr,node_tesseract,node_export,node_jspdf toneAmber
class node_templates,node_results,node_sample toneMint
```

## Components

### App experience

- [App entry](https://github.com/topjohnnywu/pdf-censor-redaction/blob/main/app/page.tsx): `app/page.tsx`
- [Studio interface](https://github.com/topjohnnywu/pdf-censor-redaction/blob/main/components/pdf-censor-studio.tsx): `components/pdf-censor-studio.tsx`

### PDF workflow

- **PDF.js**
- [PDF loading](https://github.com/topjohnnywu/pdf-censor-redaction/blob/main/components/pdf-censor-studio.tsx): `components/pdf-censor-studio.tsx`
- [Page rendering](https://github.com/topjohnnywu/pdf-censor-redaction/blob/main/components/pdf-censor-studio.tsx): `components/pdf-censor-studio.tsx`
- **Browser canvas**
- [Redaction regions](https://github.com/topjohnnywu/pdf-censor-redaction/blob/main/components/pdf-censor-studio.tsx): `components/pdf-censor-studio.tsx`
- [DO extraction](https://github.com/topjohnnywu/pdf-censor-redaction/blob/main/components/pdf-censor-studio.tsx): `components/pdf-censor-studio.tsx`
- **Tesseract.js**
- [Sanitized PDF export](https://github.com/topjohnnywu/pdf-censor-redaction/blob/main/components/pdf-censor-studio.tsx): `components/pdf-censor-studio.tsx`
- **jsPDF**

### Supporting tools

- [Layout templates](https://github.com/topjohnnywu/pdf-censor-redaction/blob/main/components/pdf-censor-studio.tsx): `components/pdf-censor-studio.tsx`
- [DO results](https://github.com/topjohnnywu/pdf-censor-redaction/blob/main/components/pdf-censor-studio.tsx): `components/pdf-censor-studio.tsx`
- [Sample PDF](https://github.com/topjohnnywu/pdf-censor-redaction/blob/main/lib/sample-pdf.ts): `lib/sample-pdf.ts`

### Other components

- **PDF user**

## Connections

- PDF user → App entry: opens (evidence: `README.md`)
- App entry → Studio interface: loads (evidence: `app/page.tsx`)
- Studio interface → PDF loading: accepts PDF (evidence: `README.md`)
- Studio interface → Sample PDF: loads sample (evidence: `components/pdf-censor-studio.tsx`)
- PDF loading → PDF.js: decodes (evidence: `README.md`)
- PDF.js → Page rendering: renders pages (evidence: `README.md`)
- Page rendering → Browser canvas: draws pages (evidence: `README.md`)
- Studio interface → Redaction regions: marks regions (evidence: `README.md`)
- Redaction regions → Sanitized PDF export: burns into pages (evidence: `README.md`)
- Studio interface → DO extraction: requests extraction (evidence: `README.md`)
- DO extraction → Tesseract.js: recognizes text (evidence: `README.md`)
- DO extraction → DO results: produces numbers (evidence: `README.md`)
- Studio interface → Layout templates: manages layouts (evidence: `components/pdf-censor-studio.tsx`)
- Sanitized PDF export → jsPDF: creates PDF (evidence: `components/pdf-censor-studio.tsx`)
