# mohammed-uwais/why-so-serious architecture

> Architecture diagram of the GitHub repository mohammed-uwais/why-so-serious, 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/mohammed-uwais/why-so-serious
- Repository: https://github.com/mohammed-uwais/why-so-serious

## Overview

This is a collaborative browser-based boss-fight game: participants trigger coding-challenge submissions that reduce shared boss HP, while a live arena renders health, hit history, player count, and boss reactions. Admins can inspect and override the fight, and HackerRank webhook or simulated submission paths feed the same in-memory game state. The graph follows the documented calls and event flow; where source was not sampled, it omits speculative links while retaining major frontend and backend subsystems identified by the source index.

Main entry points: [`frontend/src/pages/BossScreen.jsx`](https://github.com/mohammed-uwais/why-so-serious/blob/main/frontend/src/pages/BossScreen.jsx) (Live boss screen), [`backend/routes.js`](https://github.com/mohammed-uwais/why-so-serious/blob/main/backend/routes.js) (API routes), [`backend/hpManager.js`](https://github.com/mohammed-uwais/why-so-serious/blob/main/backend/hpManager.js) (Fight state and HP), [`backend/socket.js`](https://github.com/mohammed-uwais/why-so-serious/blob/main/backend/socket.js) (Realtime broadcaster)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gameplay["Player experience"]
  node_app["Page router<br/>[App.jsx]"]
  node_portal["Challenge portal<br/>[Portal.jsx]"]
  node_boss_screen["Live boss screen<br/>[BossScreen.jsx]"]
  node_boss_service["REST client<br/>[bossService.js]"]
  node_frontend_config["Frontend settings<br/>[config.js]"]
  node_socket_client["Socket client<br/>[socketManager.js]"]
end

subgraph group_presentation["Arena presentation"]
  node_hp_bar["Health display<br/>[HPBar.jsx]"]
  node_hud["Fight HUD<br/>[HUD.jsx]"]
  node_boss_art["Boss artwork<br/>[Boss.jsx]"]
  node_effects["Arena effects<br/>[EffectsLayer.jsx]"]
  node_animation_manager["Animation controller"]
  node_animations["Animation routines<br/>[particles.js]"]
  node_audio["Audio controller<br/>[audioManager.js]"]
end

subgraph group_backend["Game backend"]
  node_server["HTTP and socket server<br/>[server.js]"]
  node_routes["API routes<br/>[routes.js]"]
  node_hp_manager["Fight state and HP<br/>[hpManager.js]"]
  node_socket_server["Realtime broadcaster<br/>[socket.js]"]
  node_backend_config["Backend settings<br/>[config.js]"]
  node_game_state[("In-memory fight state<br/>[hpManager.js]")]
end

subgraph group_operations["Admin and integrations"]
  node_admin_page["Admin console<br/>[Admin.jsx]"]
  node_submission_service["Submission evaluator"]
end

node_participant(("Participant"))
node_admin_actor(("Administrator"))
node_hackerrank["HackerRank webhook"]

node_participant -.->|"enters challenge"| node_portal
node_app -->|"routes to"| node_portal
node_app -->|"routes to"| node_boss_screen
node_app -->|"routes to"| node_admin_page
node_app -->|"loads settings"| node_frontend_config
node_portal -->|"starts challenge"| node_boss_service
node_admin_page -->|"sends overrides"| node_boss_service
node_boss_service -->|"calls REST API"| node_routes
node_boss_screen -->|"subscribes events"| node_socket_client
node_boss_screen -->|"plays reactions"| node_audio
node_boss_screen -->|"animates events"| node_animation_manager
node_boss_screen -->|"renders health"| node_hp_bar
node_boss_screen -->|"renders fight info"| node_hud
node_boss_screen -->|"renders boss"| node_boss_art
node_boss_screen -->|"renders effects"| node_effects
node_animation_manager -->|"runs particles"| node_animations
node_socket_client -->|"reads endpoint"| node_frontend_config
node_server -->|"mounts routes"| node_routes
node_server -->|"initializes sockets"| node_socket_server
node_routes -->|"updates fight state"| node_hp_manager
node_routes -->|"broadcasts updates"| node_socket_server
node_routes -->|"starts simulation"| node_submission_service
node_routes -->|"checks mode"| node_backend_config
node_socket_server -->|"reads snapshots"| node_hp_manager
node_socket_server -->|"broadcasts state"| node_game_state
node_hp_manager -->|"uses HP limits"| node_backend_config
node_hp_manager -->|"maintains"| node_game_state
node_submission_service -->|"applies damage"| node_hp_manager
node_submission_service -->|"broadcasts outcome"| node_socket_server
node_submission_service -->|"uses simulation settings"| node_backend_config
node_hackerrank -->|"posts webhook"| node_routes

click node_app "https://github.com/mohammed-uwais/why-so-serious/blob/main/frontend/src/App.jsx"
click node_portal "https://github.com/mohammed-uwais/why-so-serious/blob/main/frontend/src/pages/Portal.jsx"
click node_boss_screen "https://github.com/mohammed-uwais/why-so-serious/blob/main/frontend/src/pages/BossScreen.jsx"
click node_boss_service "https://github.com/mohammed-uwais/why-so-serious/blob/main/frontend/src/services/bossService.js"
click node_frontend_config "https://github.com/mohammed-uwais/why-so-serious/blob/main/frontend/src/config.js"
click node_socket_client "https://github.com/mohammed-uwais/why-so-serious/blob/main/frontend/src/socket/socketManager.js"
click node_hp_bar "https://github.com/mohammed-uwais/why-so-serious/blob/main/frontend/src/components/HPBar/HPBar.jsx"
click node_hud "https://github.com/mohammed-uwais/why-so-serious/blob/main/frontend/src/components/HUD/HUD.jsx"
click node_boss_art "https://github.com/mohammed-uwais/why-so-serious/blob/main/frontend/src/components/Boss/Boss.jsx"
click node_effects "https://github.com/mohammed-uwais/why-so-serious/blob/main/frontend/src/components/EffectsLayer/EffectsLayer.jsx"
click node_animation_manager "https://github.com/mohammed-uwais/why-so-serious/blob/main/frontend/src/services/animationManager.js"
click node_animations "https://github.com/mohammed-uwais/why-so-serious/blob/main/frontend/src/animations/particles.js"
click node_audio "https://github.com/mohammed-uwais/why-so-serious/blob/main/frontend/src/services/audioManager.js"
click node_admin_page "https://github.com/mohammed-uwais/why-so-serious/blob/main/frontend/src/pages/Admin.jsx"
click node_server "https://github.com/mohammed-uwais/why-so-serious/blob/main/backend/server.js"
click node_routes "https://github.com/mohammed-uwais/why-so-serious/blob/main/backend/routes.js"
click node_hp_manager "https://github.com/mohammed-uwais/why-so-serious/blob/main/backend/hpManager.js"
click node_socket_server "https://github.com/mohammed-uwais/why-so-serious/blob/main/backend/socket.js"
click node_backend_config "https://github.com/mohammed-uwais/why-so-serious/blob/main/backend/config.js"
click node_submission_service "https://github.com/mohammed-uwais/why-so-serious/blob/main/backend/services/hackerrankService.js"
click node_game_state "https://github.com/mohammed-uwais/why-so-serious/blob/main/backend/hpManager.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_portal,node_boss_screen,node_boss_service,node_frontend_config,node_socket_client toneBlue
class node_hp_bar,node_hud,node_boss_art,node_effects,node_animation_manager,node_animations,node_audio toneAmber
class node_server,node_routes,node_hp_manager,node_socket_server,node_backend_config,node_game_state,node_hackerrank toneMint
class node_admin_page,node_submission_service toneRose
class node_participant,node_admin_actor toneIndigo
```

## Components

### Player experience

- [Page router](https://github.com/mohammed-uwais/why-so-serious/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Challenge portal](https://github.com/mohammed-uwais/why-so-serious/blob/main/frontend/src/pages/Portal.jsx): `frontend/src/pages/Portal.jsx`
- [Live boss screen](https://github.com/mohammed-uwais/why-so-serious/blob/main/frontend/src/pages/BossScreen.jsx): `frontend/src/pages/BossScreen.jsx`
- [REST client](https://github.com/mohammed-uwais/why-so-serious/blob/main/frontend/src/services/bossService.js): `frontend/src/services/bossService.js`
- [Frontend settings](https://github.com/mohammed-uwais/why-so-serious/blob/main/frontend/src/config.js): `frontend/src/config.js`
- [Socket client](https://github.com/mohammed-uwais/why-so-serious/blob/main/frontend/src/socket/socketManager.js): `frontend/src/socket/socketManager.js`

### Arena presentation

- [Health display](https://github.com/mohammed-uwais/why-so-serious/blob/main/frontend/src/components/HPBar/HPBar.jsx): `frontend/src/components/HPBar/HPBar.jsx`
- [Fight HUD](https://github.com/mohammed-uwais/why-so-serious/blob/main/frontend/src/components/HUD/HUD.jsx): `frontend/src/components/HUD/HUD.jsx`
- [Boss artwork](https://github.com/mohammed-uwais/why-so-serious/blob/main/frontend/src/components/Boss/Boss.jsx): `frontend/src/components/Boss/Boss.jsx`
- [Arena effects](https://github.com/mohammed-uwais/why-so-serious/blob/main/frontend/src/components/EffectsLayer/EffectsLayer.jsx): `frontend/src/components/EffectsLayer/EffectsLayer.jsx`
- [Animation controller](https://github.com/mohammed-uwais/why-so-serious/blob/main/frontend/src/services/animationManager.js): `frontend/src/services/animationManager.js`
- [Animation routines](https://github.com/mohammed-uwais/why-so-serious/blob/main/frontend/src/animations/particles.js): `frontend/src/animations/particles.js`
- [Audio controller](https://github.com/mohammed-uwais/why-so-serious/blob/main/frontend/src/services/audioManager.js): `frontend/src/services/audioManager.js`

### Game backend

- [HTTP and socket server](https://github.com/mohammed-uwais/why-so-serious/blob/main/backend/server.js): `backend/server.js`
- [API routes](https://github.com/mohammed-uwais/why-so-serious/blob/main/backend/routes.js): `backend/routes.js`
- [Fight state and HP](https://github.com/mohammed-uwais/why-so-serious/blob/main/backend/hpManager.js): `backend/hpManager.js`
- [Realtime broadcaster](https://github.com/mohammed-uwais/why-so-serious/blob/main/backend/socket.js): `backend/socket.js`
- [Backend settings](https://github.com/mohammed-uwais/why-so-serious/blob/main/backend/config.js): `backend/config.js`
- [In-memory fight state](https://github.com/mohammed-uwais/why-so-serious/blob/main/backend/hpManager.js): `backend/hpManager.js`

### Admin and integrations

- [Admin console](https://github.com/mohammed-uwais/why-so-serious/blob/main/frontend/src/pages/Admin.jsx): `frontend/src/pages/Admin.jsx`
- [Submission evaluator](https://github.com/mohammed-uwais/why-so-serious/blob/main/backend/services/hackerrankService.js): `backend/services/hackerrankService.js`

### Other components

- **Participant**
- **Administrator**
- **HackerRank webhook**

## Connections

- Participant → Challenge portal: enters challenge
- Page router → Challenge portal: routes to (evidence: `frontend/src/App.jsx`)
- Page router → Live boss screen: routes to (evidence: `frontend/src/App.jsx`)
- Page router → Admin console: routes to (evidence: `frontend/src/App.jsx`)
- Page router → Frontend settings: loads settings (evidence: `frontend/src/App.jsx`)
- Challenge portal → REST client: starts challenge (evidence: `frontend/src/pages/Portal.jsx`)
- Admin console → REST client: sends overrides (evidence: `frontend/src/pages/Admin.jsx`)
- REST client → API routes: calls REST API (evidence: `frontend/src/services/bossService.js`)
- Live boss screen → Socket client: subscribes events (evidence: `frontend/src/pages/BossScreen.jsx`)
- Live boss screen → Audio controller: plays reactions (evidence: `frontend/src/pages/BossScreen.jsx`)
- Live boss screen → Animation controller: animates events (evidence: `frontend/src/pages/BossScreen.jsx`)
- Live boss screen → Health display: renders health (evidence: `frontend/src/pages/BossScreen.jsx`)
- Live boss screen → Fight HUD: renders fight info (evidence: `frontend/src/pages/BossScreen.jsx`)
- Live boss screen → Boss artwork: renders boss (evidence: `frontend/src/pages/BossScreen.jsx`)
- Live boss screen → Arena effects: renders effects (evidence: `frontend/src/pages/BossScreen.jsx`)
- Animation controller → Animation routines: runs particles (evidence: `frontend/src/services/animationManager.js`)
- Socket client → Frontend settings: reads endpoint (evidence: `frontend/src/socket/socketManager.js`)
- HTTP and socket server → API routes: mounts routes (evidence: `backend/server.js`)
- HTTP and socket server → Realtime broadcaster: initializes sockets (evidence: `backend/server.js`)
- API routes → Fight state and HP: updates fight state (evidence: `backend/routes.js`)
- API routes → Realtime broadcaster: broadcasts updates (evidence: `backend/routes.js`)
- API routes → Submission evaluator: starts simulation (evidence: `backend/routes.js`)
- API routes → Backend settings: checks mode (evidence: `backend/routes.js`)
- Realtime broadcaster → Fight state and HP: reads snapshots (evidence: `backend/socket.js`)
- Realtime broadcaster → In-memory fight state: broadcasts state (evidence: `backend/socket.js`)
- Fight state and HP → Backend settings: uses HP limits (evidence: `backend/hpManager.js`)
- Fight state and HP → In-memory fight state: maintains (evidence: `backend/hpManager.js`)
- Submission evaluator → Fight state and HP: applies damage (evidence: `backend/services/hackerrankService.js`)
- Submission evaluator → Realtime broadcaster: broadcasts outcome (evidence: `backend/services/hackerrankService.js`)
- Submission evaluator → Backend settings: uses simulation settings (evidence: `backend/services/hackerrankService.js`)
- HackerRank webhook → API routes: posts webhook (evidence: `backend/routes.js`)
