# k-mysa6505/minna-de-quiz architecture

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

- Interactive diagram: https://gitdiagram.com/k-mysa6505/minna-de-quiz
- Repository: https://github.com/k-mysa6505/minna-de-quiz

## Overview

みんクイ is a real-time multiplayer quiz game: players create questions, answer one another’s questions, predict outcomes, and see results, while a separate screen mode displays game progress and rankings. The player route coordinates room state and game phases; service modules persist and subscribe to game data, and Firebase Functions handle server-side game flow, presence, replay, and room operations. Connections reflect the README and shown excerpts or SOURCE INDEX references; unsampled implementations and their internal links are not inferred.

Main entry points: [`app/room/[roomId]/page.tsx`](https://github.com/k-mysa6505/minna-de-quiz/blob/main/app/room/%5BroomId%5D/page.tsx) (Player Room), [`lib/firebase.ts`](https://github.com/k-mysa6505/minna-de-quiz/blob/main/lib/firebase.ts) (Firebase Setup), [`app/room/[roomId]/screen/hooks/useScreenData.ts`](https://github.com/k-mysa6505/minna-de-quiz/blob/main/app/room/%5BroomId%5D/screen/hooks/useScreenData.ts) (Screen Data), [`app/room/[roomId]/hooks/useGamePlay.ts`](https://github.com/k-mysa6505/minna-de-quiz/blob/main/app/room/%5BroomId%5D/hooks/useGamePlay.ts) (Play State)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and Rooms"]
  node_home["Home and Guide<br/>[page.tsx]"]
  node_create["Create Room<br/>[page.tsx]"]
  node_roomopts["Room Options"]
  node_join["Join Room<br/>[JoinRoomForm.tsx]"]
end

subgraph group_play["Player Game"]
  node_roompage["Player Room<br/>[page.tsx]"]
  node_roomdata["Room Data<br/>[useRoomData.ts]"]
  node_waiting["Waiting Phase<br/>[WaitingPhase.tsx]"]
  node_questioncreate["Question Creation"]
  node_gameplay["Gameplay<br/>[GamePlayPhase.tsx]"]
  node_playhook["Play State<br/>[useGamePlay.ts]"]
  node_final["Final Results"]
end

subgraph group_screen["Screen Mode"]
  node_screenpage["Screen Mode<br/>[page.tsx]"]
  node_screendata["Screen Data<br/>[useScreenData.ts]"]
  node_screens["Screen Displays<br/>[WaitingScreen.tsx]"]
end

subgraph group_backend["Services and Backend"]
  node_firebase["Firebase Setup<br/>[firebase.ts]"]
  node_auth["Authentication<br/>[authService.ts]"]
  node_playerdata["Player Service<br/>[playerService.ts]"]
  node_rooms["Room Service<br/>[roomService.ts]"]
  node_questions["Question Service<br/>[questionService.ts]"]
  node_games["Game Service<br/>[gameService.ts]"]
  node_reactions["Reaction Service<br/>[reactionService.ts]"]
  node_servicecore["Service Utilities"]
  node_functions["Game Functions<br/>[gameFlow.ts]"]
  node_presencefn["Presence Functions<br/>[presence.ts]"]
  node_roomfn["Room Functions<br/>[roomCommands.ts]"]
  node_replayfn["Replay Functions<br/>[replayFlow.ts]"]
end

node_players(("Players"))
node_firestore[("Firebase Data")]

node_players -->|"open game"| node_home
node_home -->|"start room"| node_create
node_home -->|"join room"| node_join
node_create -->|"configures"| node_roomopts
node_create -->|"creates room"| node_rooms
node_join -.->|"enters room"| node_roompage
node_players -->|"play"| node_roompage
node_roompage -->|"loads state"| node_roomdata
node_roompage -->|"renders phase"| node_waiting
node_roompage -->|"renders phase"| node_questioncreate
node_roompage -->|"renders phase"| node_gameplay
node_roompage -->|"renders phase"| node_final
node_gameplay -->|"uses game state"| node_playhook
node_playhook -->|"submits answers"| node_games
node_playhook -->|"loads questions"| node_questions
node_playhook -->|"updates scores"| node_playerdata
node_players -->|"view screen mode"| node_screenpage
node_screenpage -->|"loads screen data"| node_screendata
node_screenpage -->|"renders displays"| node_screens
node_screendata -->|"subscribes room"| node_rooms
node_screendata -->|"subscribes players"| node_playerdata
node_screendata -->|"subscribes answers"| node_games
node_screendata -->|"subscribes questions"| node_questions
node_screendata -->|"subscribes reactions"| node_reactions
node_auth -->|"uses auth client"| node_firebase
node_playerdata -->|"uses database client"| node_firebase
node_rooms -->|"uses database client"| node_firebase
node_questions -->|"uses database client"| node_firebase
node_games -->|"uses database client"| node_firebase
node_reactions -->|"uses database client"| node_firebase
node_firebase -->|"connects"| node_firestore
node_functions -.->|"handles game events"| node_firestore
node_presencefn -.->|"syncs presence"| node_firestore
node_roomfn -.->|"handles room commands"| node_firestore
node_replayfn -.->|"handles replay"| node_firestore

click node_home "https://github.com/k-mysa6505/minna-de-quiz/blob/main/app/page.tsx"
click node_create "https://github.com/k-mysa6505/minna-de-quiz/blob/main/app/create-room/page.tsx"
click node_roomopts "https://github.com/k-mysa6505/minna-de-quiz/blob/main/app/create-room/RoomOptionsForm.tsx"
click node_join "https://github.com/k-mysa6505/minna-de-quiz/blob/main/app/join-room/JoinRoomForm.tsx"
click node_roompage "https://github.com/k-mysa6505/minna-de-quiz/blob/main/app/room/%5BroomId%5D/page.tsx"
click node_roomdata "https://github.com/k-mysa6505/minna-de-quiz/blob/main/app/room/%5BroomId%5D/hooks/useRoomData.ts"
click node_waiting "https://github.com/k-mysa6505/minna-de-quiz/blob/main/app/room/%5BroomId%5D/phases/WaitingPhase.tsx"
click node_questioncreate "https://github.com/k-mysa6505/minna-de-quiz/blob/main/app/room/%5BroomId%5D/phases/QuestionCreationPhase.tsx"
click node_gameplay "https://github.com/k-mysa6505/minna-de-quiz/blob/main/app/room/%5BroomId%5D/phases/GamePlayPhase.tsx"
click node_playhook "https://github.com/k-mysa6505/minna-de-quiz/blob/main/app/room/%5BroomId%5D/hooks/useGamePlay.ts"
click node_final "https://github.com/k-mysa6505/minna-de-quiz/blob/main/app/room/%5BroomId%5D/phases/FinalResultPhase.tsx"
click node_screenpage "https://github.com/k-mysa6505/minna-de-quiz/blob/main/app/room/%5BroomId%5D/screen/page.tsx"
click node_screendata "https://github.com/k-mysa6505/minna-de-quiz/blob/main/app/room/%5BroomId%5D/screen/hooks/useScreenData.ts"
click node_screens "https://github.com/k-mysa6505/minna-de-quiz/blob/main/app/room/%5BroomId%5D/screen/components/WaitingScreen.tsx"
click node_firebase "https://github.com/k-mysa6505/minna-de-quiz/blob/main/lib/firebase.ts"
click node_auth "https://github.com/k-mysa6505/minna-de-quiz/blob/main/lib/services/auth/authService.ts"
click node_playerdata "https://github.com/k-mysa6505/minna-de-quiz/blob/main/lib/services/auth/playerService.ts"
click node_rooms "https://github.com/k-mysa6505/minna-de-quiz/blob/main/lib/services/room/roomService.ts"
click node_questions "https://github.com/k-mysa6505/minna-de-quiz/blob/main/lib/services/game/questionService.ts"
click node_games "https://github.com/k-mysa6505/minna-de-quiz/blob/main/lib/services/game/gameService.ts"
click node_reactions "https://github.com/k-mysa6505/minna-de-quiz/blob/main/lib/services/game/reactionService.ts"
click node_servicecore "https://github.com/k-mysa6505/minna-de-quiz/tree/main/lib/services/core"
click node_functions "https://github.com/k-mysa6505/minna-de-quiz/blob/main/functions/src/game/gameFlow.ts"
click node_presencefn "https://github.com/k-mysa6505/minna-de-quiz/blob/main/functions/src/presence/presence.ts"
click node_roomfn "https://github.com/k-mysa6505/minna-de-quiz/blob/main/functions/src/room/roomCommands.ts"
click node_replayfn "https://github.com/k-mysa6505/minna-de-quiz/blob/main/functions/src/game/replayFlow.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_home,node_create,node_roomopts,node_join toneBlue
class node_roompage,node_roomdata,node_waiting,node_questioncreate,node_gameplay,node_playhook,node_final,node_firestore toneAmber
class node_screenpage,node_screendata,node_screens toneMint
class node_firebase,node_auth,node_playerdata,node_rooms,node_questions,node_games,node_reactions,node_servicecore,node_functions,node_presencefn,node_roomfn,node_replayfn toneRose
class node_players toneIndigo
```

## Components

### Entry and Rooms

- [Home and Guide](https://github.com/k-mysa6505/minna-de-quiz/blob/main/app/page.tsx): `app/page.tsx`
- [Create Room](https://github.com/k-mysa6505/minna-de-quiz/blob/main/app/create-room/page.tsx): `app/create-room/page.tsx`
- [Room Options](https://github.com/k-mysa6505/minna-de-quiz/blob/main/app/create-room/RoomOptionsForm.tsx): `app/create-room/RoomOptionsForm.tsx`
- [Join Room](https://github.com/k-mysa6505/minna-de-quiz/blob/main/app/join-room/JoinRoomForm.tsx): `app/join-room/JoinRoomForm.tsx`

### Player Game

- [Player Room](https://github.com/k-mysa6505/minna-de-quiz/blob/main/app/room/%5BroomId%5D/page.tsx): `app/room/[roomId]/page.tsx`
- [Room Data](https://github.com/k-mysa6505/minna-de-quiz/blob/main/app/room/%5BroomId%5D/hooks/useRoomData.ts): `app/room/[roomId]/hooks/useRoomData.ts`
- [Waiting Phase](https://github.com/k-mysa6505/minna-de-quiz/blob/main/app/room/%5BroomId%5D/phases/WaitingPhase.tsx): `app/room/[roomId]/phases/WaitingPhase.tsx`
- [Question Creation](https://github.com/k-mysa6505/minna-de-quiz/blob/main/app/room/%5BroomId%5D/phases/QuestionCreationPhase.tsx): `app/room/[roomId]/phases/QuestionCreationPhase.tsx`
- [Gameplay](https://github.com/k-mysa6505/minna-de-quiz/blob/main/app/room/%5BroomId%5D/phases/GamePlayPhase.tsx): `app/room/[roomId]/phases/GamePlayPhase.tsx`
- [Play State](https://github.com/k-mysa6505/minna-de-quiz/blob/main/app/room/%5BroomId%5D/hooks/useGamePlay.ts): `app/room/[roomId]/hooks/useGamePlay.ts`
- [Final Results](https://github.com/k-mysa6505/minna-de-quiz/blob/main/app/room/%5BroomId%5D/phases/FinalResultPhase.tsx): `app/room/[roomId]/phases/FinalResultPhase.tsx`

### Screen Mode

- [Screen Mode](https://github.com/k-mysa6505/minna-de-quiz/blob/main/app/room/%5BroomId%5D/screen/page.tsx): `app/room/[roomId]/screen/page.tsx`
- [Screen Data](https://github.com/k-mysa6505/minna-de-quiz/blob/main/app/room/%5BroomId%5D/screen/hooks/useScreenData.ts): `app/room/[roomId]/screen/hooks/useScreenData.ts`
- [Screen Displays](https://github.com/k-mysa6505/minna-de-quiz/blob/main/app/room/%5BroomId%5D/screen/components/WaitingScreen.tsx): `app/room/[roomId]/screen/components/WaitingScreen.tsx`

### Services and Backend

- [Firebase Setup](https://github.com/k-mysa6505/minna-de-quiz/blob/main/lib/firebase.ts): `lib/firebase.ts`
- [Authentication](https://github.com/k-mysa6505/minna-de-quiz/blob/main/lib/services/auth/authService.ts): `lib/services/auth/authService.ts`
- [Player Service](https://github.com/k-mysa6505/minna-de-quiz/blob/main/lib/services/auth/playerService.ts): `lib/services/auth/playerService.ts`
- [Room Service](https://github.com/k-mysa6505/minna-de-quiz/blob/main/lib/services/room/roomService.ts): `lib/services/room/roomService.ts`
- [Question Service](https://github.com/k-mysa6505/minna-de-quiz/blob/main/lib/services/game/questionService.ts): `lib/services/game/questionService.ts`
- [Game Service](https://github.com/k-mysa6505/minna-de-quiz/blob/main/lib/services/game/gameService.ts): `lib/services/game/gameService.ts`
- [Reaction Service](https://github.com/k-mysa6505/minna-de-quiz/blob/main/lib/services/game/reactionService.ts): `lib/services/game/reactionService.ts`
- [Service Utilities](https://github.com/k-mysa6505/minna-de-quiz/tree/main/lib/services/core): `lib/services/core`
- [Game Functions](https://github.com/k-mysa6505/minna-de-quiz/blob/main/functions/src/game/gameFlow.ts): `functions/src/game/gameFlow.ts`
- [Presence Functions](https://github.com/k-mysa6505/minna-de-quiz/blob/main/functions/src/presence/presence.ts): `functions/src/presence/presence.ts`
- [Room Functions](https://github.com/k-mysa6505/minna-de-quiz/blob/main/functions/src/room/roomCommands.ts): `functions/src/room/roomCommands.ts`
- [Replay Functions](https://github.com/k-mysa6505/minna-de-quiz/blob/main/functions/src/game/replayFlow.ts): `functions/src/game/replayFlow.ts`

### Other components

- **Players**
- **Firebase Data**

## Connections

- Players → Home and Guide: open game (evidence: `README.md`)
- Home and Guide → Create Room: start room (evidence: `app/page.tsx`)
- Home and Guide → Join Room: join room (evidence: `app/page.tsx`)
- Create Room → Room Options: configures (evidence: `app/create-room/page.tsx`)
- Create Room → Room Service: creates room (evidence: `app/create-room/page.tsx`)
- Join Room → Player Room: enters room
- Players → Player Room: play (evidence: `README.md`)
- Player Room → Room Data: loads state (evidence: `app/room/[roomId]/page.tsx`)
- Player Room → Waiting Phase: renders phase (evidence: `app/room/[roomId]/page.tsx`)
- Player Room → Question Creation: renders phase (evidence: `app/room/[roomId]/page.tsx`)
- Player Room → Gameplay: renders phase (evidence: `app/room/[roomId]/page.tsx`)
- Player Room → Final Results: renders phase (evidence: `app/room/[roomId]/page.tsx`)
- Gameplay → Play State: uses game state
- Play State → Game Service: submits answers (evidence: `app/room/[roomId]/hooks/useGamePlay.ts`)
- Play State → Question Service: loads questions (evidence: `app/room/[roomId]/hooks/useGamePlay.ts`)
- Play State → Player Service: updates scores (evidence: `app/room/[roomId]/hooks/useGamePlay.ts`)
- Players → Screen Mode: view screen mode (evidence: `README.md`)
- Screen Mode → Screen Data: loads screen data (evidence: `app/room/[roomId]/screen/page.tsx`)
- Screen Mode → Screen Displays: renders displays (evidence: `app/room/[roomId]/screen/page.tsx`)
- Screen Data → Room Service: subscribes room (evidence: `app/room/[roomId]/screen/hooks/useScreenData.ts`)
- Screen Data → Player Service: subscribes players (evidence: `app/room/[roomId]/screen/hooks/useScreenData.ts`)
- Screen Data → Game Service: subscribes answers (evidence: `app/room/[roomId]/screen/hooks/useScreenData.ts`)
- Screen Data → Question Service: subscribes questions (evidence: `app/room/[roomId]/screen/hooks/useScreenData.ts`)
- Screen Data → Reaction Service: subscribes reactions (evidence: `app/room/[roomId]/screen/hooks/useScreenData.ts`)
- Authentication → Firebase Setup: uses auth client (evidence: `lib/services/auth/authService.ts`)
- Player Service → Firebase Setup: uses database client (evidence: `lib/services/auth/playerService.ts`)
- Room Service → Firebase Setup: uses database client (evidence: `lib/services/room/roomService.ts`)
- Question Service → Firebase Setup: uses database client (evidence: `lib/services/game/questionService.ts`)
- Game Service → Firebase Setup: uses database client (evidence: `lib/services/game/gameService.ts`)
- Reaction Service → Firebase Setup: uses database client (evidence: `lib/services/game/reactionService.ts`)
- Firebase Setup → Firebase Data: connects (evidence: `lib/firebase.ts`)
- Game Functions → Firebase Data: handles game events
- Presence Functions → Firebase Data: syncs presence
- Room Functions → Firebase Data: handles room commands
- Replay Functions → Firebase Data: handles replay
