# trantrien1/lichess-workspace architecture

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

- Interactive diagram: https://gitdiagram.com/trantrien1/lichess-workspace
- Repository: https://github.com/trantrien1/lichess-workspace

## Overview

This workspace combines the Lichess chess platform with three documented additions: live win-probability estimates, Vietnamese spoken commentary, and daily practice goals. The main user workflow runs through Lila’s web interface and domain modules, with optional Python services supplying engine analysis and commentary; daily goals use Lila’s existing completion events. The repository also includes the chessboard UI, chess rules library, WebSocket server, and Fishnet analysis workers. Edges for the added features follow the README; sampled excerpts do not expose all runtime wiring.

Main entry points: [`lila/ui`](https://github.com/trantrien1/lichess-workspace/tree/main/lila/ui) (Web interface), [`lila/app`](https://github.com/trantrien1/lichess-workspace/tree/main/lila/app) (Web platform), [`lila-ws/src/main/scala`](https://github.com/trantrien1/lichess-workspace/tree/main/lila-ws/src/main/scala) (WebSocket server), [`services/prediction/app/main.py`](https://github.com/trantrien1/lichess-workspace/blob/main/services/prediction/app/main.py) (Position evaluator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Lila platform"]
  node_lila["Web platform"]
  node_ui["Web interface"]
  node_board["Chessboard UI"]
  node_rules["Chess rules"]
  node_ws["WebSocket server"]
end

subgraph group_features["User features"]
  node_winfeature["Win probability"]
  node_prediction["Position evaluator<br/>[main.py]"]
  node_commentaryfeature["Vietnamese commentary"]
  node_commentary["Commentary service<br/>[app.py]"]
  node_phrases["Commentary phrases<br/>[phrases.py]"]
  node_dailygoal["Daily practice goals"]
end

subgraph group_engines["Chess engines"]
  node_fishnetbridge["Analysis coordinator<br/>[Executor.scala]"]
  node_fishnet["Fishnet worker<br/>[main.rs]"]
  node_stockfish["Stockfish engine<br/>[engine.cpp]"]
end

subgraph group_realtime["Realtime services"]
  node_liveclients["Realtime clients<br/>[Controller.scala]"]
end

node_player(("Player"))

node_player -->|"uses"| node_lila
node_lila -->|"serves"| node_ui
node_ui -.->|"renders board"| node_board
node_ui -->|"shows estimates"| node_winfeature
node_winfeature -->|"requests evaluation"| node_prediction
node_ui -->|"offers commentary"| node_commentaryfeature
node_commentaryfeature -->|"sends game state"| node_commentary
node_commentary -->|"uses phrases"| node_phrases
node_player -->|"sets goals"| node_dailygoal
node_dailygoal -->|"shows progress"| node_ui
node_lila -->|"uses realtime"| node_ws
node_ws -->|"routes sockets"| node_liveclients
node_fishnetbridge -->|"dispatches work"| node_fishnet
node_fishnet -.->|"runs engine"| node_stockfish
node_lila -.->|"uses chess rules"| node_rules
node_prediction -->|"evaluates positions"| node_stockfish

click node_lila "https://github.com/trantrien1/lichess-workspace/tree/main/lila/app"
click node_ui "https://github.com/trantrien1/lichess-workspace/tree/main/lila/ui"
click node_board "https://github.com/trantrien1/lichess-workspace/tree/main/chessground/src"
click node_rules "https://github.com/trantrien1/lichess-workspace/tree/main/scalachess/core/src/main/scala"
click node_ws "https://github.com/trantrien1/lichess-workspace/tree/main/lila-ws/src/main/scala"
click node_winfeature "https://github.com/trantrien1/lichess-workspace/tree/main/lila/ui"
click node_prediction "https://github.com/trantrien1/lichess-workspace/blob/main/services/prediction/app/main.py"
click node_commentaryfeature "https://github.com/trantrien1/lichess-workspace/tree/main/lila/modules/round"
click node_commentary "https://github.com/trantrien1/lichess-workspace/blob/main/services/commentary/app.py"
click node_phrases "https://github.com/trantrien1/lichess-workspace/blob/main/services/commentary/phrases.py"
click node_dailygoal "https://github.com/trantrien1/lichess-workspace/tree/main/lila/modules/dailyGoal"
click node_fishnetbridge "https://github.com/trantrien1/lichess-workspace/blob/main/lila-fishnet/app/src/main/scala/Executor.scala"
click node_fishnet "https://github.com/trantrien1/lichess-workspace/blob/main/fishnet/src/main.rs"
click node_stockfish "https://github.com/trantrien1/lichess-workspace/blob/main/fishnet/Stockfish/src/engine.cpp"
click node_liveclients "https://github.com/trantrien1/lichess-workspace/blob/main/lila-ws/src/main/scala/Controller.scala"

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_lila,node_ui,node_board,node_rules,node_ws toneBlue
class node_winfeature,node_prediction,node_commentaryfeature,node_commentary,node_phrases,node_dailygoal toneAmber
class node_fishnetbridge,node_fishnet,node_stockfish toneMint
class node_liveclients toneRose
class node_player toneIndigo
```

## Components

### Lila platform

- [Web platform](https://github.com/trantrien1/lichess-workspace/tree/main/lila/app): `lila/app`
- [Web interface](https://github.com/trantrien1/lichess-workspace/tree/main/lila/ui): `lila/ui`
- [Chessboard UI](https://github.com/trantrien1/lichess-workspace/tree/main/chessground/src): `chessground/src`
- [Chess rules](https://github.com/trantrien1/lichess-workspace/tree/main/scalachess/core/src/main/scala): `scalachess/core/src/main/scala`
- [WebSocket server](https://github.com/trantrien1/lichess-workspace/tree/main/lila-ws/src/main/scala): `lila-ws/src/main/scala`

### User features

- [Win probability](https://github.com/trantrien1/lichess-workspace/tree/main/lila/ui): `lila/ui`
- [Position evaluator](https://github.com/trantrien1/lichess-workspace/blob/main/services/prediction/app/main.py): `services/prediction/app/main.py`
- [Vietnamese commentary](https://github.com/trantrien1/lichess-workspace/tree/main/lila/modules/round): `lila/modules/round`
- [Commentary service](https://github.com/trantrien1/lichess-workspace/blob/main/services/commentary/app.py): `services/commentary/app.py`
- [Commentary phrases](https://github.com/trantrien1/lichess-workspace/blob/main/services/commentary/phrases.py): `services/commentary/phrases.py`
- [Daily practice goals](https://github.com/trantrien1/lichess-workspace/tree/main/lila/modules/dailyGoal): `lila/modules/dailyGoal`

### Chess engines

- [Analysis coordinator](https://github.com/trantrien1/lichess-workspace/blob/main/lila-fishnet/app/src/main/scala/Executor.scala): `lila-fishnet/app/src/main/scala/Executor.scala`
- [Fishnet worker](https://github.com/trantrien1/lichess-workspace/blob/main/fishnet/src/main.rs): `fishnet/src/main.rs`
- [Stockfish engine](https://github.com/trantrien1/lichess-workspace/blob/main/fishnet/Stockfish/src/engine.cpp): `fishnet/Stockfish/src/engine.cpp`

### Realtime services

- [Realtime clients](https://github.com/trantrien1/lichess-workspace/blob/main/lila-ws/src/main/scala/Controller.scala): `lila-ws/src/main/scala/Controller.scala`

### Other components

- **Player**

## Connections

- Player → Web platform: uses
- Web platform → Web interface: serves
- Web interface → Chessboard UI: renders board
- Web interface → Win probability: shows estimates
- Win probability → Position evaluator: requests evaluation
- Web interface → Vietnamese commentary: offers commentary
- Vietnamese commentary → Commentary service: sends game state
- Commentary service → Commentary phrases: uses phrases (evidence: `services/commentary/app.py`)
- Player → Daily practice goals: sets goals
- Daily practice goals → Web interface: shows progress
- Web platform → WebSocket server: uses realtime (evidence: `lila/app/controllers/LilaController.scala`)
- WebSocket server → Realtime clients: routes sockets (evidence: `lila-ws/src/main/scala/Controller.scala`)
- Analysis coordinator → Fishnet worker: dispatches work (evidence: `lila-fishnet/app/src/main/scala/Executor.scala`)
- Fishnet worker → Stockfish engine: runs engine
- Web platform → Chess rules: uses chess rules
- Position evaluator → Stockfish engine: evaluates positions
