# sahilbhatti292005-cloud/techkbc architecture

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

- Interactive diagram: https://gitdiagram.com/sahilbhatti292005-cloud/techkbc
- Repository: https://github.com/sahilbhatti292005-cloud/techkbc

## Overview

TechKBC is a browser-based, multi-role trivia game. A host selects a role; the app routes users to game controls, team submission, or a projected display, while shared game state is synchronized through Firebase Realtime Database. The sampled code shows Fastest Finger First, timed Hot Seat questions, audience voting, lifelines, scoring, and game controls. AdminMobile handles score and team maintenance, while AdminLaptop controls rounds and timers. The README is a generic AI Studio setup description; feature details come from sampled source. Unsampled component behavior is represented only where supported by the source index.

Main entry points: [`src/App.tsx`](https://github.com/sahilbhatti292005-cloud/techkbc/blob/main/src/App.tsx) (Role Router), [`src/components/AdminLaptop.tsx`](https://github.com/sahilbhatti292005-cloud/techkbc/blob/main/src/components/AdminLaptop.tsx) (Host Controls), [`src/components/Volunteer.tsx`](https://github.com/sahilbhatti292005-cloud/techkbc/blob/main/src/components/Volunteer.tsx) (Team Submission), [`src/components/AdminMobile.tsx`](https://github.com/sahilbhatti292005-cloud/techkbc/blob/main/src/components/AdminMobile.tsx) (Score Controls)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App and Routing"]
  node_app["Role Router<br/>[App.tsx]"]
end

subgraph group_gameplay["Game Operations"]
  node_adminlaptop["Host Controls<br/>[AdminLaptop.tsx]"]
  node_adminmobile["Score Controls<br/>[AdminMobile.tsx]"]
  node_questions["Question Bank<br/>[constants.ts]"]
end

subgraph group_audience["Player and Display"]
  node_volunteer["Team Submission<br/>[Volunteer.tsx]"]
  node_display["Game Display<br/>[Display.tsx]"]
end

subgraph group_state["Shared State"]
  node_model["Game State Types<br/>[types.ts]"]
  node_firebaseclient["Firebase Client<br/>[firebase.ts]"]
  node_realtimedb[("Realtime Database")]
end

node_players(("Game Users"))

node_players -->|"choose role"| node_app
node_app -->|"routes to"| node_adminlaptop
node_app -->|"routes to"| node_adminmobile
node_app -->|"routes to"| node_volunteer
node_app -->|"routes to"| node_display
node_app -->|"syncs game state"| node_realtimedb
node_adminlaptop -->|"uses questions"| node_questions
node_adminlaptop -->|"updates rounds"| node_realtimedb
node_adminmobile -->|"updates scores"| node_realtimedb
node_volunteer -->|"submits answers"| node_realtimedb
node_volunteer -->|"casts votes"| node_realtimedb
node_display -->|"reads server time"| node_firebaseclient
node_firebaseclient -->|"connects to"| node_realtimedb
node_app -->|"uses state types"| node_model

click node_app "https://github.com/sahilbhatti292005-cloud/techkbc/blob/main/src/App.tsx"
click node_adminlaptop "https://github.com/sahilbhatti292005-cloud/techkbc/blob/main/src/components/AdminLaptop.tsx"
click node_adminmobile "https://github.com/sahilbhatti292005-cloud/techkbc/blob/main/src/components/AdminMobile.tsx"
click node_questions "https://github.com/sahilbhatti292005-cloud/techkbc/blob/main/src/constants.ts"
click node_volunteer "https://github.com/sahilbhatti292005-cloud/techkbc/blob/main/src/components/Volunteer.tsx"
click node_display "https://github.com/sahilbhatti292005-cloud/techkbc/blob/main/src/components/Display.tsx"
click node_model "https://github.com/sahilbhatti292005-cloud/techkbc/blob/main/src/types.ts"
click node_firebaseclient "https://github.com/sahilbhatti292005-cloud/techkbc/blob/main/src/lib/firebase.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_app,node_players toneBlue
class node_adminlaptop,node_adminmobile,node_questions toneAmber
class node_volunteer,node_display toneMint
class node_model,node_firebaseclient,node_realtimedb toneRose
```

## Components

### App and Routing

- [Role Router](https://github.com/sahilbhatti292005-cloud/techkbc/blob/main/src/App.tsx): `src/App.tsx`

### Game Operations

- [Host Controls](https://github.com/sahilbhatti292005-cloud/techkbc/blob/main/src/components/AdminLaptop.tsx): `src/components/AdminLaptop.tsx`
- [Score Controls](https://github.com/sahilbhatti292005-cloud/techkbc/blob/main/src/components/AdminMobile.tsx): `src/components/AdminMobile.tsx`
- [Question Bank](https://github.com/sahilbhatti292005-cloud/techkbc/blob/main/src/constants.ts): `src/constants.ts`

### Player and Display

- [Team Submission](https://github.com/sahilbhatti292005-cloud/techkbc/blob/main/src/components/Volunteer.tsx): `src/components/Volunteer.tsx`
- [Game Display](https://github.com/sahilbhatti292005-cloud/techkbc/blob/main/src/components/Display.tsx): `src/components/Display.tsx`

### Shared State

- [Game State Types](https://github.com/sahilbhatti292005-cloud/techkbc/blob/main/src/types.ts): `src/types.ts`
- [Firebase Client](https://github.com/sahilbhatti292005-cloud/techkbc/blob/main/src/lib/firebase.ts): `src/lib/firebase.ts`
- **Realtime Database**

### Other components

- **Game Users**

## Connections

- Game Users → Role Router: choose role (evidence: `src/App.tsx`)
- Role Router → Host Controls: routes to (evidence: `src/App.tsx`)
- Role Router → Score Controls: routes to (evidence: `src/App.tsx`)
- Role Router → Team Submission: routes to (evidence: `src/App.tsx`)
- Role Router → Game Display: routes to (evidence: `src/App.tsx`)
- Role Router → Realtime Database: syncs game state (evidence: `src/App.tsx`)
- Host Controls → Question Bank: uses questions (evidence: `src/components/AdminLaptop.tsx`)
- Host Controls → Realtime Database: updates rounds (evidence: `src/components/AdminLaptop.tsx`)
- Score Controls → Realtime Database: updates scores (evidence: `src/components/AdminMobile.tsx`)
- Team Submission → Realtime Database: submits answers (evidence: `src/components/Volunteer.tsx`)
- Team Submission → Realtime Database: casts votes (evidence: `src/components/Volunteer.tsx`)
- Game Display → Firebase Client: reads server time (evidence: `src/components/Display.tsx`)
- Firebase Client → Realtime Database: connects to (evidence: `src/lib/firebase.ts`)
- Role Router → Game State Types: uses state types (evidence: `src/App.tsx`)
