# rapip-na/game architecture

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

- Interactive diagram: https://gitdiagram.com/rapip-na/game
- Repository: https://github.com/rapip-na/game

## Overview

This Laravel application, branded in its suggestion flow as MainYuk, serves a collection of party and learning games. Players enter game pages and participate in room-based experiences; hosts manage rounds and game state. The clearest detailed workflows are Problem Detective and Siapa Kembaranku?, with separate lightweight experiences for Speaking Roulette, Speak Up!, and Susun Urutan. Admins manage game maintenance and review suggestions. Evidence is limited to the supplied excerpts, source index, and generic Laravel README; several listed game implementations were not sampled.

Main entry points: [`routes/web.php`](https://github.com/rapip-na/game/blob/main/routes/web.php) (Web routes), [`app/Http/Controllers/DetectiveController.php`](https://github.com/rapip-na/game/blob/main/app/Http/Controllers/DetectiveController.php) (Detective room flow), [`app/Http/Controllers/SiapaKembarankuController.php`](https://github.com/rapip-na/game/blob/main/app/Http/Controllers/SiapaKembarankuController.php) (Twin game flow), [`app/Models/DetectiveRoom.php`](https://github.com/rapip-na/game/blob/main/app/Models/DetectiveRoom.php) (Room state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_routing["Web Entry"]
  node_web_routes["Web routes<br/>[web.php]"]
  node_maintenance_gate["Maintenance gate"]
  node_maintenance_state[("Maintenance records")]
end

subgraph group_detective["Problem Detective"]
  node_detective_controller["Detective room flow"]
  node_case_library["Case library"]
  node_detective_room[("Room state<br/>[DetectiveRoom.php]")]
  node_detective_case[("Case content<br/>[DetectiveCase.php]")]
  node_detective_team[("Team state<br/>[DetectiveTeam.php]")]
  node_detective_player[("Player state")]
  node_detective_question[("Team questions")]
  node_detective_event["Room update event"]
end

subgraph group_twins["Siapa Kembaranku"]
  node_twin_controller["Twin game flow"]
  node_twin_game[("Game rounds<br/>[TwinGame.php]")]
  node_twin_player[("Players and logos<br/>[TwinPlayer.php]")]
  node_twin_scan[("Player scans<br/>[TwinScan.php]")]
  node_twin_vote[("Round votes<br/>[TwinVote.php]")]
  node_twin_event["Game state event"]
end

subgraph group_othergames["Other Games"]
  node_speaking_controller["Speaking Roulette"]
  node_speaking_service["Speaking prompts"]
  node_speakup_controller["Speak Up page"]
  node_speakup_client["Speak Up client<br/>[app.js]"]
  node_order_controller["Order game flow"]
  node_order_service["Ordering logic"]
end

subgraph group_admin["Admin and Suggestions"]
  node_suggestion_controller["Suggestion intake"]
  node_suggestion_record[("Game suggestions<br/>[GameSuggestion.php]")]
  node_admin_controller["Admin management"]
  node_admin_auth["Admin authentication"]
  node_suggestion_form["Suggestion form<br/>[create.blade.php]"]
  node_admin_dashboard["Admin dashboard"]
end

node_visitor(("Player or host"))

node_visitor -->|"requests pages"| node_web_routes
node_web_routes -->|"routes detective"| node_detective_controller
node_web_routes -->|"routes twin game"| node_twin_controller
node_web_routes -->|"routes speaking"| node_speaking_controller
node_web_routes -->|"routes Speak Up"| node_speakup_controller
node_web_routes -->|"routes ordering"| node_order_controller
node_web_routes -->|"routes suggestions"| node_suggestion_controller
node_web_routes -->|"routes admin"| node_admin_controller
node_web_routes -->|"applies game gate"| node_maintenance_gate
node_web_routes -->|"applies admin gate"| node_admin_auth
node_maintenance_gate -->|"checks status"| node_maintenance_state
node_detective_controller -->|"ensures cases"| node_case_library
node_detective_controller -->|"updates room"| node_detective_room
node_detective_controller -->|"loads cases"| node_detective_case
node_detective_controller -->|"updates teams"| node_detective_team
node_detective_controller -->|"manages players"| node_detective_player
node_detective_controller -->|"updates questions"| node_detective_question
node_detective_controller -->|"broadcasts updates"| node_detective_event
node_detective_room -->|"belongs to"| node_detective_case
node_detective_room -->|"has teams"| node_detective_team
node_detective_room -->|"has players"| node_detective_player
node_detective_room -->|"has questions"| node_detective_question
node_detective_team -->|"has players"| node_detective_player
node_detective_team -->|"has questions"| node_detective_question
node_twin_controller -->|"manages rounds"| node_twin_game
node_twin_controller -->|"manages players"| node_twin_player
node_twin_controller -->|"records scans"| node_twin_scan
node_twin_controller -->|"counts votes"| node_twin_vote
node_twin_controller -.->|"dispatches state"| node_twin_event
node_twin_game -->|"has players"| node_twin_player
node_speaking_controller -->|"delegates prompts"| node_speaking_service
node_speakup_controller -.->|"serves experience"| node_speakup_client
node_order_controller -->|"delegates logic"| node_order_service
node_suggestion_controller -->|"creates suggestion"| node_suggestion_record
node_admin_controller -->|"manages status"| node_maintenance_state
node_admin_controller -->|"reviews suggestions"| node_suggestion_record
node_admin_controller -->|"renders dashboard"| node_admin_dashboard
node_suggestion_controller -->|"renders form"| node_suggestion_form

click node_web_routes "https://github.com/rapip-na/game/blob/main/routes/web.php"
click node_maintenance_gate "https://github.com/rapip-na/game/blob/main/app/Http/Middleware/CheckGameMaintenance.php"
click node_maintenance_state "https://github.com/rapip-na/game/blob/main/app/Models/GameMaintenance.php"
click node_detective_controller "https://github.com/rapip-na/game/blob/main/app/Http/Controllers/DetectiveController.php"
click node_case_library "https://github.com/rapip-na/game/blob/main/app/Services/DetectiveCaseLibraryService.php"
click node_detective_room "https://github.com/rapip-na/game/blob/main/app/Models/DetectiveRoom.php"
click node_detective_case "https://github.com/rapip-na/game/blob/main/app/Models/DetectiveCase.php"
click node_detective_team "https://github.com/rapip-na/game/blob/main/app/Models/DetectiveTeam.php"
click node_detective_player "https://github.com/rapip-na/game/blob/main/app/Models/DetectivePlayer.php"
click node_detective_question "https://github.com/rapip-na/game/blob/main/app/Models/DetectiveQuestion.php"
click node_detective_event "https://github.com/rapip-na/game/blob/main/app/Events/DetectiveRoomUpdated.php"
click node_twin_controller "https://github.com/rapip-na/game/blob/main/app/Http/Controllers/SiapaKembarankuController.php"
click node_twin_game "https://github.com/rapip-na/game/blob/main/app/Models/TwinGame.php"
click node_twin_player "https://github.com/rapip-na/game/blob/main/app/Models/TwinPlayer.php"
click node_twin_scan "https://github.com/rapip-na/game/blob/main/app/Models/TwinScan.php"
click node_twin_vote "https://github.com/rapip-na/game/blob/main/app/Models/TwinVote.php"
click node_twin_event "https://github.com/rapip-na/game/blob/main/app/Events/TwinGameStateChanged.php"
click node_speaking_controller "https://github.com/rapip-na/game/blob/main/app/Http/Controllers/SpeakingController.php"
click node_speaking_service "https://github.com/rapip-na/game/blob/main/app/Services/SpeakingService.php"
click node_speakup_controller "https://github.com/rapip-na/game/blob/main/app/Http/Controllers/SpeakUpController.php"
click node_speakup_client "https://github.com/rapip-na/game/blob/main/public/js/speak-up/app.js"
click node_order_controller "https://github.com/rapip-na/game/blob/main/app/Http/Controllers/SusunUrutanController.php"
click node_order_service "https://github.com/rapip-na/game/blob/main/app/Services/SusunUrutanService.php"
click node_suggestion_controller "https://github.com/rapip-na/game/blob/main/app/Http/Controllers/GameSuggestionController.php"
click node_suggestion_record "https://github.com/rapip-na/game/blob/main/app/Models/GameSuggestion.php"
click node_admin_controller "https://github.com/rapip-na/game/blob/main/app/Http/Controllers/AdminController.php"
click node_admin_auth "https://github.com/rapip-na/game/blob/main/app/Http/Middleware/EnsureAdminAuthenticated.php"
click node_suggestion_form "https://github.com/rapip-na/game/blob/main/resources/views/suggestions/create.blade.php"
click node_admin_dashboard "https://github.com/rapip-na/game/blob/main/resources/views/admin/dashboard.blade.php"

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_web_routes,node_maintenance_gate,node_maintenance_state toneBlue
class node_detective_controller,node_case_library,node_detective_room,node_detective_case,node_detective_team,node_detective_player,node_detective_question,node_detective_event toneAmber
class node_twin_controller,node_twin_game,node_twin_player,node_twin_scan,node_twin_vote,node_twin_event toneMint
class node_speaking_controller,node_speaking_service,node_speakup_controller,node_speakup_client,node_order_controller,node_order_service toneRose
class node_suggestion_controller,node_suggestion_record,node_admin_controller,node_admin_auth,node_suggestion_form,node_admin_dashboard,node_visitor toneIndigo
```

## Components

### Web Entry

- [Web routes](https://github.com/rapip-na/game/blob/main/routes/web.php): `routes/web.php`
- [Maintenance gate](https://github.com/rapip-na/game/blob/main/app/Http/Middleware/CheckGameMaintenance.php): `app/Http/Middleware/CheckGameMaintenance.php`
- [Maintenance records](https://github.com/rapip-na/game/blob/main/app/Models/GameMaintenance.php): `app/Models/GameMaintenance.php`

### Problem Detective

- [Detective room flow](https://github.com/rapip-na/game/blob/main/app/Http/Controllers/DetectiveController.php): `app/Http/Controllers/DetectiveController.php`
- [Case library](https://github.com/rapip-na/game/blob/main/app/Services/DetectiveCaseLibraryService.php): `app/Services/DetectiveCaseLibraryService.php`
- [Room state](https://github.com/rapip-na/game/blob/main/app/Models/DetectiveRoom.php): `app/Models/DetectiveRoom.php`
- [Case content](https://github.com/rapip-na/game/blob/main/app/Models/DetectiveCase.php): `app/Models/DetectiveCase.php`
- [Team state](https://github.com/rapip-na/game/blob/main/app/Models/DetectiveTeam.php): `app/Models/DetectiveTeam.php`
- [Player state](https://github.com/rapip-na/game/blob/main/app/Models/DetectivePlayer.php): `app/Models/DetectivePlayer.php`
- [Team questions](https://github.com/rapip-na/game/blob/main/app/Models/DetectiveQuestion.php): `app/Models/DetectiveQuestion.php`
- [Room update event](https://github.com/rapip-na/game/blob/main/app/Events/DetectiveRoomUpdated.php): `app/Events/DetectiveRoomUpdated.php`

### Siapa Kembaranku

- [Twin game flow](https://github.com/rapip-na/game/blob/main/app/Http/Controllers/SiapaKembarankuController.php): `app/Http/Controllers/SiapaKembarankuController.php`
- [Game rounds](https://github.com/rapip-na/game/blob/main/app/Models/TwinGame.php): `app/Models/TwinGame.php`
- [Players and logos](https://github.com/rapip-na/game/blob/main/app/Models/TwinPlayer.php): `app/Models/TwinPlayer.php`
- [Player scans](https://github.com/rapip-na/game/blob/main/app/Models/TwinScan.php): `app/Models/TwinScan.php`
- [Round votes](https://github.com/rapip-na/game/blob/main/app/Models/TwinVote.php): `app/Models/TwinVote.php`
- [Game state event](https://github.com/rapip-na/game/blob/main/app/Events/TwinGameStateChanged.php): `app/Events/TwinGameStateChanged.php`

### Other Games

- [Speaking Roulette](https://github.com/rapip-na/game/blob/main/app/Http/Controllers/SpeakingController.php): `app/Http/Controllers/SpeakingController.php`
- [Speaking prompts](https://github.com/rapip-na/game/blob/main/app/Services/SpeakingService.php): `app/Services/SpeakingService.php`
- [Speak Up page](https://github.com/rapip-na/game/blob/main/app/Http/Controllers/SpeakUpController.php): `app/Http/Controllers/SpeakUpController.php`
- [Speak Up client](https://github.com/rapip-na/game/blob/main/public/js/speak-up/app.js): `public/js/speak-up/app.js`
- [Order game flow](https://github.com/rapip-na/game/blob/main/app/Http/Controllers/SusunUrutanController.php): `app/Http/Controllers/SusunUrutanController.php`
- [Ordering logic](https://github.com/rapip-na/game/blob/main/app/Services/SusunUrutanService.php): `app/Services/SusunUrutanService.php`

### Admin and Suggestions

- [Suggestion intake](https://github.com/rapip-na/game/blob/main/app/Http/Controllers/GameSuggestionController.php): `app/Http/Controllers/GameSuggestionController.php`
- [Game suggestions](https://github.com/rapip-na/game/blob/main/app/Models/GameSuggestion.php): `app/Models/GameSuggestion.php`
- [Admin management](https://github.com/rapip-na/game/blob/main/app/Http/Controllers/AdminController.php): `app/Http/Controllers/AdminController.php`
- [Admin authentication](https://github.com/rapip-na/game/blob/main/app/Http/Middleware/EnsureAdminAuthenticated.php): `app/Http/Middleware/EnsureAdminAuthenticated.php`
- [Suggestion form](https://github.com/rapip-na/game/blob/main/resources/views/suggestions/create.blade.php): `resources/views/suggestions/create.blade.php`
- [Admin dashboard](https://github.com/rapip-na/game/blob/main/resources/views/admin/dashboard.blade.php): `resources/views/admin/dashboard.blade.php`

### Other components

- **Player or host**

## Connections

- Player or host → Web routes: requests pages (evidence: `routes/web.php`)
- Web routes → Detective room flow: routes detective (evidence: `routes/web.php`)
- Web routes → Twin game flow: routes twin game (evidence: `routes/web.php`)
- Web routes → Speaking Roulette: routes speaking (evidence: `routes/web.php`)
- Web routes → Speak Up page: routes Speak Up (evidence: `routes/web.php`)
- Web routes → Order game flow: routes ordering (evidence: `routes/web.php`)
- Web routes → Suggestion intake: routes suggestions (evidence: `routes/web.php`)
- Web routes → Admin management: routes admin (evidence: `routes/web.php`)
- Web routes → Maintenance gate: applies game gate (evidence: `routes/web.php`)
- Web routes → Admin authentication: applies admin gate (evidence: `routes/web.php`)
- Maintenance gate → Maintenance records: checks status (evidence: `app/Http/Middleware/CheckGameMaintenance.php`)
- Detective room flow → Case library: ensures cases (evidence: `app/Http/Controllers/DetectiveController.php`)
- Detective room flow → Room state: updates room (evidence: `app/Http/Controllers/DetectiveController.php`)
- Detective room flow → Case content: loads cases (evidence: `app/Http/Controllers/DetectiveController.php`)
- Detective room flow → Team state: updates teams (evidence: `app/Http/Controllers/DetectiveController.php`)
- Detective room flow → Player state: manages players (evidence: `app/Http/Controllers/DetectiveController.php`)
- Detective room flow → Team questions: updates questions (evidence: `app/Http/Controllers/DetectiveController.php`)
- Detective room flow → Room update event: broadcasts updates (evidence: `app/Http/Controllers/DetectiveController.php`)
- Room state → Case content: belongs to (evidence: `app/Models/DetectiveRoom.php`)
- Room state → Team state: has teams (evidence: `app/Models/DetectiveRoom.php`)
- Room state → Player state: has players (evidence: `app/Models/DetectiveRoom.php`)
- Room state → Team questions: has questions (evidence: `app/Models/DetectiveRoom.php`)
- Team state → Player state: has players (evidence: `app/Models/DetectiveTeam.php`)
- Team state → Team questions: has questions (evidence: `app/Models/DetectiveTeam.php`)
- Twin game flow → Game rounds: manages rounds (evidence: `app/Http/Controllers/SiapaKembarankuController.php`)
- Twin game flow → Players and logos: manages players (evidence: `app/Http/Controllers/SiapaKembarankuController.php`)
- Twin game flow → Player scans: records scans (evidence: `app/Http/Controllers/SiapaKembarankuController.php`)
- Twin game flow → Round votes: counts votes (evidence: `app/Http/Controllers/SiapaKembarankuController.php`)
- Twin game flow → Game state event: dispatches state (evidence: `app/Http/Controllers/SiapaKembarankuController.php`)
- Game rounds → Players and logos: has players (evidence: `app/Models/TwinGame.php`)
- Speaking Roulette → Speaking prompts: delegates prompts (evidence: `app/Http/Controllers/SpeakingController.php`)
- Speak Up page → Speak Up client: serves experience
- Order game flow → Ordering logic: delegates logic (evidence: `app/Http/Controllers/SusunUrutanController.php`)
- Suggestion intake → Game suggestions: creates suggestion (evidence: `app/Http/Controllers/GameSuggestionController.php`)
- Admin management → Maintenance records: manages status (evidence: `app/Http/Controllers/AdminController.php`)
- Admin management → Game suggestions: reviews suggestions (evidence: `app/Http/Controllers/AdminController.php`)
- Admin management → Admin dashboard: renders dashboard (evidence: `app/Http/Controllers/AdminController.php`)
- Suggestion intake → Suggestion form: renders form (evidence: `app/Http/Controllers/GameSuggestionController.php`)
