# l9djulo/dalia-reloaded architecture

> Architecture diagram of the GitHub repository l9djulo/dalia-reloaded, 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/l9djulo/dalia-reloaded
- Repository: https://github.com/l9djulo/dalia-reloaded

## Overview

DALIA is a League of Legends draft assistant: the user connects a live League champion-select session or enters picks and bans manually, then receives pool-aware champion recommendations with matchup, composition, mastery and interaction reasoning. The React/Tauri client coordinates draft state and calls a FastAPI service; the service scores candidates and persists user data in PostgreSQL. Separate capabilities cover pool advice, replays/history, duo coordination and optional model training. Some backend subsystems are represented by their documented directory because their implementation was not sampled.

Main entry points: [`server/app/db/session.py`](https://github.com/l9djulo/dalia-reloaded/blob/main/server/app/db/session.py) (Database sessions), [`server/app/api/routes.py`](https://github.com/l9djulo/dalia-reloaded/blob/main/server/app/api/routes.py) (API routes), [`client/src/App.jsx`](https://github.com/l9djulo/dalia-reloaded/blob/main/client/src/App.jsx) (Application shell), [`client/src/components/Draft/DraftScreen.jsx`](https://github.com/l9djulo/dalia-reloaded/blob/main/client/src/components/Draft/DraftScreen.jsx) (Draft workspace)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Draft client"]
  node_app["Application shell<br/>[App.jsx]"]
  node_draft_ui["Draft workspace<br/>[DraftScreen.jsx]"]
  node_draft_state["Draft state<br/>[draftStore.js]"]
  node_session["Session sync<br/>[draftSession.js]"]
  node_lcu["LCU connector<br/>[lcu.rs]"]
  node_api_client["HTTP client<br/>[api.js]"]
  node_pool_ui["Pool editor"]
  node_duo_ui["Duo panel<br/>[DuoPanel.jsx]"]
  node_history_ui["History and replay<br/>[HistoryPage.jsx]"]
  node_auth_ui["Sign-in<br/>[AuthPage.jsx]"]
end

subgraph group_analysis["Draft analysis"]
  node_engine["Recommendation engine<br/>[draft_engine.py]"]
  node_scoring["Scoring terms"]
  node_pool_advisor["Pool advisor<br/>[pool_advisor.py]"]
  node_champions["Champion catalog<br/>[champion_data.py]"]
  node_data_fetch["Game data fetcher<br/>[data_fetcher.py]"]
  node_personal["Personal statistics<br/>[personal_stats.py]"]
end

subgraph group_account["Accounts and history"]
  node_duo_routes["Duo routes<br/>[duo_routes.py]"]
  node_history_routes["History routes<br/>[history_routes.py]"]
  node_db_models[("Account and draft records<br/>[models.py]")]
end

subgraph group_platform["Server platform"]
  node_routes["API routes<br/>[routes.py]"]
  node_auth_routes["Auth routes<br/>[auth_routes.py]"]
  node_user_routes["User routes<br/>[user_routes.py]"]
  node_auth_deps["Token authentication<br/>[deps.py]"]
  node_db_session["Database sessions<br/>[session.py]"]
end

subgraph group_ml["Model lifecycle"]
  node_ml["Model training and prediction"]
  node_watcher["Patch model watcher<br/>[patch_watcher.py]"]
end

node_player(("Player"))
node_league["League client"]
node_postgres[("PostgreSQL")]
node_riot["Riot API"]

node_player -->|"uses"| node_app
node_league -->|"champion select"| node_lcu
node_app -->|"renders"| node_draft_ui
node_app -->|"starts session"| node_session
node_session -->|"updates"| node_draft_state
node_session -.->|"reads selection"| node_lcu
node_draft_ui -.->|"uses"| node_draft_state
node_draft_ui -.->|"requests advice"| node_api_client
node_api_client -->|"HTTP requests"| node_routes
node_auth_ui -->|"signs in"| node_auth_routes
node_pool_ui -.->|"manages pool"| node_user_routes
node_duo_ui -.->|"manages duo"| node_duo_routes
node_history_ui -->|"loads replays"| node_history_routes
node_routes -->|"recommends"| node_engine
node_engine -->|"aggregates terms"| node_scoring
node_engine -->|"loads champion data"| node_champions
node_champions -->|"fetches data"| node_data_fetch
node_data_fetch -.->|"fetches game data"| node_riot
node_routes -->|"diagnoses pool"| node_pool_advisor
node_routes -->|"resolves user"| node_auth_deps
node_auth_routes -->|"opens session"| node_db_session
node_user_routes -->|"opens session"| node_db_session
node_duo_routes -->|"opens session"| node_db_session
node_history_routes -->|"opens session"| node_db_session
node_auth_deps -->|"loads user"| node_db_session
node_db_session -->|"queries"| node_postgres
node_db_models -->|"maps records"| node_postgres
node_history_routes -->|"reads and writes"| node_db_models
node_duo_routes -->|"manages links"| node_db_models
node_routes -->|"fetches player stats"| node_personal
node_personal -->|"requests statistics"| node_riot
node_watcher -.->|"checks model"| node_ml
node_ml -.->|"collects match data"| node_riot

click node_app "https://github.com/l9djulo/dalia-reloaded/blob/main/client/src/App.jsx"
click node_draft_ui "https://github.com/l9djulo/dalia-reloaded/blob/main/client/src/components/Draft/DraftScreen.jsx"
click node_draft_state "https://github.com/l9djulo/dalia-reloaded/blob/main/client/src/stores/draftStore.js"
click node_session "https://github.com/l9djulo/dalia-reloaded/blob/main/client/src/services/draftSession.js"
click node_lcu "https://github.com/l9djulo/dalia-reloaded/blob/main/client/src-tauri/src/lcu.rs"
click node_api_client "https://github.com/l9djulo/dalia-reloaded/blob/main/client/src/services/api.js"
click node_pool_ui "https://github.com/l9djulo/dalia-reloaded/blob/main/client/src/components/ChampionPool/ChampionPoolEditor.jsx"
click node_duo_ui "https://github.com/l9djulo/dalia-reloaded/blob/main/client/src/components/DuoQ/DuoPanel.jsx"
click node_history_ui "https://github.com/l9djulo/dalia-reloaded/blob/main/client/src/components/HistoryPage.jsx"
click node_auth_ui "https://github.com/l9djulo/dalia-reloaded/blob/main/client/src/components/Auth/AuthPage.jsx"
click node_routes "https://github.com/l9djulo/dalia-reloaded/blob/main/server/app/api/routes.py"
click node_auth_routes "https://github.com/l9djulo/dalia-reloaded/blob/main/server/app/api/auth_routes.py"
click node_user_routes "https://github.com/l9djulo/dalia-reloaded/blob/main/server/app/api/user_routes.py"
click node_duo_routes "https://github.com/l9djulo/dalia-reloaded/blob/main/server/app/api/duo_routes.py"
click node_history_routes "https://github.com/l9djulo/dalia-reloaded/blob/main/server/app/api/history_routes.py"
click node_engine "https://github.com/l9djulo/dalia-reloaded/blob/main/server/app/services/draft_engine.py"
click node_scoring "https://github.com/l9djulo/dalia-reloaded/tree/main/server/app/scoring"
click node_pool_advisor "https://github.com/l9djulo/dalia-reloaded/blob/main/server/app/services/pool_advisor.py"
click node_champions "https://github.com/l9djulo/dalia-reloaded/blob/main/server/app/services/champion_data.py"
click node_data_fetch "https://github.com/l9djulo/dalia-reloaded/blob/main/server/app/services/data_fetcher.py"
click node_personal "https://github.com/l9djulo/dalia-reloaded/blob/main/server/app/services/personal_stats.py"
click node_auth_deps "https://github.com/l9djulo/dalia-reloaded/blob/main/server/app/auth/deps.py"
click node_db_session "https://github.com/l9djulo/dalia-reloaded/blob/main/server/app/db/session.py"
click node_db_models "https://github.com/l9djulo/dalia-reloaded/blob/main/server/app/db/models.py"
click node_ml "https://github.com/l9djulo/dalia-reloaded/tree/main/server/app/ml"
click node_watcher "https://github.com/l9djulo/dalia-reloaded/blob/main/server/app/ml/patch_watcher.py"

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_draft_ui,node_draft_state,node_session,node_lcu,node_api_client,node_pool_ui,node_duo_ui,node_history_ui,node_auth_ui,node_league toneBlue
class node_engine,node_scoring,node_pool_advisor,node_champions,node_data_fetch,node_personal,node_postgres toneAmber
class node_duo_routes,node_history_routes,node_db_models,node_riot toneMint
class node_routes,node_auth_routes,node_user_routes,node_auth_deps,node_db_session toneRose
class node_ml,node_watcher,node_player toneIndigo
```

## Components

### Draft client

- [Application shell](https://github.com/l9djulo/dalia-reloaded/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Draft workspace](https://github.com/l9djulo/dalia-reloaded/blob/main/client/src/components/Draft/DraftScreen.jsx): `client/src/components/Draft/DraftScreen.jsx`
- [Draft state](https://github.com/l9djulo/dalia-reloaded/blob/main/client/src/stores/draftStore.js): `client/src/stores/draftStore.js`
- [Session sync](https://github.com/l9djulo/dalia-reloaded/blob/main/client/src/services/draftSession.js): `client/src/services/draftSession.js`
- [LCU connector](https://github.com/l9djulo/dalia-reloaded/blob/main/client/src-tauri/src/lcu.rs): `client/src-tauri/src/lcu.rs`
- [HTTP client](https://github.com/l9djulo/dalia-reloaded/blob/main/client/src/services/api.js): `client/src/services/api.js`
- [Pool editor](https://github.com/l9djulo/dalia-reloaded/blob/main/client/src/components/ChampionPool/ChampionPoolEditor.jsx): `client/src/components/ChampionPool/ChampionPoolEditor.jsx`
- [Duo panel](https://github.com/l9djulo/dalia-reloaded/blob/main/client/src/components/DuoQ/DuoPanel.jsx): `client/src/components/DuoQ/DuoPanel.jsx`
- [History and replay](https://github.com/l9djulo/dalia-reloaded/blob/main/client/src/components/HistoryPage.jsx): `client/src/components/HistoryPage.jsx`
- [Sign-in](https://github.com/l9djulo/dalia-reloaded/blob/main/client/src/components/Auth/AuthPage.jsx): `client/src/components/Auth/AuthPage.jsx`

### Draft analysis

- [Recommendation engine](https://github.com/l9djulo/dalia-reloaded/blob/main/server/app/services/draft_engine.py): `server/app/services/draft_engine.py`
- [Scoring terms](https://github.com/l9djulo/dalia-reloaded/tree/main/server/app/scoring): `server/app/scoring`
- [Pool advisor](https://github.com/l9djulo/dalia-reloaded/blob/main/server/app/services/pool_advisor.py): `server/app/services/pool_advisor.py`
- [Champion catalog](https://github.com/l9djulo/dalia-reloaded/blob/main/server/app/services/champion_data.py): `server/app/services/champion_data.py`
- [Game data fetcher](https://github.com/l9djulo/dalia-reloaded/blob/main/server/app/services/data_fetcher.py): `server/app/services/data_fetcher.py`
- [Personal statistics](https://github.com/l9djulo/dalia-reloaded/blob/main/server/app/services/personal_stats.py): `server/app/services/personal_stats.py`

### Accounts and history

- [Duo routes](https://github.com/l9djulo/dalia-reloaded/blob/main/server/app/api/duo_routes.py): `server/app/api/duo_routes.py`
- [History routes](https://github.com/l9djulo/dalia-reloaded/blob/main/server/app/api/history_routes.py): `server/app/api/history_routes.py`
- [Account and draft records](https://github.com/l9djulo/dalia-reloaded/blob/main/server/app/db/models.py): `server/app/db/models.py`

### Server platform

- [API routes](https://github.com/l9djulo/dalia-reloaded/blob/main/server/app/api/routes.py): `server/app/api/routes.py`
- [Auth routes](https://github.com/l9djulo/dalia-reloaded/blob/main/server/app/api/auth_routes.py): `server/app/api/auth_routes.py`
- [User routes](https://github.com/l9djulo/dalia-reloaded/blob/main/server/app/api/user_routes.py): `server/app/api/user_routes.py`
- [Token authentication](https://github.com/l9djulo/dalia-reloaded/blob/main/server/app/auth/deps.py): `server/app/auth/deps.py`
- [Database sessions](https://github.com/l9djulo/dalia-reloaded/blob/main/server/app/db/session.py): `server/app/db/session.py`

### Model lifecycle

- [Model training and prediction](https://github.com/l9djulo/dalia-reloaded/tree/main/server/app/ml): `server/app/ml`
- [Patch model watcher](https://github.com/l9djulo/dalia-reloaded/blob/main/server/app/ml/patch_watcher.py): `server/app/ml/patch_watcher.py`

### Other components

- **Player**
- **League client**
- **PostgreSQL**
- **Riot API**

## Connections

- Player → Application shell: uses
- League client → LCU connector: champion select
- Application shell → Draft workspace: renders (evidence: `client/src/App.jsx`)
- Application shell → Session sync: starts session (evidence: `client/src/App.jsx`)
- Session sync → Draft state: updates (evidence: `client/src/services/draftSession.js`)
- Session sync → LCU connector: reads selection
- Draft workspace → Draft state: uses
- Draft workspace → HTTP client: requests advice
- HTTP client → API routes: HTTP requests
- Sign-in → Auth routes: signs in
- Pool editor → User routes: manages pool
- Duo panel → Duo routes: manages duo
- History and replay → History routes: loads replays
- API routes → Recommendation engine: recommends (evidence: `server/app/api/routes.py`)
- Recommendation engine → Scoring terms: aggregates terms (evidence: `server/app/services/draft_engine.py`)
- Recommendation engine → Champion catalog: loads champion data (evidence: `server/app/services/draft_engine.py`)
- Champion catalog → Game data fetcher: fetches data (evidence: `server/app/services/champion_data.py`)
- Game data fetcher → Riot API: fetches game data
- API routes → Pool advisor: diagnoses pool (evidence: `server/app/api/routes.py`)
- API routes → Token authentication: resolves user (evidence: `server/app/api/routes.py`)
- Auth routes → Database sessions: opens session (evidence: `server/app/api/auth_routes.py`)
- User routes → Database sessions: opens session (evidence: `server/app/api/user_routes.py`)
- Duo routes → Database sessions: opens session (evidence: `server/app/api/duo_routes.py`)
- History routes → Database sessions: opens session (evidence: `server/app/api/history_routes.py`)
- Token authentication → Database sessions: loads user (evidence: `server/app/auth/deps.py`)
- Database sessions → PostgreSQL: queries (evidence: `server/app/db/session.py`)
- Account and draft records → PostgreSQL: maps records (evidence: `server/app/db/models.py`)
- History routes → Account and draft records: reads and writes (evidence: `server/app/api/history_routes.py`)
- Duo routes → Account and draft records: manages links (evidence: `server/app/api/duo_routes.py`)
- API routes → Personal statistics: fetches player stats (evidence: `server/app/api/routes.py`)
- Personal statistics → Riot API: requests statistics
- Patch model watcher → Model training and prediction: checks model
- Model training and prediction → Riot API: collects match data
