# iliasalmerekov/darts architecture

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

- Interactive diagram: https://gitdiagram.com/iliasalmerekov/darts
- Repository: https://github.com/iliasalmerekov/darts

## Overview

Dart score app is a React client for preparing and scoring dart games, then reviewing game results and player statistics. Its principal workflow is organized around the lobby, active scoring, and post-game summary; the README also identifies account, settings, game-history, profile, and joined-player screens. Shared API modules communicate with the backend, while Nanostores, realtime hooks, and browser services support the screens. Some page and store internals were not sampled, so their detailed runtime relationships are omitted rather than inferred.

Main entry points: [`src/app/App.tsx`](https://github.com/iliasalmerekov/darts/blob/main/src/app/App.tsx) (App router), [`src/pages/GamePage/throws/useThrowHandler.ts`](https://github.com/iliasalmerekov/darts/blob/main/src/pages/GamePage/throws/useThrowHandler.ts) (Throw handling), [`src/shared/api/game.ts`](https://github.com/iliasalmerekov/darts/blob/main/src/shared/api/game.ts) (Game API), [`src/pages/StartPage/StartPage.tsx`](https://github.com/iliasalmerekov/darts/blob/main/src/pages/StartPage/StartPage.tsx) (Game lobby)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_application["App router<br/>[App.tsx]"]
  node_authentication["Login and registration<br/>[useLogin.ts]"]
  node_registration["Registration flow<br/>[useRegistration.ts]"]
end

subgraph group_gameplay["Game flow"]
  node_lobby["Game lobby<br/>[StartPage.tsx]"]
  node_activegame["Active game<br/>[index.tsx]"]
  node_throwhandling["Throw handling<br/>[useThrowHandler.ts]"]
  node_throwqueue["Throw queue<br/>[useThrowQueue.ts]"]
  node_throwstate["Optimistic state"]
  node_reconciliation["Throw reconciliation"]
  node_summary["Game summary"]
  node_joinedgame["Joined games<br/>[index.tsx]"]
end

subgraph group_history["History and stats"]
  node_gamesoverview["Games overview"]
  node_gamedetail["Game details"]
  node_statistics["Player statistics<br/>[usePlayerStats.ts]"]
  node_profile["Player profile<br/>[index.tsx]"]
  node_settings["Game settings<br/>[index.tsx]"]
end

subgraph group_shared["Shared services"]
  node_api["HTTP client<br/>[client.ts]"]
  node_authapi["Authentication API<br/>[auth.ts]"]
  node_gameapi["Game API<br/>[game.ts]"]
  node_roomapi["Room API<br/>[room.ts]"]
  node_statsapi["Statistics API<br/>[statistics.ts]"]
  node_eventsource["Event stream<br/>[useEventSource.ts]"]
  node_gamestore[("Game state store<br/>[game-state.ts]")]
  node_authstore[("Auth store<br/>[auth.ts]")]
  node_sound["Sound playback<br/>[soundPlayer.ts]"]
end

node_player(("Player"))
node_backend[("Application backend")]

node_player -->|"uses"| node_application
node_application -->|"routes to"| node_authentication
node_application -->|"routes to"| node_registration
node_application -->|"routes to"| node_lobby
node_application -->|"routes to"| node_activegame
node_application -->|"routes to"| node_summary
node_authentication -->|"requests auth"| node_authapi
node_registration -->|"requests auth"| node_authapi
node_lobby -->|"manages rooms"| node_roomapi
node_lobby -->|"loads players"| node_gameapi
node_activegame -.->|"handles throws"| node_throwhandling
node_throwhandling -->|"applies optimistic state"| node_throwstate
node_throwhandling -->|"enqueues throws"| node_throwqueue
node_throwhandling -->|"reconciles state"| node_reconciliation
node_throwhandling -->|"updates state"| node_gamestore
node_throwqueue -->|"synchronizes throws"| node_gameapi
node_summary -->|"loads game data"| node_gameapi
node_summary -->|"plays sounds"| node_sound
node_gamesoverview -->|"loads overview"| node_statsapi
node_gamedetail -->|"loads details"| node_gameapi
node_statistics -->|"loads statistics"| node_statsapi
node_authentication -->|"updates session"| node_authstore
node_authstore -->|"invalidates session"| node_authapi
node_authapi -->|"sends requests"| node_api
node_gameapi -->|"sends requests"| node_api
node_statsapi -->|"sends requests"| node_api
node_api -.->|"calls"| node_backend
node_lobby -->|"subscribes"| node_eventsource
node_joinedgame -.->|"streams updates"| node_eventsource

click node_application "https://github.com/iliasalmerekov/darts/blob/main/src/app/App.tsx"
click node_authentication "https://github.com/iliasalmerekov/darts/blob/main/src/pages/LoginPage/useLogin.ts"
click node_registration "https://github.com/iliasalmerekov/darts/blob/main/src/pages/RegisterPage/useRegistration.ts"
click node_lobby "https://github.com/iliasalmerekov/darts/blob/main/src/pages/StartPage/StartPage.tsx"
click node_activegame "https://github.com/iliasalmerekov/darts/blob/main/src/pages/GamePage/index.tsx"
click node_throwhandling "https://github.com/iliasalmerekov/darts/blob/main/src/pages/GamePage/throws/useThrowHandler.ts"
click node_throwqueue "https://github.com/iliasalmerekov/darts/blob/main/src/pages/GamePage/throws/useThrowQueue.ts"
click node_throwstate "https://github.com/iliasalmerekov/darts/blob/main/src/pages/GamePage/throws/throwStateService.ts"
click node_reconciliation "https://github.com/iliasalmerekov/darts/blob/main/src/pages/GamePage/throws/useThrowReconciliation.ts"
click node_summary "https://github.com/iliasalmerekov/darts/blob/main/src/pages/GameSummaryPage/useGameSummaryPage.ts"
click node_joinedgame "https://github.com/iliasalmerekov/darts/blob/main/src/pages/JoinedGamePage/index.tsx"
click node_gamesoverview "https://github.com/iliasalmerekov/darts/blob/main/src/pages/GamesOverviewPage/useGamesOverview.ts"
click node_gamedetail "https://github.com/iliasalmerekov/darts/blob/main/src/pages/GameDetailPage/useGameDetailPage.ts"
click node_statistics "https://github.com/iliasalmerekov/darts/blob/main/src/pages/StatisticsPage/usePlayerStats.ts"
click node_profile "https://github.com/iliasalmerekov/darts/blob/main/src/pages/PlayerProfilePage/index.tsx"
click node_settings "https://github.com/iliasalmerekov/darts/blob/main/src/pages/SettingsPage/index.tsx"
click node_api "https://github.com/iliasalmerekov/darts/blob/main/src/shared/api/client.ts"
click node_authapi "https://github.com/iliasalmerekov/darts/blob/main/src/shared/api/auth.ts"
click node_gameapi "https://github.com/iliasalmerekov/darts/blob/main/src/shared/api/game.ts"
click node_roomapi "https://github.com/iliasalmerekov/darts/blob/main/src/shared/api/room.ts"
click node_statsapi "https://github.com/iliasalmerekov/darts/blob/main/src/shared/api/statistics.ts"
click node_eventsource "https://github.com/iliasalmerekov/darts/blob/main/src/shared/hooks/useEventSource.ts"
click node_gamestore "https://github.com/iliasalmerekov/darts/blob/main/src/shared/store/game-state.ts"
click node_authstore "https://github.com/iliasalmerekov/darts/blob/main/src/shared/store/auth.ts"
click node_sound "https://github.com/iliasalmerekov/darts/blob/main/src/shared/services/browser/soundPlayer.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_application,node_authentication,node_registration toneBlue
class node_lobby,node_activegame,node_throwhandling,node_throwqueue,node_throwstate,node_reconciliation,node_summary,node_joinedgame,node_backend toneAmber
class node_gamesoverview,node_gamedetail,node_statistics,node_profile,node_settings toneMint
class node_api,node_authapi,node_gameapi,node_roomapi,node_statsapi,node_eventsource,node_gamestore,node_authstore,node_sound toneRose
class node_player toneIndigo
```

## Components

### Application

- [App router](https://github.com/iliasalmerekov/darts/blob/main/src/app/App.tsx): `src/app/App.tsx`
- [Login and registration](https://github.com/iliasalmerekov/darts/blob/main/src/pages/LoginPage/useLogin.ts): `src/pages/LoginPage/useLogin.ts`
- [Registration flow](https://github.com/iliasalmerekov/darts/blob/main/src/pages/RegisterPage/useRegistration.ts): `src/pages/RegisterPage/useRegistration.ts`

### Game flow

- [Game lobby](https://github.com/iliasalmerekov/darts/blob/main/src/pages/StartPage/StartPage.tsx): `src/pages/StartPage/StartPage.tsx`
- [Active game](https://github.com/iliasalmerekov/darts/blob/main/src/pages/GamePage/index.tsx): `src/pages/GamePage/index.tsx`
- [Throw handling](https://github.com/iliasalmerekov/darts/blob/main/src/pages/GamePage/throws/useThrowHandler.ts): `src/pages/GamePage/throws/useThrowHandler.ts`
- [Throw queue](https://github.com/iliasalmerekov/darts/blob/main/src/pages/GamePage/throws/useThrowQueue.ts): `src/pages/GamePage/throws/useThrowQueue.ts`
- [Optimistic state](https://github.com/iliasalmerekov/darts/blob/main/src/pages/GamePage/throws/throwStateService.ts): `src/pages/GamePage/throws/throwStateService.ts`
- [Throw reconciliation](https://github.com/iliasalmerekov/darts/blob/main/src/pages/GamePage/throws/useThrowReconciliation.ts): `src/pages/GamePage/throws/useThrowReconciliation.ts`
- [Game summary](https://github.com/iliasalmerekov/darts/blob/main/src/pages/GameSummaryPage/useGameSummaryPage.ts): `src/pages/GameSummaryPage/useGameSummaryPage.ts`
- [Joined games](https://github.com/iliasalmerekov/darts/blob/main/src/pages/JoinedGamePage/index.tsx): `src/pages/JoinedGamePage/index.tsx`

### History and stats

- [Games overview](https://github.com/iliasalmerekov/darts/blob/main/src/pages/GamesOverviewPage/useGamesOverview.ts): `src/pages/GamesOverviewPage/useGamesOverview.ts`
- [Game details](https://github.com/iliasalmerekov/darts/blob/main/src/pages/GameDetailPage/useGameDetailPage.ts): `src/pages/GameDetailPage/useGameDetailPage.ts`
- [Player statistics](https://github.com/iliasalmerekov/darts/blob/main/src/pages/StatisticsPage/usePlayerStats.ts): `src/pages/StatisticsPage/usePlayerStats.ts`
- [Player profile](https://github.com/iliasalmerekov/darts/blob/main/src/pages/PlayerProfilePage/index.tsx): `src/pages/PlayerProfilePage/index.tsx`
- [Game settings](https://github.com/iliasalmerekov/darts/blob/main/src/pages/SettingsPage/index.tsx): `src/pages/SettingsPage/index.tsx`

### Shared services

- [HTTP client](https://github.com/iliasalmerekov/darts/blob/main/src/shared/api/client.ts): `src/shared/api/client.ts`
- [Authentication API](https://github.com/iliasalmerekov/darts/blob/main/src/shared/api/auth.ts): `src/shared/api/auth.ts`
- [Game API](https://github.com/iliasalmerekov/darts/blob/main/src/shared/api/game.ts): `src/shared/api/game.ts`
- [Room API](https://github.com/iliasalmerekov/darts/blob/main/src/shared/api/room.ts): `src/shared/api/room.ts`
- [Statistics API](https://github.com/iliasalmerekov/darts/blob/main/src/shared/api/statistics.ts): `src/shared/api/statistics.ts`
- [Event stream](https://github.com/iliasalmerekov/darts/blob/main/src/shared/hooks/useEventSource.ts): `src/shared/hooks/useEventSource.ts`
- [Game state store](https://github.com/iliasalmerekov/darts/blob/main/src/shared/store/game-state.ts): `src/shared/store/game-state.ts`
- [Auth store](https://github.com/iliasalmerekov/darts/blob/main/src/shared/store/auth.ts): `src/shared/store/auth.ts`
- [Sound playback](https://github.com/iliasalmerekov/darts/blob/main/src/shared/services/browser/soundPlayer.ts): `src/shared/services/browser/soundPlayer.ts`

### Other components

- **Player**
- **Application backend**

## Connections

- Player → App router: uses (evidence: `README.md`)
- App router → Login and registration: routes to (evidence: `src/app/App.tsx`)
- App router → Registration flow: routes to (evidence: `src/app/App.tsx`)
- App router → Game lobby: routes to (evidence: `src/app/App.tsx`)
- App router → Active game: routes to (evidence: `src/app/App.tsx`)
- App router → Game summary: routes to (evidence: `src/app/App.tsx`)
- Login and registration → Authentication API: requests auth (evidence: `src/pages/LoginPage/useLogin.ts`)
- Registration flow → Authentication API: requests auth (evidence: `src/pages/RegisterPage/useRegistration.ts`)
- Game lobby → Room API: manages rooms
- Game lobby → Game API: loads players
- Active game → Throw handling: handles throws
- Throw handling → Optimistic state: applies optimistic state (evidence: `src/pages/GamePage/throws/useThrowHandler.ts`)
- Throw handling → Throw queue: enqueues throws (evidence: `src/pages/GamePage/throws/useThrowHandler.ts`)
- Throw handling → Throw reconciliation: reconciles state (evidence: `src/pages/GamePage/throws/useThrowHandler.ts`)
- Throw handling → Game state store: updates state (evidence: `src/pages/GamePage/throws/useThrowHandler.ts`)
- Throw queue → Game API: synchronizes throws (evidence: `src/pages/GamePage/throws/useThrowQueue.ts`)
- Game summary → Game API: loads game data (evidence: `src/pages/GameSummaryPage/useGameSummaryPage.ts`)
- Game summary → Sound playback: plays sounds (evidence: `src/pages/GameSummaryPage/useGameSummaryPage.ts`)
- Games overview → Statistics API: loads overview (evidence: `src/pages/GamesOverviewPage/useGamesOverview.ts`)
- Game details → Game API: loads details (evidence: `src/pages/GameDetailPage/useGameDetailPage.ts`)
- Player statistics → Statistics API: loads statistics (evidence: `src/pages/StatisticsPage/usePlayerStats.ts`)
- Login and registration → Auth store: updates session (evidence: `src/pages/LoginPage/useLogin.ts`)
- Auth store → Authentication API: invalidates session (evidence: `src/shared/store/auth.ts`)
- Authentication API → HTTP client: sends requests (evidence: `src/shared/api/auth.ts`)
- Game API → HTTP client: sends requests (evidence: `src/shared/api/game.ts`)
- Statistics API → HTTP client: sends requests (evidence: `src/shared/api/statistics.ts`)
- HTTP client → Application backend: calls
- Game lobby → Event stream: subscribes
- Joined games → Event stream: streams updates
