# naaturel/gamehistory architecture

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

## Overview

GameHistory is an Android app for recording board-game sessions and reviewing a searchable history. Users can add game definitions, record parties with scores and optional thumbnails, browse and filter past parties, inspect score details, and open a statistics screen. The sampled repository code shows the UI-to-viewmodel-to-repository path and Room-backed data access; the statistics implementation and several viewmodels/DAOs were not sampled, so their internal wiring is left unspecified.

Main entry points: [`app/src/main/java/be/laurent/gamehistory/repository/Repo.kt`](https://github.com/naaturel/gamehistory/blob/master/app/src/main/java/be/laurent/gamehistory/repository/Repo.kt) (Repository), [`app/src/main/java/be/laurent/gamehistory/fragments/AddGameFragment.kt`](https://github.com/naaturel/gamehistory/blob/master/app/src/main/java/be/laurent/gamehistory/fragments/AddGameFragment.kt) (Add game), [`app/src/main/java/be/laurent/gamehistory/fragments/BarFragment.kt`](https://github.com/naaturel/gamehistory/blob/master/app/src/main/java/be/laurent/gamehistory/fragments/BarFragment.kt) (Navigation bar), [`app/src/main/java/be/laurent/gamehistory/TakePhotoActivity.kt`](https://github.com/naaturel/gamehistory/blob/master/app/src/main/java/be/laurent/gamehistory/TakePhotoActivity.kt) (Photo capture)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_navigation["App navigation"]
  node_main["Main screen<br/>[MainActivity.kt]"]
  node_bar["Navigation bar<br/>[BarFragment.kt]"]
end

subgraph group_capture["Game and party entry"]
  node_add_game["Add game<br/>[AddGameFragment.kt]"]
  node_game_vm["Game viewmodel"]
  node_add_party["Add party"]
  node_party_vm["Party viewmodel"]
  node_camera["Photo capture"]
end

subgraph group_history["History and review"]
  node_home["Party history<br/>[HomeFragment.kt]"]
  node_home_vm["Home viewmodel<br/>[HomeViewModel.kt]"]
  node_party_adapter["Party list adapter<br/>[PartyAdapter.kt]"]
  node_score_adapter["Score details adapter"]
  node_stats["Statistics screen"]
  node_stats_view["Statistics view<br/>[BarFragment.kt]"]
end

subgraph group_data["Persistence"]
  node_repo["Repository<br/>[Repo.kt]"]
  node_room[("Room database<br/>[RoomDB.kt]")]
  node_game_dao["Game DAO<br/>[GameDao.kt]"]
  node_party_dao["Party DAO<br/>[PartyDao.kt]"]
  node_score_dao["Score DAO<br/>[ScoreDao.kt]"]
end

node_user(("User"))
node_camera_service(("Android camera"))
node_media_store[("MediaStore")]

node_user -->|"opens app"| node_main
node_main -->|"loads and filters"| node_home_vm
node_main -->|"displays"| node_bar
node_bar -->|"opens"| node_add_game
node_bar -->|"opens"| node_add_party
node_bar -->|"opens"| node_stats
node_stats -->|"displays"| node_stats_view
node_user -->|"enters game"| node_add_game
node_add_game -->|"creates game"| node_game_vm
node_game_vm -->|"saves game"| node_repo
node_user -->|"enters party"| node_add_party
node_add_party -->|"loads games and creates party"| node_party_vm
node_party_vm -->|"reads games and saves party"| node_repo
node_add_game -->|"requests photo"| node_camera
node_camera -->|"captures image"| node_camera_service
node_camera -->|"saves image"| node_media_store
node_camera -->|"returns image URI"| node_add_game
node_home -->|"observes and requests details"| node_home_vm
node_home_vm -->|"reads parties and scores"| node_repo
node_home -->|"displays parties"| node_party_adapter
node_home -->|"displays scores"| node_score_adapter
node_repo -->|"builds database"| node_room
node_repo -->|"reads and writes games"| node_game_dao
node_repo -->|"reads and writes parties"| node_party_dao
node_repo -->|"reads and writes scores"| node_score_dao

click node_main "https://github.com/naaturel/gamehistory/blob/master/app/src/main/java/be/laurent/gamehistory/MainActivity.kt"
click node_bar "https://github.com/naaturel/gamehistory/blob/master/app/src/main/java/be/laurent/gamehistory/fragments/BarFragment.kt"
click node_add_game "https://github.com/naaturel/gamehistory/blob/master/app/src/main/java/be/laurent/gamehistory/fragments/AddGameFragment.kt"
click node_game_vm "https://github.com/naaturel/gamehistory/blob/master/app/src/main/java/be/laurent/gamehistory/viewmodels/AddGameViewModel.kt"
click node_add_party "https://github.com/naaturel/gamehistory/blob/master/app/src/main/java/be/laurent/gamehistory/fragments/AddPartyFragment.kt"
click node_party_vm "https://github.com/naaturel/gamehistory/blob/master/app/src/main/java/be/laurent/gamehistory/viewmodels/AddPartyViewModel.kt"
click node_camera "https://github.com/naaturel/gamehistory/blob/master/app/src/main/java/be/laurent/gamehistory/TakePhotoActivity.kt"
click node_home "https://github.com/naaturel/gamehistory/blob/master/app/src/main/java/be/laurent/gamehistory/fragments/HomeFragment.kt"
click node_home_vm "https://github.com/naaturel/gamehistory/blob/master/app/src/main/java/be/laurent/gamehistory/viewmodels/HomeViewModel.kt"
click node_party_adapter "https://github.com/naaturel/gamehistory/blob/master/app/src/main/java/be/laurent/gamehistory/adapter/PartyAdapter.kt"
click node_score_adapter "https://github.com/naaturel/gamehistory/blob/master/app/src/main/java/be/laurent/gamehistory/adapter/ScoreDetailsAdapter.kt"
click node_stats "https://github.com/naaturel/gamehistory/blob/master/app/src/main/java/be/laurent/gamehistory/ViewStatsActivity.kt"
click node_stats_view "https://github.com/naaturel/gamehistory/blob/master/app/src/main/java/be/laurent/gamehistory/fragments/BarFragment.kt"
click node_repo "https://github.com/naaturel/gamehistory/blob/master/app/src/main/java/be/laurent/gamehistory/repository/Repo.kt"
click node_room "https://github.com/naaturel/gamehistory/blob/master/app/src/main/java/be/laurent/gamehistory/repository/RoomDB.kt"
click node_game_dao "https://github.com/naaturel/gamehistory/blob/master/app/src/main/java/be/laurent/gamehistory/daos/GameDao.kt"
click node_party_dao "https://github.com/naaturel/gamehistory/blob/master/app/src/main/java/be/laurent/gamehistory/daos/PartyDao.kt"
click node_score_dao "https://github.com/naaturel/gamehistory/blob/master/app/src/main/java/be/laurent/gamehistory/daos/ScoreDao.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_main,node_bar,node_user toneBlue
class node_add_game,node_game_vm,node_add_party,node_party_vm,node_camera,node_media_store toneAmber
class node_home,node_home_vm,node_party_adapter,node_score_adapter,node_stats,node_stats_view toneMint
class node_repo,node_room,node_game_dao,node_party_dao,node_score_dao toneRose
class node_camera_service toneIndigo
```

## Components

### App navigation

- [Main screen](https://github.com/naaturel/gamehistory/blob/master/app/src/main/java/be/laurent/gamehistory/MainActivity.kt): `app/src/main/java/be/laurent/gamehistory/MainActivity.kt`
- [Navigation bar](https://github.com/naaturel/gamehistory/blob/master/app/src/main/java/be/laurent/gamehistory/fragments/BarFragment.kt): `app/src/main/java/be/laurent/gamehistory/fragments/BarFragment.kt`

### Game and party entry

- [Add game](https://github.com/naaturel/gamehistory/blob/master/app/src/main/java/be/laurent/gamehistory/fragments/AddGameFragment.kt): `app/src/main/java/be/laurent/gamehistory/fragments/AddGameFragment.kt`
- [Game viewmodel](https://github.com/naaturel/gamehistory/blob/master/app/src/main/java/be/laurent/gamehistory/viewmodels/AddGameViewModel.kt): `app/src/main/java/be/laurent/gamehistory/viewmodels/AddGameViewModel.kt`
- [Add party](https://github.com/naaturel/gamehistory/blob/master/app/src/main/java/be/laurent/gamehistory/fragments/AddPartyFragment.kt): `app/src/main/java/be/laurent/gamehistory/fragments/AddPartyFragment.kt`
- [Party viewmodel](https://github.com/naaturel/gamehistory/blob/master/app/src/main/java/be/laurent/gamehistory/viewmodels/AddPartyViewModel.kt): `app/src/main/java/be/laurent/gamehistory/viewmodels/AddPartyViewModel.kt`
- [Photo capture](https://github.com/naaturel/gamehistory/blob/master/app/src/main/java/be/laurent/gamehistory/TakePhotoActivity.kt): `app/src/main/java/be/laurent/gamehistory/TakePhotoActivity.kt`

### History and review

- [Party history](https://github.com/naaturel/gamehistory/blob/master/app/src/main/java/be/laurent/gamehistory/fragments/HomeFragment.kt): `app/src/main/java/be/laurent/gamehistory/fragments/HomeFragment.kt`
- [Home viewmodel](https://github.com/naaturel/gamehistory/blob/master/app/src/main/java/be/laurent/gamehistory/viewmodels/HomeViewModel.kt): `app/src/main/java/be/laurent/gamehistory/viewmodels/HomeViewModel.kt`
- [Party list adapter](https://github.com/naaturel/gamehistory/blob/master/app/src/main/java/be/laurent/gamehistory/adapter/PartyAdapter.kt): `app/src/main/java/be/laurent/gamehistory/adapter/PartyAdapter.kt`
- [Score details adapter](https://github.com/naaturel/gamehistory/blob/master/app/src/main/java/be/laurent/gamehistory/adapter/ScoreDetailsAdapter.kt): `app/src/main/java/be/laurent/gamehistory/adapter/ScoreDetailsAdapter.kt`
- [Statistics screen](https://github.com/naaturel/gamehistory/blob/master/app/src/main/java/be/laurent/gamehistory/ViewStatsActivity.kt): `app/src/main/java/be/laurent/gamehistory/ViewStatsActivity.kt`
- [Statistics view](https://github.com/naaturel/gamehistory/blob/master/app/src/main/java/be/laurent/gamehistory/fragments/BarFragment.kt): `app/src/main/java/be/laurent/gamehistory/fragments/BarFragment.kt`

### Persistence

- [Repository](https://github.com/naaturel/gamehistory/blob/master/app/src/main/java/be/laurent/gamehistory/repository/Repo.kt): `app/src/main/java/be/laurent/gamehistory/repository/Repo.kt`
- [Room database](https://github.com/naaturel/gamehistory/blob/master/app/src/main/java/be/laurent/gamehistory/repository/RoomDB.kt): `app/src/main/java/be/laurent/gamehistory/repository/RoomDB.kt`
- [Game DAO](https://github.com/naaturel/gamehistory/blob/master/app/src/main/java/be/laurent/gamehistory/daos/GameDao.kt): `app/src/main/java/be/laurent/gamehistory/daos/GameDao.kt`
- [Party DAO](https://github.com/naaturel/gamehistory/blob/master/app/src/main/java/be/laurent/gamehistory/daos/PartyDao.kt): `app/src/main/java/be/laurent/gamehistory/daos/PartyDao.kt`
- [Score DAO](https://github.com/naaturel/gamehistory/blob/master/app/src/main/java/be/laurent/gamehistory/daos/ScoreDao.kt): `app/src/main/java/be/laurent/gamehistory/daos/ScoreDao.kt`

### Other components

- **User**
- **Android camera**
- **MediaStore**

## Connections

- User → Main screen: opens app
- Main screen → Home viewmodel: loads and filters
- Main screen → Navigation bar: displays
- Navigation bar → Add game: opens
- Navigation bar → Add party: opens
- Navigation bar → Statistics screen: opens
- Statistics screen → Statistics view: displays
- User → Add game: enters game
- Add game → Game viewmodel: creates game
- Game viewmodel → Repository: saves game
- User → Add party: enters party
- Add party → Party viewmodel: loads games and creates party
- Party viewmodel → Repository: reads games and saves party
- Add game → Photo capture: requests photo
- Photo capture → Android camera: captures image
- Photo capture → MediaStore: saves image
- Photo capture → Add game: returns image URI
- Party history → Home viewmodel: observes and requests details
- Home viewmodel → Repository: reads parties and scores
- Party history → Party list adapter: displays parties
- Party history → Score details adapter: displays scores
- Repository → Room database: builds database
- Repository → Game DAO: reads and writes games
- Repository → Party DAO: reads and writes parties
- Repository → Score DAO: reads and writes scores
