# chofeechen/dartvio-app architecture

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

- Interactive diagram: https://gitdiagram.com/chofeechen/dartvio-app
- Repository: https://github.com/chofeechen/dartvio-app

## Overview

DartVio is a cross-platform darts scoring and training app. The primary workflow is choosing a match, playing a local or AI-assisted game, recording its result, and reviewing stats or achievements. Separate branches cover solo practice, impact-analysis training, and online rooms. The README establishes the shared Kotlin Multiplatform core; sampled excerpts confirm practice rules, adaptive AI, local persistence, achievement calculation, and online event handling. Other unsampled feature wiring is represented conservatively from the source tree.

Main entry points: [`android/app/src/main/java/com/dartvio/app/ui/navigation/DartVioNavHost.kt`](https://github.com/chofeechen/dartvio-app/blob/main/android/app/src/main/java/com/dartvio/app/ui/navigation/DartVioNavHost.kt) (Navigation), [`android/app/src/main/java/com/dartvio/app/ui/game/GameViewModel.kt`](https://github.com/chofeechen/dartvio-app/blob/main/android/app/src/main/java/com/dartvio/app/ui/game/GameViewModel.kt) (Match play), [`android/app/src/main/java/com/dartvio/app/ui/practice/PracticeModeScreen.kt`](https://github.com/chofeechen/dartvio-app/blob/main/android/app/src/main/java/com/dartvio/app/ui/practice/PracticeModeScreen.kt) (Practice modes), [`android/app/src/main/java/com/dartvio/app/data/room/OnlineRoomRepository.kt`](https://github.com/chofeechen/dartvio-app/blob/main/android/app/src/main/java/com/dartvio/app/data/room/OnlineRoomRepository.kt) (Room repository)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App experience"]
  node_android["Android entry<br/>[MainActivity.kt]"]
  node_navigation["Navigation<br/>[DartVioNavHost.kt]"]
end

subgraph group_match["Match play"]
  node_setup["Match setup"]
  node_game["Match play<br/>[GameViewModel.kt]"]
  node_rules["Game rules"]
end

subgraph group_practice["Practice and analysis"]
  node_practice["Practice modes"]
  node_engines["Practice engines"]
  node_impact["Impact training"]
end

subgraph group_online["Online rooms"]
  node_lobby["Room lobby<br/>[LobbyViewModel.kt]"]
  node_roomrepo["Room repository"]
  node_roomapi["Online API<br/>[OnlineRoomApi.kt]"]
  node_roomservice[("Room service")]
end

subgraph group_data["Persistence and insights"]
  node_matchstore[("Match history")]
  node_stats["Stats analysis<br/>[StatsViewModel.kt]"]
  node_statscalc["Stats calculation<br/>[StatsCalculator.kt]"]
  node_impactdata[("Impact records")]
  node_achievements["Achievements"]
  node_achievementcalc["Achievement rules"]
end

node_player(("Player"))

node_player -->|"opens app"| node_android
node_android -->|"starts navigation"| node_navigation
node_player -->|"chooses feature"| node_navigation
node_navigation -->|"opens setup"| node_setup
node_setup -->|"starts match"| node_game
node_game -->|"applies rules"| node_rules
node_game -->|"records result"| node_matchstore
node_navigation -->|"opens stats"| node_stats
node_stats -->|"reads history"| node_matchstore
node_stats -->|"calculates metrics"| node_statscalc
node_navigation -->|"opens practice"| node_practice
node_practice -->|"runs exercises"| node_engines
node_practice -->|"starts impact drill"| node_impact
node_impact -->|"stores dart data"| node_impactdata
node_navigation -->|"loads achievements"| node_achievements
node_achievements -->|"reads match facts"| node_matchstore
node_achievements -->|"calculates unlocks"| node_achievementcalc
node_navigation -->|"opens online play"| node_lobby
node_lobby -->|"manages room"| node_roomrepo
node_roomrepo -->|"fetches and writes"| node_roomapi
node_roomrepo -->|"syncs room events"| node_roomservice

click node_android "https://github.com/chofeechen/dartvio-app/blob/main/android/app/src/main/java/com/dartvio/app/MainActivity.kt"
click node_navigation "https://github.com/chofeechen/dartvio-app/blob/main/android/app/src/main/java/com/dartvio/app/ui/navigation/DartVioNavHost.kt"
click node_setup "https://github.com/chofeechen/dartvio-app/blob/main/android/app/src/main/java/com/dartvio/app/ui/setup/MatchSetupScreen.kt"
click node_game "https://github.com/chofeechen/dartvio-app/blob/main/android/app/src/main/java/com/dartvio/app/ui/game/GameViewModel.kt"
click node_rules "https://github.com/chofeechen/dartvio-app/tree/main/android/shared/src/commonMain/kotlin/com/dartvio/app/domain/rules"
click node_matchstore "https://github.com/chofeechen/dartvio-app/blob/main/android/app/src/main/java/com/dartvio/app/data/local/RoomMatchRecorder.kt"
click node_stats "https://github.com/chofeechen/dartvio-app/blob/main/android/app/src/main/java/com/dartvio/app/ui/stats/StatsViewModel.kt"
click node_statscalc "https://github.com/chofeechen/dartvio-app/blob/main/android/app/src/main/java/com/dartvio/app/domain/stats/StatsCalculator.kt"
click node_practice "https://github.com/chofeechen/dartvio-app/blob/main/android/app/src/main/java/com/dartvio/app/ui/practice/PracticeModeScreen.kt"
click node_engines "https://github.com/chofeechen/dartvio-app/tree/main/android/shared/src/commonMain/kotlin/com/dartvio/app/domain/practice"
click node_impact "https://github.com/chofeechen/dartvio-app/blob/main/android/app/src/main/java/com/dartvio/app/ui/practice/ImpactPracticeViewModel.kt"
click node_impactdata "https://github.com/chofeechen/dartvio-app/blob/main/android/app/src/main/java/com/dartvio/app/data/ImpactRepository.kt"
click node_achievements "https://github.com/chofeechen/dartvio-app/blob/main/android/app/src/main/java/com/dartvio/app/data/achievement/AchievementRepository.kt"
click node_achievementcalc "https://github.com/chofeechen/dartvio-app/blob/main/android/app/src/main/java/com/dartvio/app/domain/achievement/AchievementCalculator.kt"
click node_lobby "https://github.com/chofeechen/dartvio-app/blob/main/android/app/src/main/java/com/dartvio/app/ui/lobby/LobbyViewModel.kt"
click node_roomrepo "https://github.com/chofeechen/dartvio-app/blob/main/android/app/src/main/java/com/dartvio/app/data/room/OnlineRoomRepository.kt"
click node_roomapi "https://github.com/chofeechen/dartvio-app/blob/main/android/app/src/main/java/com/dartvio/app/net/online/OnlineRoomApi.kt"

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_android,node_navigation toneBlue
class node_setup,node_game,node_rules toneAmber
class node_practice,node_engines,node_impact toneMint
class node_lobby,node_roomrepo,node_roomapi,node_roomservice toneRose
class node_matchstore,node_stats,node_statscalc,node_impactdata,node_achievements,node_achievementcalc,node_player toneIndigo
```

## Components

### App experience

- [Android entry](https://github.com/chofeechen/dartvio-app/blob/main/android/app/src/main/java/com/dartvio/app/MainActivity.kt): `android/app/src/main/java/com/dartvio/app/MainActivity.kt`
- [Navigation](https://github.com/chofeechen/dartvio-app/blob/main/android/app/src/main/java/com/dartvio/app/ui/navigation/DartVioNavHost.kt): `android/app/src/main/java/com/dartvio/app/ui/navigation/DartVioNavHost.kt`

### Match play

- [Match setup](https://github.com/chofeechen/dartvio-app/blob/main/android/app/src/main/java/com/dartvio/app/ui/setup/MatchSetupScreen.kt): `android/app/src/main/java/com/dartvio/app/ui/setup/MatchSetupScreen.kt`
- [Match play](https://github.com/chofeechen/dartvio-app/blob/main/android/app/src/main/java/com/dartvio/app/ui/game/GameViewModel.kt): `android/app/src/main/java/com/dartvio/app/ui/game/GameViewModel.kt`
- [Game rules](https://github.com/chofeechen/dartvio-app/tree/main/android/shared/src/commonMain/kotlin/com/dartvio/app/domain/rules): `android/shared/src/commonMain/kotlin/com/dartvio/app/domain/rules`

### Practice and analysis

- [Practice modes](https://github.com/chofeechen/dartvio-app/blob/main/android/app/src/main/java/com/dartvio/app/ui/practice/PracticeModeScreen.kt): `android/app/src/main/java/com/dartvio/app/ui/practice/PracticeModeScreen.kt`
- [Practice engines](https://github.com/chofeechen/dartvio-app/tree/main/android/shared/src/commonMain/kotlin/com/dartvio/app/domain/practice): `android/shared/src/commonMain/kotlin/com/dartvio/app/domain/practice`
- [Impact training](https://github.com/chofeechen/dartvio-app/blob/main/android/app/src/main/java/com/dartvio/app/ui/practice/ImpactPracticeViewModel.kt): `android/app/src/main/java/com/dartvio/app/ui/practice/ImpactPracticeViewModel.kt`

### Online rooms

- [Room lobby](https://github.com/chofeechen/dartvio-app/blob/main/android/app/src/main/java/com/dartvio/app/ui/lobby/LobbyViewModel.kt): `android/app/src/main/java/com/dartvio/app/ui/lobby/LobbyViewModel.kt`
- [Room repository](https://github.com/chofeechen/dartvio-app/blob/main/android/app/src/main/java/com/dartvio/app/data/room/OnlineRoomRepository.kt): `android/app/src/main/java/com/dartvio/app/data/room/OnlineRoomRepository.kt`
- [Online API](https://github.com/chofeechen/dartvio-app/blob/main/android/app/src/main/java/com/dartvio/app/net/online/OnlineRoomApi.kt): `android/app/src/main/java/com/dartvio/app/net/online/OnlineRoomApi.kt`
- **Room service**

### Persistence and insights

- [Match history](https://github.com/chofeechen/dartvio-app/blob/main/android/app/src/main/java/com/dartvio/app/data/local/RoomMatchRecorder.kt): `android/app/src/main/java/com/dartvio/app/data/local/RoomMatchRecorder.kt`
- [Stats analysis](https://github.com/chofeechen/dartvio-app/blob/main/android/app/src/main/java/com/dartvio/app/ui/stats/StatsViewModel.kt): `android/app/src/main/java/com/dartvio/app/ui/stats/StatsViewModel.kt`
- [Stats calculation](https://github.com/chofeechen/dartvio-app/blob/main/android/app/src/main/java/com/dartvio/app/domain/stats/StatsCalculator.kt): `android/app/src/main/java/com/dartvio/app/domain/stats/StatsCalculator.kt`
- [Impact records](https://github.com/chofeechen/dartvio-app/blob/main/android/app/src/main/java/com/dartvio/app/data/ImpactRepository.kt): `android/app/src/main/java/com/dartvio/app/data/ImpactRepository.kt`
- [Achievements](https://github.com/chofeechen/dartvio-app/blob/main/android/app/src/main/java/com/dartvio/app/data/achievement/AchievementRepository.kt): `android/app/src/main/java/com/dartvio/app/data/achievement/AchievementRepository.kt`
- [Achievement rules](https://github.com/chofeechen/dartvio-app/blob/main/android/app/src/main/java/com/dartvio/app/domain/achievement/AchievementCalculator.kt): `android/app/src/main/java/com/dartvio/app/domain/achievement/AchievementCalculator.kt`

### Other components

- **Player**

## Connections

- Player → Android entry: opens app
- Android entry → Navigation: starts navigation
- Player → Navigation: chooses feature
- Navigation → Match setup: opens setup
- Match setup → Match play: starts match
- Match play → Game rules: applies rules
- Match play → Match history: records result
- Navigation → Stats analysis: opens stats
- Stats analysis → Match history: reads history
- Stats analysis → Stats calculation: calculates metrics
- Navigation → Practice modes: opens practice
- Practice modes → Practice engines: runs exercises
- Practice modes → Impact training: starts impact drill
- Impact training → Impact records: stores dart data
- Navigation → Achievements: loads achievements
- Achievements → Match history: reads match facts
- Achievements → Achievement rules: calculates unlocks
- Navigation → Room lobby: opens online play
- Room lobby → Room repository: manages room
- Room repository → Online API: fetches and writes
- Room repository → Room service: syncs room events
