# himal-joshi/pdfquill architecture

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

- Interactive diagram: https://gitdiagram.com/himal-joshi/pdfquill
- Repository: https://github.com/himal-joshi/pdfquill

## Overview

PDFQuill is a PDF and image utility presented as a browser-based React app. A user selects an operation and files in the workspace; the app coordinates processing helpers and presents downloadable results. The main processing stages include PDF manipulation, OCR/text extraction, image conversion, and page previews, with Firebase authentication as a supporting layer. The tree also contains a Node API and a Python PDF-to-Markdown function, although the README emphasizes client-side processing. Edges reflect shown references or calls; unsampled API wiring is left unverified.

Main entry points: [`webapp/client/src/App.tsx`](https://github.com/himal-joshi/pdfquill/blob/main/webapp/client/src/App.tsx) (PDF workspace), [`webapp/client/src/main.tsx`](https://github.com/himal-joshi/pdfquill/blob/main/webapp/client/src/main.tsx) (React entry), [`webapp/client/src/lib/pdfToMdProcessing.ts`](https://github.com/himal-joshi/pdfquill/blob/main/webapp/client/src/lib/pdfToMdProcessing.ts) (PDF to Markdown), [`webapp/client/src/lib/ocrProcessing.ts`](https://github.com/himal-joshi/pdfquill/blob/main/webapp/client/src/lib/ocrProcessing.ts) (OCR and extraction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workspace["Workspace"]
  node_app["PDF workspace<br/>[App.tsx]"]
  node_entry["React entry<br/>[main.tsx]"]
  node_thumbnails["Page previews<br/>[pdfThumbnails.ts]"]
end

subgraph group_pdf_tools["PDF Tools"]
  node_pdf_ops["PDF operations<br/>[pdfProcessing.ts]"]
  node_pdf_markdown["PDF to Markdown"]
end

subgraph group_media_ocr["Image and OCR"]
  node_ocr["OCR and extraction<br/>[ocrProcessing.ts]"]
  node_image_ops["Image processing<br/>[imageProcessing.ts]"]
end

subgraph group_identity["Identity and platform"]
  node_firebase["Firebase auth<br/>[firebase.ts]"]
  node_auth_helpers["Auth helpers<br/>[auth.ts]"]
  node_platform["Platform detection<br/>[platform.ts]"]
end

subgraph group_api["API services"]
  node_node_api["PDF API<br/>[index.js]"]
  node_markdown_api["Markdown function<br/>[pdf_to_md.py]"]
end

node_user(("User"))
node_markdown_endpoint{{"Markdown endpoint"}}

node_user -->|"opens app"| node_entry
node_entry -->|"renders"| node_app
node_app -->|"uses"| node_pdf_ops
node_app -->|"uses"| node_pdf_markdown
node_app -->|"uses"| node_ocr
node_app -->|"uses"| node_image_ops
node_app -->|"uses"| node_firebase
node_app -->|"renders pages"| node_thumbnails
node_app -->|"signs out"| node_firebase
node_image_ops -->|"checks runtime"| node_platform
node_ocr -->|"checks runtime"| node_platform
node_pdf_markdown -->|"posts PDF"| node_markdown_endpoint
node_markdown_endpoint -.->|"may route to"| node_markdown_api

click node_app "https://github.com/himal-joshi/pdfquill/blob/main/webapp/client/src/App.tsx"
click node_entry "https://github.com/himal-joshi/pdfquill/blob/main/webapp/client/src/main.tsx"
click node_thumbnails "https://github.com/himal-joshi/pdfquill/blob/main/webapp/client/src/lib/pdfThumbnails.ts"
click node_pdf_ops "https://github.com/himal-joshi/pdfquill/blob/main/webapp/client/src/lib/pdfProcessing.ts"
click node_pdf_markdown "https://github.com/himal-joshi/pdfquill/blob/main/webapp/client/src/lib/pdfToMdProcessing.ts"
click node_ocr "https://github.com/himal-joshi/pdfquill/blob/main/webapp/client/src/lib/ocrProcessing.ts"
click node_image_ops "https://github.com/himal-joshi/pdfquill/blob/main/webapp/client/src/lib/imageProcessing.ts"
click node_firebase "https://github.com/himal-joshi/pdfquill/blob/main/webapp/client/src/lib/firebase.ts"
click node_auth_helpers "https://github.com/himal-joshi/pdfquill/blob/main/webapp/client/src/lib/auth.ts"
click node_platform "https://github.com/himal-joshi/pdfquill/blob/main/webapp/client/src/lib/platform.ts"
click node_node_api "https://github.com/himal-joshi/pdfquill/blob/main/webapp/server/index.js"
click node_markdown_api "https://github.com/himal-joshi/pdfquill/blob/main/webapp/client/api/pdf_to_md.py"

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_entry,node_thumbnails,node_user toneBlue
class node_pdf_ops,node_pdf_markdown toneAmber
class node_ocr,node_image_ops toneMint
class node_firebase,node_auth_helpers,node_platform toneRose
class node_node_api,node_markdown_api,node_markdown_endpoint toneIndigo
```

## Components

### Workspace

- [PDF workspace](https://github.com/himal-joshi/pdfquill/blob/main/webapp/client/src/App.tsx): `webapp/client/src/App.tsx`
- [React entry](https://github.com/himal-joshi/pdfquill/blob/main/webapp/client/src/main.tsx): `webapp/client/src/main.tsx`
- [Page previews](https://github.com/himal-joshi/pdfquill/blob/main/webapp/client/src/lib/pdfThumbnails.ts): `webapp/client/src/lib/pdfThumbnails.ts`

### PDF Tools

- [PDF operations](https://github.com/himal-joshi/pdfquill/blob/main/webapp/client/src/lib/pdfProcessing.ts): `webapp/client/src/lib/pdfProcessing.ts`
- [PDF to Markdown](https://github.com/himal-joshi/pdfquill/blob/main/webapp/client/src/lib/pdfToMdProcessing.ts): `webapp/client/src/lib/pdfToMdProcessing.ts`

### Image and OCR

- [OCR and extraction](https://github.com/himal-joshi/pdfquill/blob/main/webapp/client/src/lib/ocrProcessing.ts): `webapp/client/src/lib/ocrProcessing.ts`
- [Image processing](https://github.com/himal-joshi/pdfquill/blob/main/webapp/client/src/lib/imageProcessing.ts): `webapp/client/src/lib/imageProcessing.ts`

### Identity and platform

- [Firebase auth](https://github.com/himal-joshi/pdfquill/blob/main/webapp/client/src/lib/firebase.ts): `webapp/client/src/lib/firebase.ts`
- [Auth helpers](https://github.com/himal-joshi/pdfquill/blob/main/webapp/client/src/lib/auth.ts): `webapp/client/src/lib/auth.ts`
- [Platform detection](https://github.com/himal-joshi/pdfquill/blob/main/webapp/client/src/lib/platform.ts): `webapp/client/src/lib/platform.ts`

### API services

- [PDF API](https://github.com/himal-joshi/pdfquill/blob/main/webapp/server/index.js): `webapp/server/index.js`
- [Markdown function](https://github.com/himal-joshi/pdfquill/blob/main/webapp/client/api/pdf_to_md.py): `webapp/client/api/pdf_to_md.py`

### Other components

- **User**
- **Markdown endpoint**

## Connections

- User → React entry: opens app (evidence: `webapp/client/src/main.tsx`)
- React entry → PDF workspace: renders (evidence: `webapp/client/src/main.tsx`)
- PDF workspace → PDF operations: uses (evidence: `webapp/client/src/App.tsx`)
- PDF workspace → PDF to Markdown: uses (evidence: `webapp/client/src/App.tsx`)
- PDF workspace → OCR and extraction: uses (evidence: `webapp/client/src/App.tsx`)
- PDF workspace → Image processing: uses (evidence: `webapp/client/src/App.tsx`)
- PDF workspace → Firebase auth: uses (evidence: `webapp/client/src/App.tsx`)
- PDF workspace → Page previews: renders pages (evidence: `webapp/client/src/App.tsx`)
- PDF workspace → Firebase auth: signs out (evidence: `webapp/client/src/App.tsx`)
- Image processing → Platform detection: checks runtime (evidence: `webapp/client/src/lib/imageProcessing.ts`)
- OCR and extraction → Platform detection: checks runtime (evidence: `webapp/client/src/lib/ocrProcessing.ts`)
- PDF to Markdown → Markdown endpoint: posts PDF (evidence: `webapp/client/src/lib/pdfToMdProcessing.ts`)
- Markdown endpoint → Markdown function: may route to
