# caiorafael/unitex-poc architecture

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

- Interactive diagram: https://gitdiagram.com/caiorafael/unitex-poc
- Repository: https://github.com/caiorafael/unitex-poc

## Overview

UniTeX is a browser-based LaTeX project editor: users create or open a project, edit and organize its files, then receive a compiled PDF preview or an error log. Project metadata and file contents are stored locally in IndexedDB; compilation runs through BusyTeX/WASM, with TeX Live packages optionally fetched remotely. The graph includes the documented project, file-import, editor, and preview capabilities. Relationships for unsampled implementation details are omitted; edges reflect shown calls or README statements.

Main entry points: [`src/components/Editor.tsx`](https://github.com/caiorafael/unitex-poc/blob/main/src/components/Editor.tsx) (Project editor), [`src/components/Workspace.tsx`](https://github.com/caiorafael/unitex-poc/blob/main/src/components/Workspace.tsx) (Project workspace), [`src/project/files.ts`](https://github.com/caiorafael/unitex-poc/blob/main/src/project/files.ts) (File operations), [`src/App.tsx`](https://github.com/caiorafael/unitex-poc/blob/main/src/App.tsx) (App router)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_projects["Project lifecycle"]
  node_app["App router<br/>[App.tsx]"]
  node_workspace["Project workspace<br/>[Workspace.tsx]"]
  node_library[("Project library<br/>[library.ts]")]
  node_navigation["Hash navigation<br/>[navigation.ts]"]
end

subgraph group_editing["Editing workspace"]
  node_editor["Project editor<br/>[Editor.tsx]"]
  node_filetree["File tree<br/>[FileTree.tsx]"]
  node_filepane["File pane<br/>[FilePane.tsx]"]
  node_latexeditor["LaTeX editor<br/>[LatexEditor.tsx]"]
  node_compilelog["Compile log<br/>[CompileLog.tsx]"]
  node_compileoverlay["Compile overlay<br/>[CompileOverlay.tsx]"]
end

subgraph group_compile["Compile and preview"]
  node_compiler["LaTeX compiler<br/>[compiler.ts]"]
  node_busytex["BusyTeX WASM"]
  node_texlive["TeX Live endpoint"]
  node_pdfpreview["PDF preview<br/>[PdfPreview.tsx]"]
end

subgraph group_domain["Project and language services"]
  node_files["File operations<br/>[files.ts]"]
  node_upload["File import<br/>[upload.ts]"]
  node_defaults["Default project<br/>[defaultProject.ts]"]
  node_types["Project types<br/>[types.ts]"]
  node_monaco["LaTeX highlighting<br/>[monacoLatex.ts]"]
end

node_user(("User"))

node_user -->|"creates or opens"| node_workspace
node_workspace -->|"manages projects"| node_library
node_workspace -->|"seeds project"| node_defaults
node_workspace -->|"infers main file"| node_files
node_workspace -->|"opens project"| node_navigation
node_navigation -->|"updates hash"| node_app
node_app -->|"routes project"| node_editor
node_app -->|"shows workspace"| node_workspace
node_editor -->|"loads and saves"| node_library
node_editor -->|"compiles project"| node_compiler
node_editor -->|"updates files"| node_files
node_editor -->|"renders"| node_filetree
node_editor -->|"renders"| node_filepane
node_editor -->|"renders result"| node_pdfpreview
node_editor -->|"shows errors"| node_compilelog
node_editor -->|"shows compiling"| node_compileoverlay
node_filetree -->|"imports files"| node_upload
node_filetree -->|"builds tree"| node_files
node_filepane -->|"renders editor"| node_latexeditor
node_latexeditor -->|"registers language"| node_monaco
node_compiler -->|"prepares inputs"| node_files
node_compiler -->|"runs XeLaTeX"| node_busytex
node_busytex -.->|"fetches packages"| node_texlive
node_pdfpreview -.->|"receives PDF URL"| node_busytex

click node_app "https://github.com/caiorafael/unitex-poc/blob/main/src/App.tsx"
click node_workspace "https://github.com/caiorafael/unitex-poc/blob/main/src/components/Workspace.tsx"
click node_library "https://github.com/caiorafael/unitex-poc/blob/main/src/project/library.ts"
click node_navigation "https://github.com/caiorafael/unitex-poc/blob/main/src/workspace/navigation.ts"
click node_editor "https://github.com/caiorafael/unitex-poc/blob/main/src/components/Editor.tsx"
click node_filetree "https://github.com/caiorafael/unitex-poc/blob/main/src/components/FileTree.tsx"
click node_filepane "https://github.com/caiorafael/unitex-poc/blob/main/src/components/FilePane.tsx"
click node_latexeditor "https://github.com/caiorafael/unitex-poc/blob/main/src/components/LatexEditor.tsx"
click node_compilelog "https://github.com/caiorafael/unitex-poc/blob/main/src/components/CompileLog.tsx"
click node_compileoverlay "https://github.com/caiorafael/unitex-poc/blob/main/src/components/CompileOverlay.tsx"
click node_files "https://github.com/caiorafael/unitex-poc/blob/main/src/project/files.ts"
click node_upload "https://github.com/caiorafael/unitex-poc/blob/main/src/project/upload.ts"
click node_defaults "https://github.com/caiorafael/unitex-poc/blob/main/src/project/defaultProject.ts"
click node_types "https://github.com/caiorafael/unitex-poc/blob/main/src/project/types.ts"
click node_compiler "https://github.com/caiorafael/unitex-poc/blob/main/src/latex/compiler.ts"
click node_pdfpreview "https://github.com/caiorafael/unitex-poc/blob/main/src/components/PdfPreview.tsx"
click node_monaco "https://github.com/caiorafael/unitex-poc/blob/main/src/latex/monacoLatex.ts"

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_workspace,node_library,node_navigation,node_user toneBlue
class node_editor,node_filetree,node_filepane,node_latexeditor,node_compilelog,node_compileoverlay toneAmber
class node_compiler,node_busytex,node_texlive,node_pdfpreview toneMint
class node_files,node_upload,node_defaults,node_types,node_monaco toneRose
```

## Components

### Project lifecycle

- [App router](https://github.com/caiorafael/unitex-poc/blob/main/src/App.tsx): `src/App.tsx`
- [Project workspace](https://github.com/caiorafael/unitex-poc/blob/main/src/components/Workspace.tsx): `src/components/Workspace.tsx`
- [Project library](https://github.com/caiorafael/unitex-poc/blob/main/src/project/library.ts): `src/project/library.ts`
- [Hash navigation](https://github.com/caiorafael/unitex-poc/blob/main/src/workspace/navigation.ts): `src/workspace/navigation.ts`

### Editing workspace

- [Project editor](https://github.com/caiorafael/unitex-poc/blob/main/src/components/Editor.tsx): `src/components/Editor.tsx`
- [File tree](https://github.com/caiorafael/unitex-poc/blob/main/src/components/FileTree.tsx): `src/components/FileTree.tsx`
- [File pane](https://github.com/caiorafael/unitex-poc/blob/main/src/components/FilePane.tsx): `src/components/FilePane.tsx`
- [LaTeX editor](https://github.com/caiorafael/unitex-poc/blob/main/src/components/LatexEditor.tsx): `src/components/LatexEditor.tsx`
- [Compile log](https://github.com/caiorafael/unitex-poc/blob/main/src/components/CompileLog.tsx): `src/components/CompileLog.tsx`
- [Compile overlay](https://github.com/caiorafael/unitex-poc/blob/main/src/components/CompileOverlay.tsx): `src/components/CompileOverlay.tsx`

### Compile and preview

- [LaTeX compiler](https://github.com/caiorafael/unitex-poc/blob/main/src/latex/compiler.ts): `src/latex/compiler.ts`
- **BusyTeX WASM**
- **TeX Live endpoint**
- [PDF preview](https://github.com/caiorafael/unitex-poc/blob/main/src/components/PdfPreview.tsx): `src/components/PdfPreview.tsx`

### Project and language services

- [File operations](https://github.com/caiorafael/unitex-poc/blob/main/src/project/files.ts): `src/project/files.ts`
- [File import](https://github.com/caiorafael/unitex-poc/blob/main/src/project/upload.ts): `src/project/upload.ts`
- [Default project](https://github.com/caiorafael/unitex-poc/blob/main/src/project/defaultProject.ts): `src/project/defaultProject.ts`
- [Project types](https://github.com/caiorafael/unitex-poc/blob/main/src/project/types.ts): `src/project/types.ts`
- [LaTeX highlighting](https://github.com/caiorafael/unitex-poc/blob/main/src/latex/monacoLatex.ts): `src/latex/monacoLatex.ts`

### Other components

- **User**

## Connections

- User → Project workspace: creates or opens (evidence: `README.md`)
- Project workspace → Project library: manages projects (evidence: `src/components/Workspace.tsx`)
- Project workspace → Default project: seeds project (evidence: `src/components/Workspace.tsx`)
- Project workspace → File operations: infers main file (evidence: `src/components/Workspace.tsx`)
- Project workspace → Hash navigation: opens project (evidence: `src/components/Workspace.tsx`)
- Hash navigation → App router: updates hash (evidence: `src/App.tsx`)
- App router → Project editor: routes project (evidence: `src/App.tsx`)
- App router → Project workspace: shows workspace (evidence: `src/App.tsx`)
- Project editor → Project library: loads and saves (evidence: `src/components/Editor.tsx`)
- Project editor → LaTeX compiler: compiles project (evidence: `src/components/Editor.tsx`)
- Project editor → File operations: updates files (evidence: `src/components/Editor.tsx`)
- Project editor → File tree: renders (evidence: `src/components/Editor.tsx`)
- Project editor → File pane: renders (evidence: `src/components/Editor.tsx`)
- Project editor → PDF preview: renders result (evidence: `src/components/Editor.tsx`)
- Project editor → Compile log: shows errors (evidence: `src/components/Editor.tsx`)
- Project editor → Compile overlay: shows compiling (evidence: `src/components/Editor.tsx`)
- File tree → File import: imports files (evidence: `src/components/FileTree.tsx`)
- File tree → File operations: builds tree (evidence: `src/components/FileTree.tsx`)
- File pane → LaTeX editor: renders editor (evidence: `src/components/FilePane.tsx`)
- LaTeX editor → LaTeX highlighting: registers language (evidence: `src/components/LatexEditor.tsx`)
- LaTeX compiler → File operations: prepares inputs (evidence: `src/latex/compiler.ts`)
- LaTeX compiler → BusyTeX WASM: runs XeLaTeX (evidence: `README.md`)
- BusyTeX WASM → TeX Live endpoint: fetches packages (evidence: `README.md`)
- PDF preview → BusyTeX WASM: receives PDF URL
