# mitsubishi-24-25/deal-or-no-deal architecture

> Architecture diagram of the GitHub repository mitsubishi-24-25/deal-or-no-deal, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mitsubishi-24-25/deal-or-no-deal
- Repository: https://github.com/mitsubishi-24-25/deal-or-no-deal

## Overview

Deal or No Deal is a multi-screen classroom game. Participants use the TV display and separate controller, Lucky Star, and teacher interfaces; the server owns game state and advances play through name selection, briefcase questions, banker offers, and the ending. The server also serves the interface pages and can persist state to Supabase. The README is empty and client source was not sampled, so client-to-server interactions are shown as unverified rather than asserted.

Main entry points: [`server/index.js`](https://github.com/mitsubishi-24-25/deal-or-no-deal/blob/main/server/index.js) (HTTP and Socket Server), [`public/tv/index.html`](https://github.com/mitsubishi-24-25/deal-or-no-deal/blob/main/public/tv/index.html) (TV Display), [`public/controller/index.html`](https://github.com/mitsubishi-24-25/deal-or-no-deal/blob/main/public/controller/index.html) (Controller), [`public/controller2/index.html`](https://github.com/mitsubishi-24-25/deal-or-no-deal/blob/main/public/controller2/index.html) (Second Controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["Game Interfaces"]
  node_tv["TV Display<br/>[index.html]"]
  node_controller["Controller<br/>[index.html]"]
  node_controller2["Second Controller<br/>[index.html]"]
  node_lucky["Lucky Star<br/>[index.html]"]
  node_teacher["Teacher Panel<br/>[index.html]"]
end

subgraph group_runtime["Game Runtime"]
  node_server["HTTP and Socket Server<br/>[index.js]"]
  node_state["Game State and Phases<br/>[index.js]"]
  node_roulette["Name Roulette<br/>[index.js]"]
  node_briefcases["Briefcase Gameplay<br/>[index.js]"]
  node_answer["Answer Judging<br/>[index.js]"]
  node_banker["Banker Calls and Offers<br/>[index.js]"]
end

subgraph group_content["Game Rules and Content"]
  node_config["Game Configuration<br/>[config.js]"]
  node_questions["Question Bank<br/>[questions.js]"]
  node_formula["Offer Formula<br/>[bankerFormula.js]"]
end

subgraph group_storage["Persistence"]
  node_persistence["State Persistence<br/>[persistence.js]"]
end

node_participants(("Players and Host"))
node_supabase[("Supabase")]

node_participants -.->|"view game"| node_tv
node_participants -.->|"control game"| node_controller
node_participants -.->|"control game"| node_controller2
node_participants -.->|"submit answers"| node_lucky
node_participants -.->|"manage game"| node_teacher
node_server -->|"serves page"| node_tv
node_server -->|"serves page"| node_controller
node_server -->|"serves page"| node_controller2
node_server -->|"serves page"| node_lucky
node_server -->|"serves page"| node_teacher
node_tv -.->|"syncs game"| node_server
node_controller -.->|"sends actions"| node_server
node_controller2 -.->|"sends actions"| node_server
node_lucky -.->|"submits answer"| node_server
node_teacher -.->|"sends actions"| node_server
node_server -->|"manages"| node_state
node_state -->|"tracks selection"| node_roulette
node_state -->|"tracks openings"| node_briefcases
node_state -->|"tracks judgments"| node_answer
node_state -->|"tracks calls"| node_banker
node_server -->|"imports settings"| node_config
node_server -->|"imports questions"| node_questions
node_server -->|"imports formula"| node_formula
node_server -->|"imports persistence"| node_persistence
node_banker -.->|"computes offers"| node_formula
node_persistence -->|"loads and saves"| node_supabase

click node_tv "https://github.com/mitsubishi-24-25/deal-or-no-deal/blob/main/public/tv/index.html"
click node_controller "https://github.com/mitsubishi-24-25/deal-or-no-deal/blob/main/public/controller/index.html"
click node_controller2 "https://github.com/mitsubishi-24-25/deal-or-no-deal/blob/main/public/controller2/index.html"
click node_lucky "https://github.com/mitsubishi-24-25/deal-or-no-deal/blob/main/public/luckystar/index.html"
click node_teacher "https://github.com/mitsubishi-24-25/deal-or-no-deal/blob/main/public/teacher/index.html"
click node_server "https://github.com/mitsubishi-24-25/deal-or-no-deal/blob/main/server/index.js"
click node_state "https://github.com/mitsubishi-24-25/deal-or-no-deal/blob/main/server/index.js"
click node_roulette "https://github.com/mitsubishi-24-25/deal-or-no-deal/blob/main/server/index.js"
click node_briefcases "https://github.com/mitsubishi-24-25/deal-or-no-deal/blob/main/server/index.js"
click node_answer "https://github.com/mitsubishi-24-25/deal-or-no-deal/blob/main/server/index.js"
click node_banker "https://github.com/mitsubishi-24-25/deal-or-no-deal/blob/main/server/index.js"
click node_config "https://github.com/mitsubishi-24-25/deal-or-no-deal/blob/main/server/config.js"
click node_questions "https://github.com/mitsubishi-24-25/deal-or-no-deal/blob/main/server/questions.js"
click node_formula "https://github.com/mitsubishi-24-25/deal-or-no-deal/blob/main/server/bankerFormula.js"
click node_persistence "https://github.com/mitsubishi-24-25/deal-or-no-deal/blob/main/server/persistence.js"

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_tv,node_controller,node_controller2,node_lucky,node_teacher toneBlue
class node_server,node_state,node_roulette,node_briefcases,node_answer,node_banker,node_supabase toneAmber
class node_config,node_questions,node_formula toneMint
class node_persistence toneRose
class node_participants toneIndigo
```

## Components

### Game Interfaces

- [TV Display](https://github.com/mitsubishi-24-25/deal-or-no-deal/blob/main/public/tv/index.html): `public/tv/index.html`
- [Controller](https://github.com/mitsubishi-24-25/deal-or-no-deal/blob/main/public/controller/index.html): `public/controller/index.html`
- [Second Controller](https://github.com/mitsubishi-24-25/deal-or-no-deal/blob/main/public/controller2/index.html): `public/controller2/index.html`
- [Lucky Star](https://github.com/mitsubishi-24-25/deal-or-no-deal/blob/main/public/luckystar/index.html): `public/luckystar/index.html`
- [Teacher Panel](https://github.com/mitsubishi-24-25/deal-or-no-deal/blob/main/public/teacher/index.html): `public/teacher/index.html`

### Game Runtime

- [HTTP and Socket Server](https://github.com/mitsubishi-24-25/deal-or-no-deal/blob/main/server/index.js): `server/index.js`
- [Game State and Phases](https://github.com/mitsubishi-24-25/deal-or-no-deal/blob/main/server/index.js): `server/index.js`
- [Name Roulette](https://github.com/mitsubishi-24-25/deal-or-no-deal/blob/main/server/index.js): `server/index.js`
- [Briefcase Gameplay](https://github.com/mitsubishi-24-25/deal-or-no-deal/blob/main/server/index.js): `server/index.js`
- [Answer Judging](https://github.com/mitsubishi-24-25/deal-or-no-deal/blob/main/server/index.js): `server/index.js`
- [Banker Calls and Offers](https://github.com/mitsubishi-24-25/deal-or-no-deal/blob/main/server/index.js): `server/index.js`

### Game Rules and Content

- [Game Configuration](https://github.com/mitsubishi-24-25/deal-or-no-deal/blob/main/server/config.js): `server/config.js`
- [Question Bank](https://github.com/mitsubishi-24-25/deal-or-no-deal/blob/main/server/questions.js): `server/questions.js`
- [Offer Formula](https://github.com/mitsubishi-24-25/deal-or-no-deal/blob/main/server/bankerFormula.js): `server/bankerFormula.js`

### Persistence

- [State Persistence](https://github.com/mitsubishi-24-25/deal-or-no-deal/blob/main/server/persistence.js): `server/persistence.js`

### Other components

- **Players and Host**
- **Supabase**

## Connections

- Players and Host → TV Display: view game
- Players and Host → Controller: control game
- Players and Host → Second Controller: control game
- Players and Host → Lucky Star: submit answers
- Players and Host → Teacher Panel: manage game
- HTTP and Socket Server → TV Display: serves page (evidence: `server/index.js`)
- HTTP and Socket Server → Controller: serves page (evidence: `server/index.js`)
- HTTP and Socket Server → Second Controller: serves page (evidence: `server/index.js`)
- HTTP and Socket Server → Lucky Star: serves page (evidence: `server/index.js`)
- HTTP and Socket Server → Teacher Panel: serves page (evidence: `server/index.js`)
- TV Display → HTTP and Socket Server: syncs game
- Controller → HTTP and Socket Server: sends actions
- Second Controller → HTTP and Socket Server: sends actions
- Lucky Star → HTTP and Socket Server: submits answer
- Teacher Panel → HTTP and Socket Server: sends actions
- HTTP and Socket Server → Game State and Phases: manages (evidence: `server/index.js`)
- Game State and Phases → Name Roulette: tracks selection (evidence: `server/index.js`)
- Game State and Phases → Briefcase Gameplay: tracks openings (evidence: `server/index.js`)
- Game State and Phases → Answer Judging: tracks judgments (evidence: `server/index.js`)
- Game State and Phases → Banker Calls and Offers: tracks calls (evidence: `server/index.js`)
- HTTP and Socket Server → Game Configuration: imports settings (evidence: `server/index.js`)
- HTTP and Socket Server → Question Bank: imports questions (evidence: `server/index.js`)
- HTTP and Socket Server → Offer Formula: imports formula (evidence: `server/index.js`)
- HTTP and Socket Server → State Persistence: imports persistence (evidence: `server/index.js`)
- Banker Calls and Offers → Offer Formula: computes offers (evidence: `server/index.js`)
- State Persistence → Supabase: loads and saves (evidence: `server/persistence.js`)
