# u240476/production-darts architecture

> Architecture diagram of the GitHub repository u240476/production-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/u240476/production-darts
- Repository: https://github.com/u240476/production-darts

## Overview

Oche is a darts-scoring app with a React client and Spring Boot API. The main workflow is to choose a starting score and opponent, create a game, submit human or bot darts, and display updated scores, checkout routes, and match statistics; players can also undo or end a game. A separate News page fetches filtered darts stories. The README documents the game rules and API responsibilities, but most Java source was not sampled, so internal wiring beyond those statements is omitted or marked unverified.

Main entry points: [`src/main/java/com/example/news/controller/GameController.java`](https://github.com/u240476/production-darts/blob/main/src/main/java/com/example/news/controller/GameController.java) (Game API), [`frontend/src/api.js`](https://github.com/u240476/production-darts/blob/main/frontend/src/api.js) (API client), [`frontend/src/App.jsx`](https://github.com/u240476/production-darts/blob/main/frontend/src/App.jsx) (App routes), [`frontend/src/pages/Play.jsx`](https://github.com/u240476/production-darts/blob/main/frontend/src/pages/Play.jsx) (Play screen)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["React client"]
  node_app["App routes<br/>[App.jsx]"]
  node_play["Play screen<br/>[Play.jsx]"]
  node_news_page["News screen<br/>[News.jsx]"]
  node_client_api["API client<br/>[api.js]"]
end

subgraph group_api["Spring API"]
  node_game_controller["Game API"]
  node_spa_controller["SPA routing<br/>[SpaController.java]"]
end

subgraph group_game["Game rules"]
  node_game_service["Game service<br/>[GameService.java]"]
  node_game["Game validation<br/>[Game.java]"]
  node_darts["Dart validation<br/>[Darts.java]"]
  node_finish["Finish rules<br/>[Finish.java]"]
  node_checkout["Checkout routes<br/>[Checkout.java]"]
  node_stats["Match statistics<br/>[Stats.java]"]
  node_bot["Pro bot turns<br/>[ProBot.java]"]
  node_bot_players["Bot selection"]
  node_doubles["Doubles rules<br/>[Doubles.java]"]
end

subgraph group_news["Darts news"]
  node_news_controller["News API"]
  node_article_dto["Article DTO<br/>[ArticleDto.java]"]
  node_news_response["News response DTO"]
end

node_player(("Player"))

node_player -->|"uses"| node_app
node_app -->|"routes to"| node_play
node_app -->|"routes to"| node_news_page
node_play -->|"calls"| node_client_api
node_news_page -->|"calls"| node_client_api
node_client_api -->|"requests game API"| node_game_controller
node_client_api -->|"requests news API"| node_news_controller
node_game_controller -->|"lists bots"| node_bot_players
node_game_controller -->|"validates game"| node_game
node_game_controller -->|"validates dart"| node_darts
node_game_controller -->|"evaluates dart"| node_finish
node_game_controller -->|"uses checkout"| node_checkout
node_game_controller -->|"calculates stats"| node_stats
node_game_controller -->|"requests bot dart"| node_bot
node_game_controller -.-> node_game_service

click node_app "https://github.com/u240476/production-darts/blob/main/frontend/src/App.jsx"
click node_play "https://github.com/u240476/production-darts/blob/main/frontend/src/pages/Play.jsx"
click node_news_page "https://github.com/u240476/production-darts/blob/main/frontend/src/pages/News.jsx"
click node_client_api "https://github.com/u240476/production-darts/blob/main/frontend/src/api.js"
click node_game_controller "https://github.com/u240476/production-darts/blob/main/src/main/java/com/example/news/controller/GameController.java"
click node_news_controller "https://github.com/u240476/production-darts/blob/main/src/main/java/com/example/news/controller/NewsController.java"
click node_spa_controller "https://github.com/u240476/production-darts/blob/main/src/main/java/com/example/news/controller/SpaController.java"
click node_game_service "https://github.com/u240476/production-darts/blob/main/src/main/java/com/example/GameService.java"
click node_game "https://github.com/u240476/production-darts/blob/main/src/main/java/com/example/Game.java"
click node_darts "https://github.com/u240476/production-darts/blob/main/src/main/java/com/example/Darts.java"
click node_finish "https://github.com/u240476/production-darts/blob/main/src/main/java/com/example/Finish.java"
click node_checkout "https://github.com/u240476/production-darts/blob/main/src/main/java/com/example/Checkout.java"
click node_stats "https://github.com/u240476/production-darts/blob/main/src/main/java/com/example/Stats.java"
click node_bot "https://github.com/u240476/production-darts/blob/main/src/main/java/com/example/ProBot.java"
click node_bot_players "https://github.com/u240476/production-darts/blob/main/src/main/java/com/example/BuildingProPlayer.java"
click node_doubles "https://github.com/u240476/production-darts/blob/main/src/main/java/com/example/Doubles.java"
click node_article_dto "https://github.com/u240476/production-darts/blob/main/src/main/java/com/example/news/dto/ArticleDto.java"
click node_news_response "https://github.com/u240476/production-darts/blob/main/src/main/java/com/example/news/dto/NewsApiResponse.java"

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_play,node_news_page,node_client_api toneBlue
class node_game_controller,node_spa_controller toneAmber
class node_game_service,node_game,node_darts,node_finish,node_checkout,node_stats,node_bot,node_bot_players,node_doubles toneMint
class node_news_controller,node_article_dto,node_news_response toneRose
class node_player toneIndigo
```

## Components

### React client

- [App routes](https://github.com/u240476/production-darts/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Play screen](https://github.com/u240476/production-darts/blob/main/frontend/src/pages/Play.jsx): `frontend/src/pages/Play.jsx`
- [News screen](https://github.com/u240476/production-darts/blob/main/frontend/src/pages/News.jsx): `frontend/src/pages/News.jsx`
- [API client](https://github.com/u240476/production-darts/blob/main/frontend/src/api.js): `frontend/src/api.js`

### Spring API

- [Game API](https://github.com/u240476/production-darts/blob/main/src/main/java/com/example/news/controller/GameController.java): `src/main/java/com/example/news/controller/GameController.java`
- [SPA routing](https://github.com/u240476/production-darts/blob/main/src/main/java/com/example/news/controller/SpaController.java): `src/main/java/com/example/news/controller/SpaController.java`

### Game rules

- [Game service](https://github.com/u240476/production-darts/blob/main/src/main/java/com/example/GameService.java): `src/main/java/com/example/GameService.java`
- [Game validation](https://github.com/u240476/production-darts/blob/main/src/main/java/com/example/Game.java): `src/main/java/com/example/Game.java`
- [Dart validation](https://github.com/u240476/production-darts/blob/main/src/main/java/com/example/Darts.java): `src/main/java/com/example/Darts.java`
- [Finish rules](https://github.com/u240476/production-darts/blob/main/src/main/java/com/example/Finish.java): `src/main/java/com/example/Finish.java`
- [Checkout routes](https://github.com/u240476/production-darts/blob/main/src/main/java/com/example/Checkout.java): `src/main/java/com/example/Checkout.java`
- [Match statistics](https://github.com/u240476/production-darts/blob/main/src/main/java/com/example/Stats.java): `src/main/java/com/example/Stats.java`
- [Pro bot turns](https://github.com/u240476/production-darts/blob/main/src/main/java/com/example/ProBot.java): `src/main/java/com/example/ProBot.java`
- [Bot selection](https://github.com/u240476/production-darts/blob/main/src/main/java/com/example/BuildingProPlayer.java): `src/main/java/com/example/BuildingProPlayer.java`
- [Doubles rules](https://github.com/u240476/production-darts/blob/main/src/main/java/com/example/Doubles.java): `src/main/java/com/example/Doubles.java`

### Darts news

- [News API](https://github.com/u240476/production-darts/blob/main/src/main/java/com/example/news/controller/NewsController.java): `src/main/java/com/example/news/controller/NewsController.java`
- [Article DTO](https://github.com/u240476/production-darts/blob/main/src/main/java/com/example/news/dto/ArticleDto.java): `src/main/java/com/example/news/dto/ArticleDto.java`
- [News response DTO](https://github.com/u240476/production-darts/blob/main/src/main/java/com/example/news/dto/NewsApiResponse.java): `src/main/java/com/example/news/dto/NewsApiResponse.java`

### Other components

- **Player**

## Connections

- Player → App routes: uses
- App routes → Play screen: routes to (evidence: `frontend/src/App.jsx`)
- App routes → News screen: routes to (evidence: `frontend/src/App.jsx`)
- Play screen → API client: calls (evidence: `frontend/src/pages/Play.jsx`)
- News screen → API client: calls (evidence: `frontend/src/pages/News.jsx`)
- API client → Game API: requests game API (evidence: `README.md`)
- API client → News API: requests news API (evidence: `README.md`)
- Game API → Bot selection: lists bots (evidence: `README.md`)
- Game API → Game validation: validates game (evidence: `README.md`)
- Game API → Dart validation: validates dart (evidence: `README.md`)
- Game API → Finish rules: evaluates dart (evidence: `README.md`)
- Game API → Checkout routes: uses checkout (evidence: `README.md`)
- Game API → Match statistics: calculates stats (evidence: `README.md`)
- Game API → Pro bot turns: requests bot dart (evidence: `README.md`)
- Game API → Game service
