# bagadsrushti/ieee_onebrain architecture

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

- Interactive diagram: https://gitdiagram.com/bagadsrushti/ieee_onebrain
- Repository: https://github.com/bagadsrushti/ieee_onebrain

## Overview

One Brain is a real-time multiplayer clue-and-guessing game for college events. Players join a room, receive distinct clues, communicate to solve an answer, and can also compete in scheduled team events or head-to-head duels. The backend manages room gameplay, event queues and scoring, and duel rounds; the React app provides joining, play, audience, arena, leaderboard, and admin experiences. Socket.IO is the real-time boundary. Some subsystem details and client-server event pairings are not shown in the excerpts, so those links are omitted or marked unverified.

Main entry points: [`frontend/src/App.jsx`](https://github.com/bagadsrushti/ieee_onebrain/blob/main/frontend/src/App.jsx) (App Routing), [`backend/gameManager.js`](https://github.com/bagadsrushti/ieee_onebrain/blob/main/backend/gameManager.js) (Room Gameplay), [`backend/index.js`](https://github.com/bagadsrushti/ieee_onebrain/blob/main/backend/index.js) (HTTP and Socket Server), [`backend/duelManager.js`](https://github.com/bagadsrushti/ieee_onebrain/blob/main/backend/duelManager.js) (Duel Management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Player and Admin App"]
  node_app["App Routing<br/>[App.jsx]"]
  node_connection["Socket Context<br/>[SocketContext.jsx]"]
  node_landing["Join and Create<br/>[Landing.jsx]"]
  node_room["Room Experience<br/>[Room.jsx]"]
  node_lobby["Room Lobby<br/>[Lobby.jsx]"]
  node_duel_lobby["Duel Lobby<br/>[DuelLobby.jsx]"]
  node_game_ui["Gameplay UI<br/>[Game.jsx]"]
  node_admin_ui["Admin Panel<br/>[Admin.jsx]"]
  node_event_ui["Event Arena<br/>[Arena.jsx]"]
  node_audience_ui["Duel Audience<br/>[DuelAudience.jsx]"]
  node_leaderboard_ui["Leaderboard<br/>[Leaderboard.jsx]"]
end

subgraph group_realtime["Realtime Game Services"]
  node_backend["HTTP and Socket Server<br/>[index.js]"]
  node_socket_routes["Socket Event Routes<br/>[socket.js]"]
  node_rooms["Room Gameplay<br/>[gameManager.js]"]
end

subgraph group_competition["Events and Duels"]
  node_duels["Duel Management<br/>[duelManager.js]"]
  node_events["Event Management<br/>[eventManager.js]"]
end

subgraph group_gamecore["Game Rules and Scoring"]
  node_rules["Player-Count Rules<br/>[gameRules.js]"]
  node_categories["Challenge Categories<br/>[categories.js]"]
  node_clues["Clue Distribution<br/>[dealClues.js]"]
  node_answers["Answer Matching<br/>[answerMatcher.js]"]
  node_usage["Usage Tracking<br/>[usageTracker.js]"]
end

node_players(("Players and Hosts"))

node_players -->|"use app"| node_app
node_app -->|"routes to"| node_landing
node_app -->|"routes to"| node_room
node_app -->|"routes to"| node_admin_ui
node_app -->|"routes to"| node_event_ui
node_app -->|"routes to"| node_audience_ui
node_app -->|"routes to"| node_leaderboard_ui
node_app -->|"provides context"| node_connection
node_room -->|"renders"| node_lobby
node_room -->|"renders"| node_duel_lobby
node_room -->|"renders"| node_game_ui
node_connection -.->|"connects by Socket.IO"| node_backend
node_backend -->|"initializes"| node_socket_routes
node_socket_routes -->|"routes gameplay"| node_rooms
node_socket_routes -->|"routes duel actions"| node_duels
node_socket_routes -->|"routes event actions"| node_events
node_duels -->|"creates team rooms"| node_rooms
node_rooms -->|"queries team rank"| node_events
node_rooms -->|"loads rules"| node_rules
node_rooms -->|"uses categories"| node_categories
node_rooms -->|"checks guesses"| node_answers
node_rooms -->|"deals clues"| node_clues
node_duels -->|"loads rules"| node_rules
node_duels -->|"checks guesses"| node_answers
node_duels -->|"deals clues"| node_clues
node_backend -->|"serves usage data"| node_usage
node_landing -.->|"uses socket actions"| node_connection
node_game_ui -.->|"uses game state"| node_connection
node_admin_ui -.->|"uses admin APIs"| node_backend
node_event_ui -.->|"loads event data"| node_backend
node_audience_ui -.->|"loads duel state"| node_backend
node_leaderboard_ui -.->|"loads rankings"| node_backend

click node_app "https://github.com/bagadsrushti/ieee_onebrain/blob/main/frontend/src/App.jsx"
click node_connection "https://github.com/bagadsrushti/ieee_onebrain/blob/main/frontend/src/SocketContext.jsx"
click node_landing "https://github.com/bagadsrushti/ieee_onebrain/blob/main/frontend/src/pages/Landing.jsx"
click node_room "https://github.com/bagadsrushti/ieee_onebrain/blob/main/frontend/src/pages/Room.jsx"
click node_lobby "https://github.com/bagadsrushti/ieee_onebrain/blob/main/frontend/src/components/Lobby.jsx"
click node_duel_lobby "https://github.com/bagadsrushti/ieee_onebrain/blob/main/frontend/src/components/DuelLobby.jsx"
click node_game_ui "https://github.com/bagadsrushti/ieee_onebrain/blob/main/frontend/src/components/Game.jsx"
click node_admin_ui "https://github.com/bagadsrushti/ieee_onebrain/blob/main/frontend/src/pages/Admin.jsx"
click node_event_ui "https://github.com/bagadsrushti/ieee_onebrain/blob/main/frontend/src/pages/Arena.jsx"
click node_audience_ui "https://github.com/bagadsrushti/ieee_onebrain/blob/main/frontend/src/pages/DuelAudience.jsx"
click node_leaderboard_ui "https://github.com/bagadsrushti/ieee_onebrain/blob/main/frontend/src/pages/Leaderboard.jsx"
click node_backend "https://github.com/bagadsrushti/ieee_onebrain/blob/main/backend/index.js"
click node_socket_routes "https://github.com/bagadsrushti/ieee_onebrain/blob/main/backend/socket.js"
click node_rooms "https://github.com/bagadsrushti/ieee_onebrain/blob/main/backend/gameManager.js"
click node_duels "https://github.com/bagadsrushti/ieee_onebrain/blob/main/backend/duelManager.js"
click node_events "https://github.com/bagadsrushti/ieee_onebrain/blob/main/backend/eventManager.js"
click node_rules "https://github.com/bagadsrushti/ieee_onebrain/blob/main/backend/config/gameRules.js"
click node_categories "https://github.com/bagadsrushti/ieee_onebrain/blob/main/backend/config/categories.js"
click node_clues "https://github.com/bagadsrushti/ieee_onebrain/blob/main/backend/utils/dealClues.js"
click node_answers "https://github.com/bagadsrushti/ieee_onebrain/blob/main/backend/utils/answerMatcher.js"
click node_usage "https://github.com/bagadsrushti/ieee_onebrain/blob/main/backend/utils/usageTracker.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_app,node_connection,node_landing,node_room,node_lobby,node_duel_lobby,node_game_ui,node_admin_ui,node_event_ui,node_audience_ui,node_leaderboard_ui toneBlue
class node_backend,node_socket_routes,node_rooms toneAmber
class node_duels,node_events toneMint
class node_rules,node_categories,node_clues,node_answers,node_usage toneRose
class node_players toneIndigo
```

## Components

### Player and Admin App

- [App Routing](https://github.com/bagadsrushti/ieee_onebrain/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Socket Context](https://github.com/bagadsrushti/ieee_onebrain/blob/main/frontend/src/SocketContext.jsx): `frontend/src/SocketContext.jsx`
- [Join and Create](https://github.com/bagadsrushti/ieee_onebrain/blob/main/frontend/src/pages/Landing.jsx): `frontend/src/pages/Landing.jsx`
- [Room Experience](https://github.com/bagadsrushti/ieee_onebrain/blob/main/frontend/src/pages/Room.jsx): `frontend/src/pages/Room.jsx`
- [Room Lobby](https://github.com/bagadsrushti/ieee_onebrain/blob/main/frontend/src/components/Lobby.jsx): `frontend/src/components/Lobby.jsx`
- [Duel Lobby](https://github.com/bagadsrushti/ieee_onebrain/blob/main/frontend/src/components/DuelLobby.jsx): `frontend/src/components/DuelLobby.jsx`
- [Gameplay UI](https://github.com/bagadsrushti/ieee_onebrain/blob/main/frontend/src/components/Game.jsx): `frontend/src/components/Game.jsx`
- [Admin Panel](https://github.com/bagadsrushti/ieee_onebrain/blob/main/frontend/src/pages/Admin.jsx): `frontend/src/pages/Admin.jsx`
- [Event Arena](https://github.com/bagadsrushti/ieee_onebrain/blob/main/frontend/src/pages/Arena.jsx): `frontend/src/pages/Arena.jsx`
- [Duel Audience](https://github.com/bagadsrushti/ieee_onebrain/blob/main/frontend/src/pages/DuelAudience.jsx): `frontend/src/pages/DuelAudience.jsx`
- [Leaderboard](https://github.com/bagadsrushti/ieee_onebrain/blob/main/frontend/src/pages/Leaderboard.jsx): `frontend/src/pages/Leaderboard.jsx`

### Realtime Game Services

- [HTTP and Socket Server](https://github.com/bagadsrushti/ieee_onebrain/blob/main/backend/index.js): `backend/index.js`
- [Socket Event Routes](https://github.com/bagadsrushti/ieee_onebrain/blob/main/backend/socket.js): `backend/socket.js`
- [Room Gameplay](https://github.com/bagadsrushti/ieee_onebrain/blob/main/backend/gameManager.js): `backend/gameManager.js`

### Events and Duels

- [Duel Management](https://github.com/bagadsrushti/ieee_onebrain/blob/main/backend/duelManager.js): `backend/duelManager.js`
- [Event Management](https://github.com/bagadsrushti/ieee_onebrain/blob/main/backend/eventManager.js): `backend/eventManager.js`

### Game Rules and Scoring

- [Player-Count Rules](https://github.com/bagadsrushti/ieee_onebrain/blob/main/backend/config/gameRules.js): `backend/config/gameRules.js`
- [Challenge Categories](https://github.com/bagadsrushti/ieee_onebrain/blob/main/backend/config/categories.js): `backend/config/categories.js`
- [Clue Distribution](https://github.com/bagadsrushti/ieee_onebrain/blob/main/backend/utils/dealClues.js): `backend/utils/dealClues.js`
- [Answer Matching](https://github.com/bagadsrushti/ieee_onebrain/blob/main/backend/utils/answerMatcher.js): `backend/utils/answerMatcher.js`
- [Usage Tracking](https://github.com/bagadsrushti/ieee_onebrain/blob/main/backend/utils/usageTracker.js): `backend/utils/usageTracker.js`

### Other components

- **Players and Hosts**

## Connections

- Players and Hosts → App Routing: use app (evidence: `README.md`)
- App Routing → Join and Create: routes to (evidence: `frontend/src/App.jsx`)
- App Routing → Room Experience: routes to (evidence: `frontend/src/App.jsx`)
- App Routing → Admin Panel: routes to (evidence: `frontend/src/App.jsx`)
- App Routing → Event Arena: routes to (evidence: `frontend/src/App.jsx`)
- App Routing → Duel Audience: routes to (evidence: `frontend/src/App.jsx`)
- App Routing → Leaderboard: routes to (evidence: `frontend/src/App.jsx`)
- App Routing → Socket Context: provides context (evidence: `frontend/src/App.jsx`)
- Room Experience → Room Lobby: renders (evidence: `frontend/src/pages/Room.jsx`)
- Room Experience → Duel Lobby: renders (evidence: `frontend/src/pages/Room.jsx`)
- Room Experience → Gameplay UI: renders (evidence: `frontend/src/pages/Room.jsx`)
- Socket Context → HTTP and Socket Server: connects by Socket.IO
- HTTP and Socket Server → Socket Event Routes: initializes (evidence: `backend/index.js`)
- Socket Event Routes → Room Gameplay: routes gameplay (evidence: `backend/socket.js`)
- Socket Event Routes → Duel Management: routes duel actions (evidence: `backend/socket.js`)
- Socket Event Routes → Event Management: routes event actions (evidence: `backend/socket.js`)
- Duel Management → Room Gameplay: creates team rooms (evidence: `backend/duelManager.js`)
- Room Gameplay → Event Management: queries team rank (evidence: `backend/gameManager.js`)
- Room Gameplay → Player-Count Rules: loads rules (evidence: `backend/gameManager.js`)
- Room Gameplay → Challenge Categories: uses categories (evidence: `backend/gameManager.js`)
- Room Gameplay → Answer Matching: checks guesses (evidence: `backend/gameManager.js`)
- Room Gameplay → Clue Distribution: deals clues (evidence: `backend/gameManager.js`)
- Duel Management → Player-Count Rules: loads rules (evidence: `backend/duelManager.js`)
- Duel Management → Answer Matching: checks guesses (evidence: `backend/duelManager.js`)
- Duel Management → Clue Distribution: deals clues (evidence: `backend/duelManager.js`)
- HTTP and Socket Server → Usage Tracking: serves usage data (evidence: `backend/index.js`)
- Join and Create → Socket Context: uses socket actions (evidence: `frontend/src/pages/Landing.jsx`)
- Gameplay UI → Socket Context: uses game state (evidence: `frontend/src/components/Game.jsx`)
- Admin Panel → HTTP and Socket Server: uses admin APIs
- Event Arena → HTTP and Socket Server: loads event data
- Duel Audience → HTTP and Socket Server: loads duel state
- Leaderboard → HTTP and Socket Server: loads rankings
