# nadeemtsf/texloom architecture

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

- Interactive diagram: https://gitdiagram.com/nadeemtsf/texloom
- Repository: https://github.com/nadeemtsf/texloom

## Overview

Texloom is a Windows LaTeX editor whose main workflow is opening a project, editing source or supported PDF text, compiling locally, and reviewing the resulting PDF. The Rust desktop service coordinates document state, builds, source mapping, verification, saving, and recovery; the web UI provides Monaco and PDF-canvas interactions. The graph includes documented capabilities whose implementation was not sampled, using directory paths where the tree supports a subsystem but its internal call links are unverified.

Main entry points: [`src-tauri/src/service.rs`](https://github.com/nadeemtsf/texloom/blob/main/src-tauri/src/service.rs) (Desktop backend), [`web/app.js`](https://github.com/nadeemtsf/texloom/blob/main/web/app.js) (Editor shell), [`crates/texloom-build/src/engine.rs`](https://github.com/nadeemtsf/texloom/blob/main/crates/texloom-build/src/engine.rs) (TeX compiler), [`web/core/canvas-controller.js`](https://github.com/nadeemtsf/texloom/blob/main/web/core/canvas-controller.js) (PDF canvas)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Editor interface"]
  node_app["Editor shell<br/>[app.js]"]
  node_canvas["PDF canvas"]
  node_geometry["Text geometry<br/>[geometry.js]"]
  node_inline_text["Inline text<br/>[inline-text.js]"]
  node_pdf_search["PDF search<br/>[pdf-search.js]"]
  node_pdf_render["PDF rendering<br/>[pdf-surface.js]"]
end

subgraph group_protocol["IPC contracts"]
  node_document_client["Document client<br/>[document-client.js]"]
  node_build_protocol["Build protocol<br/>[build-protocol.js]"]
  node_document_protocol["Document protocol"]
  node_workspace_protocol["Workspace protocol"]
end

subgraph group_native["Desktop service"]
  node_tauri["Tauri commands<br/>[lib.rs]"]
  node_service["Desktop backend<br/>[service.rs]"]
  node_document_service["Document authority<br/>[document.rs]"]
  node_visual_ops["Visual editing<br/>[visual.rs]"]
  node_layout_gate["Layout verification<br/>[layout_gate.rs]"]
  node_synctex["Source mapping<br/>[synctex.rs]"]
  node_project_workflows["Project workflows"]
end

subgraph group_core["Document model"]
  node_core_document["Document history<br/>[document.rs]"]
  node_inline_flow["Editable text flow<br/>[inline_flow.rs]"]
  node_objects["Document objects<br/>[objects.rs]"]
  node_adapters["LaTeX adapters<br/>[adapters.rs]"]
end

subgraph group_build["Build and persistence"]
  node_build_engine["TeX compiler<br/>[engine.rs]"]
  node_bibliography["Bibliography jobs<br/>[bibliography.rs]"]
  node_inspector["PDF inspection"]
  node_pdfium["PDFium worker<br/>[mod.rs]"]
  node_persistence[("Save and recovery<br/>[persistence.rs]")]
end

node_user(("Editor user"))
node_tex["Local TeX distribution"]
node_pdf["Compiled PDF"]

node_user -->|"edits project"| node_app
node_app -->|"handles gestures"| node_canvas
node_canvas -->|"uses bounds"| node_geometry
node_canvas -->|"measures carets"| node_inline_text
node_app -->|"renders preview"| node_pdf_render
node_app -->|"creates client"| node_document_client
node_app -->|"invokes commands"| node_tauri
node_document_client -->|"requests builds"| node_build_protocol
node_document_client -->|"validates replies"| node_document_protocol
node_tauri -->|"dispatches commands"| node_service
node_service -->|"delegates document"| node_document_service
node_service -->|"delegates edits"| node_visual_ops
node_service -->|"checks candidates"| node_layout_gate
node_service -->|"resolves mappings"| node_synctex
node_service -->|"handles projects"| node_project_workflows
node_service -->|"runs compilation"| node_build_engine
node_service -->|"saves projects"| node_persistence
node_service -->|"checks candidate PDF"| node_inspector
node_build_engine -->|"runs local engine"| node_tex
node_build_engine -->|"runs bibliography"| node_bibliography
node_inspector -.->|"uses worker"| node_pdfium
node_build_engine -->|"produces PDF"| node_pdf
node_core_document -->|"uses text flow"| node_inline_flow
node_inline_flow -->|"reads definitions"| node_objects
node_inline_flow -->|"parses arguments"| node_adapters
node_document_service -->|"maintains history"| node_core_document
node_document_service -.->|"supports recovery"| node_persistence
node_project_workflows -.->|"saves and recovers"| node_persistence
node_app -.->|"searches preview"| node_pdf_search

click node_app "https://github.com/nadeemtsf/texloom/blob/main/web/app.js"
click node_canvas "https://github.com/nadeemtsf/texloom/blob/main/web/core/canvas-controller.js"
click node_geometry "https://github.com/nadeemtsf/texloom/blob/main/web/core/geometry.js"
click node_inline_text "https://github.com/nadeemtsf/texloom/blob/main/web/core/inline-text.js"
click node_pdf_search "https://github.com/nadeemtsf/texloom/blob/main/web/core/pdf-search.js"
click node_pdf_render "https://github.com/nadeemtsf/texloom/blob/main/web/core/pdf-surface.js"
click node_document_client "https://github.com/nadeemtsf/texloom/blob/main/web/core/document-client.js"
click node_build_protocol "https://github.com/nadeemtsf/texloom/blob/main/web/core/build-protocol.js"
click node_document_protocol "https://github.com/nadeemtsf/texloom/blob/main/web/core/document-protocol.js"
click node_workspace_protocol "https://github.com/nadeemtsf/texloom/blob/main/web/core/workspace-protocol.js"
click node_tauri "https://github.com/nadeemtsf/texloom/blob/main/src-tauri/src/lib.rs"
click node_service "https://github.com/nadeemtsf/texloom/blob/main/src-tauri/src/service.rs"
click node_document_service "https://github.com/nadeemtsf/texloom/blob/main/src-tauri/src/service/document.rs"
click node_visual_ops "https://github.com/nadeemtsf/texloom/blob/main/src-tauri/src/service/visual.rs"
click node_layout_gate "https://github.com/nadeemtsf/texloom/blob/main/src-tauri/src/service/layout_gate.rs"
click node_synctex "https://github.com/nadeemtsf/texloom/blob/main/src-tauri/src/service/synctex.rs"
click node_project_workflows "https://github.com/nadeemtsf/texloom/blob/main/src-tauri/src/service/project_workflows.rs"
click node_core_document "https://github.com/nadeemtsf/texloom/blob/main/crates/texloom-core/src/document.rs"
click node_inline_flow "https://github.com/nadeemtsf/texloom/blob/main/crates/texloom-core/src/inline_flow.rs"
click node_objects "https://github.com/nadeemtsf/texloom/blob/main/crates/texloom-core/src/objects.rs"
click node_adapters "https://github.com/nadeemtsf/texloom/blob/main/crates/texloom-core/src/adapters.rs"
click node_build_engine "https://github.com/nadeemtsf/texloom/blob/main/crates/texloom-build/src/engine.rs"
click node_bibliography "https://github.com/nadeemtsf/texloom/blob/main/crates/texloom-build/src/bibliography.rs"
click node_inspector "https://github.com/nadeemtsf/texloom/blob/main/crates/texloom-build/src/inspection_worker.rs"
click node_pdfium "https://github.com/nadeemtsf/texloom/blob/main/crates/texloom-build/src/bin/pdfium_worker/mod.rs"
click node_persistence "https://github.com/nadeemtsf/texloom/blob/main/crates/texloom-build/src/persistence.rs"

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_canvas,node_geometry,node_inline_text,node_pdf_search,node_pdf_render,node_user toneBlue
class node_document_client,node_build_protocol,node_document_protocol,node_workspace_protocol toneAmber
class node_tauri,node_service,node_document_service,node_visual_ops,node_layout_gate,node_synctex,node_project_workflows toneMint
class node_core_document,node_inline_flow,node_objects,node_adapters toneRose
class node_build_engine,node_bibliography,node_inspector,node_pdfium,node_persistence,node_tex,node_pdf toneIndigo
```

## Components

### Editor interface

- [Editor shell](https://github.com/nadeemtsf/texloom/blob/main/web/app.js): `web/app.js`
- [PDF canvas](https://github.com/nadeemtsf/texloom/blob/main/web/core/canvas-controller.js): `web/core/canvas-controller.js`
- [Text geometry](https://github.com/nadeemtsf/texloom/blob/main/web/core/geometry.js): `web/core/geometry.js`
- [Inline text](https://github.com/nadeemtsf/texloom/blob/main/web/core/inline-text.js): `web/core/inline-text.js`
- [PDF search](https://github.com/nadeemtsf/texloom/blob/main/web/core/pdf-search.js): `web/core/pdf-search.js`
- [PDF rendering](https://github.com/nadeemtsf/texloom/blob/main/web/core/pdf-surface.js): `web/core/pdf-surface.js`

### IPC contracts

- [Document client](https://github.com/nadeemtsf/texloom/blob/main/web/core/document-client.js): `web/core/document-client.js`
- [Build protocol](https://github.com/nadeemtsf/texloom/blob/main/web/core/build-protocol.js): `web/core/build-protocol.js`
- [Document protocol](https://github.com/nadeemtsf/texloom/blob/main/web/core/document-protocol.js): `web/core/document-protocol.js`
- [Workspace protocol](https://github.com/nadeemtsf/texloom/blob/main/web/core/workspace-protocol.js): `web/core/workspace-protocol.js`

### Desktop service

- [Tauri commands](https://github.com/nadeemtsf/texloom/blob/main/src-tauri/src/lib.rs): `src-tauri/src/lib.rs`
- [Desktop backend](https://github.com/nadeemtsf/texloom/blob/main/src-tauri/src/service.rs): `src-tauri/src/service.rs`
- [Document authority](https://github.com/nadeemtsf/texloom/blob/main/src-tauri/src/service/document.rs): `src-tauri/src/service/document.rs`
- [Visual editing](https://github.com/nadeemtsf/texloom/blob/main/src-tauri/src/service/visual.rs): `src-tauri/src/service/visual.rs`
- [Layout verification](https://github.com/nadeemtsf/texloom/blob/main/src-tauri/src/service/layout_gate.rs): `src-tauri/src/service/layout_gate.rs`
- [Source mapping](https://github.com/nadeemtsf/texloom/blob/main/src-tauri/src/service/synctex.rs): `src-tauri/src/service/synctex.rs`
- [Project workflows](https://github.com/nadeemtsf/texloom/blob/main/src-tauri/src/service/project_workflows.rs): `src-tauri/src/service/project_workflows.rs`

### Document model

- [Document history](https://github.com/nadeemtsf/texloom/blob/main/crates/texloom-core/src/document.rs): `crates/texloom-core/src/document.rs`
- [Editable text flow](https://github.com/nadeemtsf/texloom/blob/main/crates/texloom-core/src/inline_flow.rs): `crates/texloom-core/src/inline_flow.rs`
- [Document objects](https://github.com/nadeemtsf/texloom/blob/main/crates/texloom-core/src/objects.rs): `crates/texloom-core/src/objects.rs`
- [LaTeX adapters](https://github.com/nadeemtsf/texloom/blob/main/crates/texloom-core/src/adapters.rs): `crates/texloom-core/src/adapters.rs`

### Build and persistence

- [TeX compiler](https://github.com/nadeemtsf/texloom/blob/main/crates/texloom-build/src/engine.rs): `crates/texloom-build/src/engine.rs`
- [Bibliography jobs](https://github.com/nadeemtsf/texloom/blob/main/crates/texloom-build/src/bibliography.rs): `crates/texloom-build/src/bibliography.rs`
- [PDF inspection](https://github.com/nadeemtsf/texloom/blob/main/crates/texloom-build/src/inspection_worker.rs): `crates/texloom-build/src/inspection_worker.rs`
- [PDFium worker](https://github.com/nadeemtsf/texloom/blob/main/crates/texloom-build/src/bin/pdfium_worker/mod.rs): `crates/texloom-build/src/bin/pdfium_worker/mod.rs`
- [Save and recovery](https://github.com/nadeemtsf/texloom/blob/main/crates/texloom-build/src/persistence.rs): `crates/texloom-build/src/persistence.rs`

### Other components

- **Editor user**
- **Local TeX distribution**
- **Compiled PDF**

## Connections

- Editor user → Editor shell: edits project (evidence: `README.md`)
- Editor shell → PDF canvas: handles gestures (evidence: `web/app.js`)
- PDF canvas → Text geometry: uses bounds (evidence: `web/core/canvas-controller.js`)
- PDF canvas → Inline text: measures carets (evidence: `web/core/canvas-controller.js`)
- Editor shell → PDF rendering: renders preview (evidence: `web/app.js`)
- Editor shell → Document client: creates client (evidence: `web/app.js`)
- Editor shell → Tauri commands: invokes commands (evidence: `README.md`)
- Document client → Build protocol: requests builds (evidence: `web/core/document-client.js`)
- Document client → Document protocol: validates replies (evidence: `web/core/document-client.js`)
- Tauri commands → Desktop backend: dispatches commands (evidence: `src-tauri/src/lib.rs`)
- Desktop backend → Document authority: delegates document (evidence: `src-tauri/src/service.rs`)
- Desktop backend → Visual editing: delegates edits (evidence: `src-tauri/src/service.rs`)
- Desktop backend → Layout verification: checks candidates (evidence: `src-tauri/src/service.rs`)
- Desktop backend → Source mapping: resolves mappings (evidence: `src-tauri/src/service.rs`)
- Desktop backend → Project workflows: handles projects (evidence: `src-tauri/src/service.rs`)
- Desktop backend → TeX compiler: runs compilation (evidence: `README.md`)
- Desktop backend → Save and recovery: saves projects (evidence: `src-tauri/src/service.rs`)
- Desktop backend → PDF inspection: checks candidate PDF (evidence: `README.md`)
- TeX compiler → Local TeX distribution: runs local engine (evidence: `README.md`)
- TeX compiler → Bibliography jobs: runs bibliography (evidence: `crates/texloom-build/src/engine.rs`)
- PDF inspection → PDFium worker: uses worker
- TeX compiler → Compiled PDF: produces PDF (evidence: `README.md`)
- Document history → Editable text flow: uses text flow (evidence: `crates/texloom-core/src/document.rs`)
- Editable text flow → Document objects: reads definitions (evidence: `crates/texloom-core/src/inline_flow.rs`)
- Editable text flow → LaTeX adapters: parses arguments (evidence: `crates/texloom-core/src/inline_flow.rs`)
- Document authority → Document history: maintains history (evidence: `src-tauri/src/service/document.rs`)
- Document authority → Save and recovery: supports recovery
- Project workflows → Save and recovery: saves and recovers
- Editor shell → PDF search: searches preview (evidence: `web/app.js`)
