# quantiradev/qt_pdf-editor architecture

> Architecture diagram of the GitHub repository quantiradev/qt_pdf-editor, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/quantiradev/qt_pdf-editor
- Repository: https://github.com/quantiradev/qt_pdf-editor

## Overview

QT PDF Studio is a browser-based PDF workspace. Users reach the document library, open a PDF in reader or editor mode, make document changes, and download the result; accounts are a separate capability. The frontend store coordinates PDF loading and API operations, while the FastAPI backend owns document operations and file history. The tree and excerpts support the main editing, reading, and authentication areas, but do not expose every route or establish wiring for advertised AI analysis, so those links are omitted.

Main entry points: [`backend/main.py`](https://github.com/quantiradev/qt_pdf-editor/blob/main/backend/main.py) (PDF API), [`frontend/lib/store.ts`](https://github.com/quantiradev/qt_pdf-editor/blob/main/frontend/lib/store.ts) (Editor state), [`frontend/lib/api.ts`](https://github.com/quantiradev/qt_pdf-editor/blob/main/frontend/lib/api.ts) (API client), [`frontend/app/editor/[id]/page.tsx`](https://github.com/quantiradev/qt_pdf-editor/blob/main/frontend/app/editor/%5Bid%5D/page.tsx) (Editor route)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_library["Document library<br/>[page.tsx]"]
  node_editor_route["Editor route<br/>[page.tsx]"]
  node_preview_route["Reader route<br/>[page.tsx]"]
  node_editor_ui["Editor studio<br/>[Editor.tsx]"]
  node_reader_ui["PDF reader<br/>[Previewer.tsx]"]
  node_auth_page["Sign-in page<br/>[page.tsx]"]
  node_auth_card["Authentication form<br/>[AuthCard.tsx]"]
end

subgraph group_client["PDF client"]
  node_store["Editor state<br/>[store.ts]"]
  node_pdf_client["PDF renderer<br/>[pdf.ts]"]
  node_api["API client<br/>[api.ts]"]
end

subgraph group_backend["PDF services"]
  node_backend_api["PDF API<br/>[main.py]"]
  node_pdf_ops["PDF operations<br/>[pdf_ops.py]"]
  node_text_engine["Text editing<br/>[text_engine.py]"]
  node_storage[("Document storage<br/>[storage.py]")]
  node_pdf_files["PDF files and history<br/>[storage.py]"]
end

subgraph group_identity["Identity"]
  node_auth_backend["Auth handlers<br/>[auth.py]"]
  node_auth_service["Auth service<br/>[index.ts]"]
end

node_user(("User"))
node_browser(("Browser"))

node_user -->|"opens workspace"| node_library
node_user -->|"edits PDF"| node_editor_route
node_user -->|"reads PDF"| node_preview_route
node_user -->|"signs in"| node_auth_page
node_editor_route -->|"renders editor"| node_editor_ui
node_preview_route -->|"renders reader"| node_reader_ui
node_editor_ui -->|"uses state"| node_store
node_reader_ui -->|"loads document"| node_store
node_store -->|"loads PDF"| node_pdf_client
node_store -->|"requests operations"| node_api
node_browser -->|"sends requests"| node_api
node_api -->|"calls endpoints"| node_backend_api
node_backend_api -->|"reads and updates"| node_storage
node_backend_api -->|"runs PDF operations"| node_pdf_ops
node_backend_api -->|"applies text edits"| node_text_engine
node_storage -->|"stores PDFs and snapshots"| node_pdf_files
node_auth_page -->|"renders form"| node_auth_card
node_auth_card -.->|"posts credentials"| node_auth_service
node_auth_service -->|"routes auth requests"| node_auth_backend
node_backend_api -->|"handles auth routes"| node_auth_backend

click node_library "https://github.com/quantiradev/qt_pdf-editor/blob/main/frontend/app/page.tsx"
click node_editor_route "https://github.com/quantiradev/qt_pdf-editor/blob/main/frontend/app/editor/%5Bid%5D/page.tsx"
click node_preview_route "https://github.com/quantiradev/qt_pdf-editor/blob/main/frontend/app/preview/%5Bid%5D/page.tsx"
click node_editor_ui "https://github.com/quantiradev/qt_pdf-editor/blob/main/frontend/components/editor-studio/Editor.tsx"
click node_reader_ui "https://github.com/quantiradev/qt_pdf-editor/blob/main/frontend/components/editor-studio/Previewer.tsx"
click node_auth_page "https://github.com/quantiradev/qt_pdf-editor/blob/main/frontend/app/auth/page.tsx"
click node_auth_card "https://github.com/quantiradev/qt_pdf-editor/blob/main/frontend/components/authentication/AuthCard.tsx"
click node_store "https://github.com/quantiradev/qt_pdf-editor/blob/main/frontend/lib/store.ts"
click node_pdf_client "https://github.com/quantiradev/qt_pdf-editor/blob/main/frontend/lib/pdf.ts"
click node_api "https://github.com/quantiradev/qt_pdf-editor/blob/main/frontend/lib/api.ts"
click node_backend_api "https://github.com/quantiradev/qt_pdf-editor/blob/main/backend/main.py"
click node_pdf_ops "https://github.com/quantiradev/qt_pdf-editor/blob/main/backend/pdf_ops.py"
click node_text_engine "https://github.com/quantiradev/qt_pdf-editor/blob/main/backend/text_engine.py"
click node_storage "https://github.com/quantiradev/qt_pdf-editor/blob/main/backend/storage.py"
click node_auth_backend "https://github.com/quantiradev/qt_pdf-editor/blob/main/backend/auth.py"
click node_auth_service "https://github.com/quantiradev/qt_pdf-editor/blob/main/backend/src/index.ts"
click node_pdf_files "https://github.com/quantiradev/qt_pdf-editor/blob/main/backend/storage.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_library,node_editor_route,node_preview_route,node_editor_ui,node_reader_ui,node_auth_page,node_auth_card,node_user,node_browser toneBlue
class node_store,node_pdf_client,node_api toneAmber
class node_backend_api,node_pdf_ops,node_text_engine,node_storage,node_pdf_files toneMint
class node_auth_backend,node_auth_service toneRose
```

## Components

### Web experience

- [Document library](https://github.com/quantiradev/qt_pdf-editor/blob/main/frontend/app/page.tsx): `frontend/app/page.tsx`
- [Editor route](https://github.com/quantiradev/qt_pdf-editor/blob/main/frontend/app/editor/%5Bid%5D/page.tsx): `frontend/app/editor/[id]/page.tsx`
- [Reader route](https://github.com/quantiradev/qt_pdf-editor/blob/main/frontend/app/preview/%5Bid%5D/page.tsx): `frontend/app/preview/[id]/page.tsx`
- [Editor studio](https://github.com/quantiradev/qt_pdf-editor/blob/main/frontend/components/editor-studio/Editor.tsx): `frontend/components/editor-studio/Editor.tsx`
- [PDF reader](https://github.com/quantiradev/qt_pdf-editor/blob/main/frontend/components/editor-studio/Previewer.tsx): `frontend/components/editor-studio/Previewer.tsx`
- [Sign-in page](https://github.com/quantiradev/qt_pdf-editor/blob/main/frontend/app/auth/page.tsx): `frontend/app/auth/page.tsx`
- [Authentication form](https://github.com/quantiradev/qt_pdf-editor/blob/main/frontend/components/authentication/AuthCard.tsx): `frontend/components/authentication/AuthCard.tsx`

### PDF client

- [Editor state](https://github.com/quantiradev/qt_pdf-editor/blob/main/frontend/lib/store.ts): `frontend/lib/store.ts`
- [PDF renderer](https://github.com/quantiradev/qt_pdf-editor/blob/main/frontend/lib/pdf.ts): `frontend/lib/pdf.ts`
- [API client](https://github.com/quantiradev/qt_pdf-editor/blob/main/frontend/lib/api.ts): `frontend/lib/api.ts`

### PDF services

- [PDF API](https://github.com/quantiradev/qt_pdf-editor/blob/main/backend/main.py): `backend/main.py`
- [PDF operations](https://github.com/quantiradev/qt_pdf-editor/blob/main/backend/pdf_ops.py): `backend/pdf_ops.py`
- [Text editing](https://github.com/quantiradev/qt_pdf-editor/blob/main/backend/text_engine.py): `backend/text_engine.py`
- [Document storage](https://github.com/quantiradev/qt_pdf-editor/blob/main/backend/storage.py): `backend/storage.py`
- [PDF files and history](https://github.com/quantiradev/qt_pdf-editor/blob/main/backend/storage.py): `backend/storage.py`

### Identity

- [Auth handlers](https://github.com/quantiradev/qt_pdf-editor/blob/main/backend/auth.py): `backend/auth.py`
- [Auth service](https://github.com/quantiradev/qt_pdf-editor/blob/main/backend/src/index.ts): `backend/src/index.ts`

### Other components

- **User**
- **Browser**

## Connections

- User → Document library: opens workspace
- User → Editor route: edits PDF
- User → Reader route: reads PDF
- User → Sign-in page: signs in
- Editor route → Editor studio: renders editor
- Reader route → PDF reader: renders reader
- Editor studio → Editor state: uses state
- PDF reader → Editor state: loads document
- Editor state → PDF renderer: loads PDF
- Editor state → API client: requests operations
- Browser → API client: sends requests
- API client → PDF API: calls endpoints
- PDF API → Document storage: reads and updates
- PDF API → PDF operations: runs PDF operations
- PDF API → Text editing: applies text edits
- Document storage → PDF files and history: stores PDFs and snapshots
- Sign-in page → Authentication form: renders form
- Authentication form → Auth service: posts credentials
- Auth service → Auth handlers: routes auth requests
- PDF API → Auth handlers: handles auth routes
