# tradicije/librett-desktop architecture

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

- Interactive diagram: https://gitdiagram.com/tradicije/librett-desktop
- Repository: https://github.com/tradicije/librett-desktop

## Overview

LibreTT is an offline-first desktop tournament organizer, currently in early development. The main workflow is to create tournaments and categories, manage players and registrations, handle attendance and fees, then prepare and save category draw drafts. The README also describes planned results, standings, backups, and exports; these are kept separate from implemented workflows. Source excerpts show the frontend API invoking Tauri commands and draw/cash screens using that API. Rust command routing and application-to-storage calls were not shown, so those links are marked unverified.

Main entry points: [`apps/desktop/src/api.ts`](https://github.com/tradicije/librett-desktop/blob/main/apps/desktop/src/api.ts) (Command API), [`apps/desktop/src/App.svelte`](https://github.com/tradicije/librett-desktop/blob/main/apps/desktop/src/App.svelte) (App navigation), [`crates/application/src/lib.rs`](https://github.com/tradicije/librett-desktop/blob/main/crates/application/src/lib.rs) (Application use cases), [`apps/desktop/src/CategoryDetail.svelte`](https://github.com/tradicije/librett-desktop/blob/main/apps/desktop/src/CategoryDetail.svelte) (Category workspace)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop experience"]
  node_app_shell["App navigation<br/>[App.svelte]"]
  node_tournament_workspace["Tournament workspace<br/>[App.svelte]"]
  node_category_workspace["Category workspace"]
  node_player_directory["Player directory"]
  node_player_editor["Player profiles"]
  node_registration_ui["Registration and attendance<br/>[Players.svelte]"]
  node_cash_ui["Cash desk<br/>[CashDesk.svelte]"]
  node_draw_ui["Draw drafts<br/>[Draw.svelte]"]
  node_ui_support["Localization and theme<br/>[i18n.ts]"]
  node_tauri_api["Command API<br/>[api.ts]"]
end

subgraph group_application["Application services"]
  node_tauri_adapter["Desktop command adapter<br/>[main.rs]"]
  node_use_cases["Application use cases<br/>[lib.rs]"]
  node_planned_archive["Backup and data transfer"]
end

subgraph group_domain["Competition domain"]
  node_tournament_domain["Tournament categories<br/>[lib.rs]"]
  node_player_domain["Players and entries<br/>[players.rs]"]
  node_cash_domain["Cash ledger rules<br/>[cash.rs]"]
  node_draw_domain["Draw generation<br/>[draw.rs]"]
  node_planned_results["Results and standings"]
end

subgraph group_persistence["Local persistence"]
  node_sqlite[("SQLite repository<br/>[lib.rs]")]
  node_sqlite_player["Player registration storage<br/>[players.rs]"]
  node_sqlite_cash["Cash history storage<br/>[cash.rs]"]
end

node_organizer(("Organizer"))

node_organizer -->|"uses"| node_app_shell
node_app_shell -->|"navigates"| node_tournament_workspace
node_app_shell -->|"opens"| node_category_workspace
node_app_shell -->|"opens"| node_player_directory
node_app_shell -->|"opens"| node_player_editor
node_app_shell -->|"renders"| node_cash_ui
node_category_workspace -->|"renders"| node_registration_ui
node_category_workspace -->|"renders"| node_draw_ui
node_tournament_workspace -->|"loads data"| node_tauri_api
node_cash_ui -->|"requests ledger"| node_tauri_api
node_draw_ui -->|"saves drafts"| node_tauri_api
node_player_directory -->|"requests players"| node_tauri_api
node_player_editor -->|"saves profiles"| node_tauri_api
node_registration_ui -->|"manages entries"| node_tauri_api
node_tauri_api -->|"invokes commands"| node_tauri_adapter
node_tauri_adapter -.->|"invokes use cases"| node_use_cases
node_use_cases -.->|"applies rules"| node_tournament_domain
node_use_cases -.->|"applies rules"| node_player_domain
node_use_cases -.->|"applies rules"| node_cash_domain
node_use_cases -.->|"generates drafts"| node_draw_domain
node_use_cases -.->|"persists locally"| node_sqlite
node_sqlite -->|"delegates to"| node_sqlite_player
node_sqlite -->|"delegates to"| node_sqlite_cash
node_organizer -.->|"planned workflow"| node_planned_results
node_organizer -.->|"planned workflow"| node_planned_archive

click node_app_shell "https://github.com/tradicije/librett-desktop/blob/main/apps/desktop/src/App.svelte"
click node_tournament_workspace "https://github.com/tradicije/librett-desktop/blob/main/apps/desktop/src/App.svelte"
click node_category_workspace "https://github.com/tradicije/librett-desktop/blob/main/apps/desktop/src/CategoryDetail.svelte"
click node_player_directory "https://github.com/tradicije/librett-desktop/blob/main/apps/desktop/src/PlayerDirectory.svelte"
click node_player_editor "https://github.com/tradicije/librett-desktop/blob/main/apps/desktop/src/PlayerEditor.svelte"
click node_registration_ui "https://github.com/tradicije/librett-desktop/blob/main/apps/desktop/src/Players.svelte"
click node_cash_ui "https://github.com/tradicije/librett-desktop/blob/main/apps/desktop/src/CashDesk.svelte"
click node_draw_ui "https://github.com/tradicije/librett-desktop/blob/main/apps/desktop/src/Draw.svelte"
click node_ui_support "https://github.com/tradicije/librett-desktop/blob/main/apps/desktop/src/i18n.ts"
click node_tauri_api "https://github.com/tradicije/librett-desktop/blob/main/apps/desktop/src/api.ts"
click node_tauri_adapter "https://github.com/tradicije/librett-desktop/blob/main/apps/desktop/src-tauri/src/main.rs"
click node_use_cases "https://github.com/tradicije/librett-desktop/blob/main/crates/application/src/lib.rs"
click node_tournament_domain "https://github.com/tradicije/librett-desktop/blob/main/crates/domain/src/lib.rs"
click node_player_domain "https://github.com/tradicije/librett-desktop/blob/main/crates/domain/src/players.rs"
click node_cash_domain "https://github.com/tradicije/librett-desktop/blob/main/crates/domain/src/cash.rs"
click node_draw_domain "https://github.com/tradicije/librett-desktop/blob/main/crates/domain/src/draw.rs"
click node_sqlite "https://github.com/tradicije/librett-desktop/blob/main/crates/storage-sqlite/src/lib.rs"
click node_sqlite_player "https://github.com/tradicije/librett-desktop/blob/main/crates/storage-sqlite/src/players.rs"
click node_sqlite_cash "https://github.com/tradicije/librett-desktop/blob/main/crates/storage-sqlite/src/cash.rs"
click node_planned_results "https://github.com/tradicije/librett-desktop/tree/main/crates/domain/src"
click node_planned_archive "https://github.com/tradicije/librett-desktop/tree/main/crates/application/src"

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_shell,node_tournament_workspace,node_category_workspace,node_player_directory,node_player_editor,node_registration_ui,node_cash_ui,node_draw_ui,node_ui_support,node_tauri_api toneBlue
class node_tauri_adapter,node_use_cases,node_planned_archive toneAmber
class node_tournament_domain,node_player_domain,node_cash_domain,node_draw_domain,node_planned_results toneMint
class node_sqlite,node_sqlite_player,node_sqlite_cash toneRose
class node_organizer toneIndigo
```

## Components

### Desktop experience

- [App navigation](https://github.com/tradicije/librett-desktop/blob/main/apps/desktop/src/App.svelte): `apps/desktop/src/App.svelte`
- [Tournament workspace](https://github.com/tradicije/librett-desktop/blob/main/apps/desktop/src/App.svelte): `apps/desktop/src/App.svelte`
- [Category workspace](https://github.com/tradicije/librett-desktop/blob/main/apps/desktop/src/CategoryDetail.svelte): `apps/desktop/src/CategoryDetail.svelte`
- [Player directory](https://github.com/tradicije/librett-desktop/blob/main/apps/desktop/src/PlayerDirectory.svelte): `apps/desktop/src/PlayerDirectory.svelte`
- [Player profiles](https://github.com/tradicije/librett-desktop/blob/main/apps/desktop/src/PlayerEditor.svelte): `apps/desktop/src/PlayerEditor.svelte`
- [Registration and attendance](https://github.com/tradicije/librett-desktop/blob/main/apps/desktop/src/Players.svelte): `apps/desktop/src/Players.svelte`
- [Cash desk](https://github.com/tradicije/librett-desktop/blob/main/apps/desktop/src/CashDesk.svelte): `apps/desktop/src/CashDesk.svelte`
- [Draw drafts](https://github.com/tradicije/librett-desktop/blob/main/apps/desktop/src/Draw.svelte): `apps/desktop/src/Draw.svelte`
- [Localization and theme](https://github.com/tradicije/librett-desktop/blob/main/apps/desktop/src/i18n.ts): `apps/desktop/src/i18n.ts`
- [Command API](https://github.com/tradicije/librett-desktop/blob/main/apps/desktop/src/api.ts): `apps/desktop/src/api.ts`

### Application services

- [Desktop command adapter](https://github.com/tradicije/librett-desktop/blob/main/apps/desktop/src-tauri/src/main.rs): `apps/desktop/src-tauri/src/main.rs`
- [Application use cases](https://github.com/tradicije/librett-desktop/blob/main/crates/application/src/lib.rs): `crates/application/src/lib.rs`
- [Backup and data transfer](https://github.com/tradicije/librett-desktop/tree/main/crates/application/src): `crates/application/src`

### Competition domain

- [Tournament categories](https://github.com/tradicije/librett-desktop/blob/main/crates/domain/src/lib.rs): `crates/domain/src/lib.rs`
- [Players and entries](https://github.com/tradicije/librett-desktop/blob/main/crates/domain/src/players.rs): `crates/domain/src/players.rs`
- [Cash ledger rules](https://github.com/tradicije/librett-desktop/blob/main/crates/domain/src/cash.rs): `crates/domain/src/cash.rs`
- [Draw generation](https://github.com/tradicije/librett-desktop/blob/main/crates/domain/src/draw.rs): `crates/domain/src/draw.rs`
- [Results and standings](https://github.com/tradicije/librett-desktop/tree/main/crates/domain/src): `crates/domain/src`

### Local persistence

- [SQLite repository](https://github.com/tradicije/librett-desktop/blob/main/crates/storage-sqlite/src/lib.rs): `crates/storage-sqlite/src/lib.rs`
- [Player registration storage](https://github.com/tradicije/librett-desktop/blob/main/crates/storage-sqlite/src/players.rs): `crates/storage-sqlite/src/players.rs`
- [Cash history storage](https://github.com/tradicije/librett-desktop/blob/main/crates/storage-sqlite/src/cash.rs): `crates/storage-sqlite/src/cash.rs`

### Other components

- **Organizer**

## Connections

- Organizer → App navigation: uses (evidence: `README.md`)
- App navigation → Tournament workspace: navigates (evidence: `apps/desktop/src/App.svelte`)
- App navigation → Category workspace: opens (evidence: `apps/desktop/src/App.svelte`)
- App navigation → Player directory: opens (evidence: `apps/desktop/src/App.svelte`)
- App navigation → Player profiles: opens (evidence: `apps/desktop/src/App.svelte`)
- App navigation → Cash desk: renders (evidence: `apps/desktop/src/App.svelte`)
- Category workspace → Registration and attendance: renders (evidence: `apps/desktop/src/CategoryDetail.svelte`)
- Category workspace → Draw drafts: renders (evidence: `apps/desktop/src/CategoryDetail.svelte`)
- Tournament workspace → Command API: loads data (evidence: `apps/desktop/src/App.svelte`)
- Cash desk → Command API: requests ledger (evidence: `apps/desktop/src/CashDesk.svelte`)
- Draw drafts → Command API: saves drafts (evidence: `apps/desktop/src/Draw.svelte`)
- Player directory → Command API: requests players (evidence: `apps/desktop/src/PlayerDirectory.svelte`)
- Player profiles → Command API: saves profiles (evidence: `apps/desktop/src/PlayerEditor.svelte`)
- Registration and attendance → Command API: manages entries (evidence: `apps/desktop/src/Players.svelte`)
- Command API → Desktop command adapter: invokes commands (evidence: `README.md`)
- Desktop command adapter → Application use cases: invokes use cases
- Application use cases → Tournament categories: applies rules
- Application use cases → Players and entries: applies rules
- Application use cases → Cash ledger rules: applies rules
- Application use cases → Draw generation: generates drafts
- Application use cases → SQLite repository: persists locally
- SQLite repository → Player registration storage: delegates to (evidence: `crates/storage-sqlite/src/lib.rs`)
- SQLite repository → Cash history storage: delegates to (evidence: `crates/storage-sqlite/src/lib.rs`)
- Organizer → Results and standings: planned workflow (evidence: `README.md`)
- Organizer → Backup and data transfer: planned workflow (evidence: `README.md`)
