# ifanoxy/raytex architecture

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

- Interactive diagram: https://gitdiagram.com/ifanoxy/raytex
- Repository: https://github.com/ifanoxy/raytex

## Overview

RayTeX is a cross-platform LaTeX IDE. The user edits a project in the Svelte desktop UI; the UI sends typed requests over Tauri IPC to Rust commands and core services, which manage project files, compile documents, and return PDF and diagnostics for display. The graph also preserves documented editing, completion, package-management, preview, and navigation capabilities. Several Rust command handlers and UI modules were not sampled, so their detailed call relationships are omitted or marked unverified.

Main entry points: [`crates/raytex-core/src/preview.rs`](https://github.com/ifanoxy/raytex/blob/main/crates/raytex-core/src/preview.rs) (Document build), [`ui/App.svelte`](https://github.com/ifanoxy/raytex/blob/main/ui/App.svelte) (Application shell), [`ui/lib/state/editor.svelte.ts`](https://github.com/ifanoxy/raytex/blob/main/ui/lib/state/editor.svelte.ts) (Editor and tools), [`crates/raytex-desktop/src/commands`](https://github.com/ifanoxy/raytex/tree/main/crates/raytex-desktop/src/commands) (Desktop commands)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Desktop interface"]
  node_app["Application shell<br/>[App.svelte]"]
  node_editor["Editor and tools<br/>[editor.svelte.ts]"]
  node_pdfviewer["PDF viewer<br/>[PdfViewer.svelte]"]
  node_ipc["Typed IPC<br/>[ipc.ts]"]
  node_commands["Desktop commands"]
end

subgraph group_editing["Writing and analysis"]
  node_completion["Context completion<br/>[keys.rs]"]
  node_syntax["Syntax analysis<br/>[scanner.rs]"]
  node_diagnostics["Diagnostics and fixes<br/>[diagnostics.rs]"]
  node_fixes["Quick fixes<br/>[latex.rs]"]
  node_knowledge[("LaTeX knowledge base<br/>[kb.rs]")]
end

subgraph group_projects["Projects and TeX"]
  node_workspace["Project workspace<br/>[workspace.rs]"]
  node_settings["Project settings<br/>[settings.rs]"]
  node_templates["Project templates<br/>[templates.rs]"]
  node_texdetect["TeX discovery<br/>[discovery.rs]"]
  node_texindex["Package indexing<br/>[texmf.rs]"]
  node_texmanager["TeX management<br/>[manager.rs]"]
end

subgraph group_rendering["Build and preview"]
  node_build["Document build<br/>[preview.rs]"]
  node_process["Process execution<br/>[process.rs]"]
  node_logs["Compiler log parsing<br/>[mod.rs]"]
  node_sync["SyncTeX navigation<br/>[synctex.rs]"]
  node_pdf["PDF document"]
end

node_user(("LaTeX author"))
node_compiler["TeX distribution"]

node_user -->|"edits in"| node_app
node_app -->|"hosts"| node_editor
node_app -->|"hosts"| node_pdfviewer
node_editor -.->|"requests services"| node_ipc
node_app -->|"sends requests"| node_ipc
node_ipc -->|"invokes commands"| node_commands
node_commands -.->|"manages projects"| node_workspace
node_commands -.->|"requests builds"| node_build
node_commands -.->|"manages packages"| node_texmanager
node_workspace -->|"indexes documents"| node_syntax
node_editor -->|"offers completion"| node_completion
node_completion -->|"learns package commands"| node_texindex
node_completion -->|"uses documentation"| node_knowledge
node_workspace -->|"uses project settings"| node_settings
node_editor -->|"shows problems"| node_diagnostics
node_diagnostics -->|"offers quick fixes"| node_fixes
node_build -->|"runs compiler"| node_process
node_compiler -->|"compiles document"| node_build
node_build -->|"parses build log"| node_logs
node_build -->|"produces PDF"| node_pdf
node_pdfviewer -->|"renders PDF"| node_pdf
node_pdfviewer -->|"supports source sync"| node_sync
node_workspace -.->|"applies templates"| node_templates
node_texmanager -->|"uses distribution detection"| node_texdetect
node_texmanager -->|"plans install commands"| node_process

click node_app "https://github.com/ifanoxy/raytex/blob/main/ui/App.svelte"
click node_editor "https://github.com/ifanoxy/raytex/blob/main/ui/lib/state/editor.svelte.ts"
click node_pdfviewer "https://github.com/ifanoxy/raytex/blob/main/ui/components/pdf/PdfViewer.svelte"
click node_ipc "https://github.com/ifanoxy/raytex/blob/main/ui/lib/ipc.ts"
click node_commands "https://github.com/ifanoxy/raytex/tree/main/crates/raytex-desktop/src/commands"
click node_workspace "https://github.com/ifanoxy/raytex/blob/main/crates/raytex-core/src/workspace.rs"
click node_settings "https://github.com/ifanoxy/raytex/blob/main/crates/raytex-core/src/settings.rs"
click node_templates "https://github.com/ifanoxy/raytex/blob/main/crates/raytex-core/src/templates.rs"
click node_texdetect "https://github.com/ifanoxy/raytex/blob/main/crates/raytex-core/src/tex/discovery.rs"
click node_texindex "https://github.com/ifanoxy/raytex/blob/main/crates/raytex-core/src/tex/texmf.rs"
click node_texmanager "https://github.com/ifanoxy/raytex/blob/main/crates/raytex-core/src/tex/manager.rs"
click node_completion "https://github.com/ifanoxy/raytex/blob/main/crates/raytex-core/src/completion/keys.rs"
click node_syntax "https://github.com/ifanoxy/raytex/blob/main/crates/raytex-core/src/syntax/scanner.rs"
click node_diagnostics "https://github.com/ifanoxy/raytex/blob/main/crates/raytex-core/src/diagnostics.rs"
click node_fixes "https://github.com/ifanoxy/raytex/blob/main/crates/raytex-core/src/fixes/latex.rs"
click node_knowledge "https://github.com/ifanoxy/raytex/blob/main/crates/raytex-core/src/kb.rs"
click node_build "https://github.com/ifanoxy/raytex/blob/main/crates/raytex-core/src/preview.rs"
click node_process "https://github.com/ifanoxy/raytex/blob/main/crates/raytex-core/src/process.rs"
click node_logs "https://github.com/ifanoxy/raytex/blob/main/crates/raytex-core/src/log/mod.rs"
click node_sync "https://github.com/ifanoxy/raytex/blob/main/crates/raytex-core/src/synctex.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_editor,node_pdfviewer,node_ipc,node_commands toneBlue
class node_completion,node_syntax,node_diagnostics,node_fixes,node_knowledge toneAmber
class node_workspace,node_settings,node_templates,node_texdetect,node_texindex,node_texmanager toneMint
class node_build,node_process,node_logs,node_sync,node_pdf toneRose
class node_user,node_compiler toneIndigo
```

## Components

### Desktop interface

- [Application shell](https://github.com/ifanoxy/raytex/blob/main/ui/App.svelte): `ui/App.svelte`
- [Editor and tools](https://github.com/ifanoxy/raytex/blob/main/ui/lib/state/editor.svelte.ts): `ui/lib/state/editor.svelte.ts`
- [PDF viewer](https://github.com/ifanoxy/raytex/blob/main/ui/components/pdf/PdfViewer.svelte): `ui/components/pdf/PdfViewer.svelte`
- [Typed IPC](https://github.com/ifanoxy/raytex/blob/main/ui/lib/ipc.ts): `ui/lib/ipc.ts`
- [Desktop commands](https://github.com/ifanoxy/raytex/tree/main/crates/raytex-desktop/src/commands): `crates/raytex-desktop/src/commands`

### Writing and analysis

- [Context completion](https://github.com/ifanoxy/raytex/blob/main/crates/raytex-core/src/completion/keys.rs): `crates/raytex-core/src/completion/keys.rs`
- [Syntax analysis](https://github.com/ifanoxy/raytex/blob/main/crates/raytex-core/src/syntax/scanner.rs): `crates/raytex-core/src/syntax/scanner.rs`
- [Diagnostics and fixes](https://github.com/ifanoxy/raytex/blob/main/crates/raytex-core/src/diagnostics.rs): `crates/raytex-core/src/diagnostics.rs`
- [Quick fixes](https://github.com/ifanoxy/raytex/blob/main/crates/raytex-core/src/fixes/latex.rs): `crates/raytex-core/src/fixes/latex.rs`
- [LaTeX knowledge base](https://github.com/ifanoxy/raytex/blob/main/crates/raytex-core/src/kb.rs): `crates/raytex-core/src/kb.rs`

### Projects and TeX

- [Project workspace](https://github.com/ifanoxy/raytex/blob/main/crates/raytex-core/src/workspace.rs): `crates/raytex-core/src/workspace.rs`
- [Project settings](https://github.com/ifanoxy/raytex/blob/main/crates/raytex-core/src/settings.rs): `crates/raytex-core/src/settings.rs`
- [Project templates](https://github.com/ifanoxy/raytex/blob/main/crates/raytex-core/src/templates.rs): `crates/raytex-core/src/templates.rs`
- [TeX discovery](https://github.com/ifanoxy/raytex/blob/main/crates/raytex-core/src/tex/discovery.rs): `crates/raytex-core/src/tex/discovery.rs`
- [Package indexing](https://github.com/ifanoxy/raytex/blob/main/crates/raytex-core/src/tex/texmf.rs): `crates/raytex-core/src/tex/texmf.rs`
- [TeX management](https://github.com/ifanoxy/raytex/blob/main/crates/raytex-core/src/tex/manager.rs): `crates/raytex-core/src/tex/manager.rs`

### Build and preview

- [Document build](https://github.com/ifanoxy/raytex/blob/main/crates/raytex-core/src/preview.rs): `crates/raytex-core/src/preview.rs`
- [Process execution](https://github.com/ifanoxy/raytex/blob/main/crates/raytex-core/src/process.rs): `crates/raytex-core/src/process.rs`
- [Compiler log parsing](https://github.com/ifanoxy/raytex/blob/main/crates/raytex-core/src/log/mod.rs): `crates/raytex-core/src/log/mod.rs`
- [SyncTeX navigation](https://github.com/ifanoxy/raytex/blob/main/crates/raytex-core/src/synctex.rs): `crates/raytex-core/src/synctex.rs`
- **PDF document**

### Other components

- **LaTeX author**
- **TeX distribution**

## Connections

- LaTeX author → Application shell: edits in (evidence: `README.md`)
- Application shell → Editor and tools: hosts (evidence: `ui/App.svelte`)
- Application shell → PDF viewer: hosts (evidence: `ui/App.svelte`)
- Editor and tools → Typed IPC: requests services (evidence: `ui/lib/state/editor.svelte.ts`)
- Application shell → Typed IPC: sends requests (evidence: `ui/App.svelte`)
- Typed IPC → Desktop commands: invokes commands (evidence: `ui/lib/ipc.ts`)
- Desktop commands → Project workspace: manages projects
- Desktop commands → Document build: requests builds
- Desktop commands → TeX management: manages packages
- Project workspace → Syntax analysis: indexes documents (evidence: `crates/raytex-core/src/workspace.rs`)
- Editor and tools → Context completion: offers completion (evidence: `README.md`)
- Context completion → Package indexing: learns package commands (evidence: `crates/raytex-core/src/completion/keys.rs`)
- Context completion → LaTeX knowledge base: uses documentation (evidence: `crates/raytex-core/src/completion/mod.rs`)
- Project workspace → Project settings: uses project settings (evidence: `crates/raytex-core/src/workspace.rs`)
- Editor and tools → Diagnostics and fixes: shows problems (evidence: `README.md`)
- Diagnostics and fixes → Quick fixes: offers quick fixes (evidence: `README.md`)
- Document build → Process execution: runs compiler (evidence: `crates/raytex-core/src/preview.rs`)
- TeX distribution → Document build: compiles document (evidence: `README.md`)
- Document build → Compiler log parsing: parses build log (evidence: `crates/raytex-core/src/preview.rs`)
- Document build → PDF document: produces PDF (evidence: `README.md`)
- PDF viewer → PDF document: renders PDF (evidence: `README.md`)
- PDF viewer → SyncTeX navigation: supports source sync (evidence: `README.md`)
- Project workspace → Project templates: applies templates
- TeX management → TeX discovery: uses distribution detection (evidence: `crates/raytex-core/src/tex/manager.rs`)
- TeX management → Process execution: plans install commands (evidence: `crates/raytex-core/src/tex/manager.rs`)
