# aburousan/hilbert-editor architecture

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

- Interactive diagram: https://gitdiagram.com/aburousan/hilbert-editor
- Repository: https://github.com/aburousan/hilbert-editor

## Overview

Hilbert is a local-first scientific-writing IDE for Typst. Its main workflow is to edit a document, compile it through the local backend, and inspect the live PDF preview. The UI also provides visual content builders, project/workspace tools, code execution, proofreading, and collaboration. The bundled Quiver editor is a distinct diagram-editing subsystem. README-described capabilities are included where source wiring was not shown; those edges cite the README, and unsampled implementation details are not inferred.

Main entry points: [`src/App.tsx`](https://github.com/aburousan/hilbert-editor/blob/main/src/App.tsx) (Document editor), [`public/quiver/ui.mjs`](https://github.com/aburousan/hilbert-editor/blob/main/public/quiver/ui.mjs) (Diagram editor UI), [`public/quiver/parser.mjs`](https://github.com/aburousan/hilbert-editor/blob/main/public/quiver/parser.mjs) (TikZ parser), [`public/quiver/arrow.mjs`](https://github.com/aburousan/hilbert-editor/blob/main/public/quiver/arrow.mjs) (Arrow rendering)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Writing workspace"]
  node_entry["App entry<br/>[main.tsx]"]
  node_editor["Document editor<br/>[App.tsx]"]
  node_preview["PDF preview<br/>[PdfPreview.tsx]"]
  node_workspace["Project workspace<br/>[projectFs.ts]"]
  node_api["Backend API<br/>[api.ts]"]
end

subgraph group_backend["Local services"]
  node_server["Local backend<br/>[server.rs]"]
  node_shell["Desktop shell<br/>[main.rs]"]
  node_typst{{"Typst compiler"}}
  node_code["Code execution<br/>[sandbox.rs]"]
end

subgraph group_tools["Scientific tools"]
  node_proofread["Proofreading<br/>[proofread.rs]"]
  node_language["Language support<br/>[dict_catalog.rs]"]
  node_builders["Visual builders"]
  node_plots["Plot studio<br/>[PlotStudio.tsx]"]
  node_citations["Citation tools<br/>[RefManager.tsx]"]
  node_labelgraph["Label graph<br/>[LabelGraph.tsx]"]
  node_slides["Slide studio<br/>[SlideStudio.tsx]"]
end

subgraph group_collab["Workspace sharing"]
  node_collab["Live collaboration<br/>[projectCollab.ts]"]
  node_sync["Drive and WebDAV sync<br/>[workspaceSync.ts]"]
end

subgraph group_quiver["Quiver diagrams"]
  node_quiverui["Diagram editor UI<br/>[ui.mjs]"]
  node_quivermodel["Diagram model<br/>[quiver.mjs]"]
  node_quiverparser["TikZ parser<br/>[parser.mjs]"]
  node_arrow["Arrow rendering<br/>[arrow.mjs]"]
  node_curve["Curve geometry<br/>[curve.mjs]"]
  node_dom["DOM utilities<br/>[dom.mjs]"]
  node_ds["Geometry primitives<br/>[ds.mjs]"]
  node_katex["KaTeX renderer<br/>[katex.mjs]"]
end

node_user(("Writer"))

node_user -->|"opens"| node_entry
node_entry -->|"mounts"| node_editor
node_editor -->|"requests"| node_api
node_api -.->|"calls"| node_server
node_shell -->|"starts"| node_server
node_server -.->|"compiles with"| node_typst
node_editor -.->|"updates"| node_preview
node_editor -.->|"edits project"| node_workspace
node_editor -.->|"runs snippets"| node_code
node_server -.->|"dispatches execution"| node_code
node_editor -.->|"requests checks"| node_proofread
node_proofread -.->|"uses dictionaries"| node_language
node_editor -.->|"inserts content"| node_builders
node_editor -.->|"opens"| node_plots
node_editor -.->|"manages references"| node_citations
node_editor -.->|"views references"| node_labelgraph
node_editor -.->|"creates decks"| node_slides
node_editor -.->|"shares projects"| node_collab
node_editor -.->|"syncs workspace"| node_sync
node_quiverui -->|"renders arrows"| node_arrow
node_quiverui -->|"uses curves"| node_curve
node_quiverui -->|"uses DOM helpers"| node_dom
node_quiverui -->|"uses primitives"| node_ds
node_quiverui -->|"parses diagrams"| node_quiverparser
node_quiverui -->|"uses model"| node_quivermodel
node_quiverui -->|"renders math"| node_katex
node_quiverparser -->|"reads constants"| node_arrow
node_quiverparser -->|"uses helpers"| node_dom
node_quiverparser -->|"uses primitives"| node_ds
node_quiverparser -->|"exports diagram"| node_quivermodel
node_quiverparser -->|"creates vertices"| node_quiverui
node_quivermodel -->|"imports parser"| node_quiverparser
node_arrow -->|"uses geometry"| node_curve
node_arrow -->|"builds SVG"| node_dom
node_arrow -->|"uses primitives"| node_ds
node_curve -->|"uses primitives"| node_ds
node_dom -->|"uses primitives"| node_ds

click node_entry "https://github.com/aburousan/hilbert-editor/blob/main/src/main.tsx"
click node_editor "https://github.com/aburousan/hilbert-editor/blob/main/src/App.tsx"
click node_preview "https://github.com/aburousan/hilbert-editor/blob/main/src/components/PdfPreview.tsx"
click node_workspace "https://github.com/aburousan/hilbert-editor/blob/main/src/projectFs.ts"
click node_api "https://github.com/aburousan/hilbert-editor/blob/main/src/api.ts"
click node_server "https://github.com/aburousan/hilbert-editor/blob/main/src-tauri/src/server.rs"
click node_shell "https://github.com/aburousan/hilbert-editor/blob/main/src-tauri/src/main.rs"
click node_code "https://github.com/aburousan/hilbert-editor/blob/main/src-tauri/src/sandbox.rs"
click node_proofread "https://github.com/aburousan/hilbert-editor/blob/main/src-tauri/src/proofread.rs"
click node_language "https://github.com/aburousan/hilbert-editor/blob/main/src-tauri/src/dict_catalog.rs"
click node_builders "https://github.com/aburousan/hilbert-editor/tree/main/src/components"
click node_plots "https://github.com/aburousan/hilbert-editor/blob/main/src/components/PlotStudio.tsx"
click node_citations "https://github.com/aburousan/hilbert-editor/blob/main/src/components/RefManager.tsx"
click node_labelgraph "https://github.com/aburousan/hilbert-editor/blob/main/src/components/LabelGraph.tsx"
click node_slides "https://github.com/aburousan/hilbert-editor/blob/main/src/components/SlideStudio.tsx"
click node_collab "https://github.com/aburousan/hilbert-editor/blob/main/src/projectCollab.ts"
click node_sync "https://github.com/aburousan/hilbert-editor/blob/main/src/workspaceSync.ts"
click node_quiverui "https://github.com/aburousan/hilbert-editor/blob/main/public/quiver/ui.mjs"
click node_quivermodel "https://github.com/aburousan/hilbert-editor/blob/main/public/quiver/quiver.mjs"
click node_quiverparser "https://github.com/aburousan/hilbert-editor/blob/main/public/quiver/parser.mjs"
click node_arrow "https://github.com/aburousan/hilbert-editor/blob/main/public/quiver/arrow.mjs"
click node_curve "https://github.com/aburousan/hilbert-editor/blob/main/public/quiver/curve.mjs"
click node_dom "https://github.com/aburousan/hilbert-editor/blob/main/public/quiver/dom.mjs"
click node_ds "https://github.com/aburousan/hilbert-editor/blob/main/public/quiver/ds.mjs"
click node_katex "https://github.com/aburousan/hilbert-editor/blob/main/public/quiver/KaTeX/katex.mjs"

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_entry,node_editor,node_preview,node_workspace,node_api toneBlue
class node_server,node_shell,node_typst,node_code toneAmber
class node_proofread,node_language,node_builders,node_plots,node_citations,node_labelgraph,node_slides toneMint
class node_collab,node_sync toneRose
class node_quiverui,node_quivermodel,node_quiverparser,node_arrow,node_curve,node_dom,node_ds,node_katex,node_user toneIndigo
```

## Components

### Writing workspace

- [App entry](https://github.com/aburousan/hilbert-editor/blob/main/src/main.tsx): `src/main.tsx`
- [Document editor](https://github.com/aburousan/hilbert-editor/blob/main/src/App.tsx): `src/App.tsx`
- [PDF preview](https://github.com/aburousan/hilbert-editor/blob/main/src/components/PdfPreview.tsx): `src/components/PdfPreview.tsx`
- [Project workspace](https://github.com/aburousan/hilbert-editor/blob/main/src/projectFs.ts): `src/projectFs.ts`
- [Backend API](https://github.com/aburousan/hilbert-editor/blob/main/src/api.ts): `src/api.ts`

### Local services

- [Local backend](https://github.com/aburousan/hilbert-editor/blob/main/src-tauri/src/server.rs): `src-tauri/src/server.rs`
- [Desktop shell](https://github.com/aburousan/hilbert-editor/blob/main/src-tauri/src/main.rs): `src-tauri/src/main.rs`
- **Typst compiler**
- [Code execution](https://github.com/aburousan/hilbert-editor/blob/main/src-tauri/src/sandbox.rs): `src-tauri/src/sandbox.rs`

### Scientific tools

- [Proofreading](https://github.com/aburousan/hilbert-editor/blob/main/src-tauri/src/proofread.rs): `src-tauri/src/proofread.rs`
- [Language support](https://github.com/aburousan/hilbert-editor/blob/main/src-tauri/src/dict_catalog.rs): `src-tauri/src/dict_catalog.rs`
- [Visual builders](https://github.com/aburousan/hilbert-editor/tree/main/src/components): `src/components`
- [Plot studio](https://github.com/aburousan/hilbert-editor/blob/main/src/components/PlotStudio.tsx): `src/components/PlotStudio.tsx`
- [Citation tools](https://github.com/aburousan/hilbert-editor/blob/main/src/components/RefManager.tsx): `src/components/RefManager.tsx`
- [Label graph](https://github.com/aburousan/hilbert-editor/blob/main/src/components/LabelGraph.tsx): `src/components/LabelGraph.tsx`
- [Slide studio](https://github.com/aburousan/hilbert-editor/blob/main/src/components/SlideStudio.tsx): `src/components/SlideStudio.tsx`

### Workspace sharing

- [Live collaboration](https://github.com/aburousan/hilbert-editor/blob/main/src/projectCollab.ts): `src/projectCollab.ts`
- [Drive and WebDAV sync](https://github.com/aburousan/hilbert-editor/blob/main/src/workspaceSync.ts): `src/workspaceSync.ts`

### Quiver diagrams

- [Diagram editor UI](https://github.com/aburousan/hilbert-editor/blob/main/public/quiver/ui.mjs): `public/quiver/ui.mjs`
- [Diagram model](https://github.com/aburousan/hilbert-editor/blob/main/public/quiver/quiver.mjs): `public/quiver/quiver.mjs`
- [TikZ parser](https://github.com/aburousan/hilbert-editor/blob/main/public/quiver/parser.mjs): `public/quiver/parser.mjs`
- [Arrow rendering](https://github.com/aburousan/hilbert-editor/blob/main/public/quiver/arrow.mjs): `public/quiver/arrow.mjs`
- [Curve geometry](https://github.com/aburousan/hilbert-editor/blob/main/public/quiver/curve.mjs): `public/quiver/curve.mjs`
- [DOM utilities](https://github.com/aburousan/hilbert-editor/blob/main/public/quiver/dom.mjs): `public/quiver/dom.mjs`
- [Geometry primitives](https://github.com/aburousan/hilbert-editor/blob/main/public/quiver/ds.mjs): `public/quiver/ds.mjs`
- [KaTeX renderer](https://github.com/aburousan/hilbert-editor/blob/main/public/quiver/KaTeX/katex.mjs): `public/quiver/KaTeX/katex.mjs`

### Other components

- **Writer**

## Connections

- Writer → App entry: opens (evidence: `src/main.tsx`)
- App entry → Document editor: mounts (evidence: `src/main.tsx`)
- Document editor → Backend API: requests (evidence: `src/App.tsx`)
- Backend API → Local backend: calls
- Desktop shell → Local backend: starts (evidence: `src-tauri/src/main.rs`)
- Local backend → Typst compiler: compiles with
- Document editor → PDF preview: updates (evidence: `src/App.tsx`)
- Document editor → Project workspace: edits project
- Document editor → Code execution: runs snippets
- Local backend → Code execution: dispatches execution (evidence: `src-tauri/src/server.rs`)
- Document editor → Proofreading: requests checks
- Proofreading → Language support: uses dictionaries
- Document editor → Visual builders: inserts content (evidence: `src/App.tsx`)
- Document editor → Plot studio: opens (evidence: `src/App.tsx`)
- Document editor → Citation tools: manages references
- Document editor → Label graph: views references
- Document editor → Slide studio: creates decks (evidence: `src/App.tsx`)
- Document editor → Live collaboration: shares projects
- Document editor → Drive and WebDAV sync: syncs workspace
- Diagram editor UI → Arrow rendering: renders arrows (evidence: `public/quiver/ui.mjs`)
- Diagram editor UI → Curve geometry: uses curves (evidence: `public/quiver/ui.mjs`)
- Diagram editor UI → DOM utilities: uses DOM helpers (evidence: `public/quiver/ui.mjs`)
- Diagram editor UI → Geometry primitives: uses primitives (evidence: `public/quiver/ui.mjs`)
- Diagram editor UI → TikZ parser: parses diagrams (evidence: `public/quiver/ui.mjs`)
- Diagram editor UI → Diagram model: uses model (evidence: `public/quiver/ui.mjs`)
- Diagram editor UI → KaTeX renderer: renders math (evidence: `public/quiver/ui.mjs`)
- TikZ parser → Arrow rendering: reads constants (evidence: `public/quiver/parser.mjs`)
- TikZ parser → DOM utilities: uses helpers (evidence: `public/quiver/parser.mjs`)
- TikZ parser → Geometry primitives: uses primitives (evidence: `public/quiver/parser.mjs`)
- TikZ parser → Diagram model: exports diagram (evidence: `public/quiver/parser.mjs`)
- TikZ parser → Diagram editor UI: creates vertices (evidence: `public/quiver/parser.mjs`)
- Diagram model → TikZ parser: imports parser (evidence: `public/quiver/quiver.mjs`)
- Arrow rendering → Curve geometry: uses geometry (evidence: `public/quiver/arrow.mjs`)
- Arrow rendering → DOM utilities: builds SVG (evidence: `public/quiver/arrow.mjs`)
- Arrow rendering → Geometry primitives: uses primitives (evidence: `public/quiver/arrow.mjs`)
- Curve geometry → Geometry primitives: uses primitives (evidence: `public/quiver/curve.mjs`)
- DOM utilities → Geometry primitives: uses primitives (evidence: `public/quiver/dom.mjs`)
