# ashutosh-tanguria/orbit-back architecture

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

- Interactive diagram: https://gitdiagram.com/ashutosh-tanguria/orbit-back
- Repository: https://github.com/ashutosh-tanguria/orbit-back

## Overview

ORBIT is a real-time social gaming and community application: users browse games or community hubs, enter a game session, and receive live server events and results. The server also supports shared chat, doodle, debate, presence, and community features. The graph separates client experiences, realtime transport, server room handling, and authoritative state/content. The README is empty, so capabilities are inferred from the tree and available source references; several page and room connections are not shown in excerpts and are omitted or marked unverified.

Main entry points: [`server/index.ts`](https://github.com/ashutosh-tanguria/orbit-back/blob/main/server/index.ts) (HTTP and WS entry), [`src/context/SocketContext.tsx`](https://github.com/ashutosh-tanguria/orbit-back/blob/main/src/context/SocketContext.tsx) (Socket client), [`src/pages/GamePlayPage.tsx`](https://github.com/ashutosh-tanguria/orbit-back/blob/main/src/pages/GamePlayPage.tsx) (Game session), [`src/pages/HomePage.tsx`](https://github.com/ashutosh-tanguria/orbit-back/blob/main/src/pages/HomePage.tsx) (Home discovery)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client experiences"]
  node_client_entry["Client entry<br/>[main.tsx]"]
  node_app["Application shell<br/>[App.tsx]"]
  node_home["Home discovery<br/>[HomePage.tsx]"]
  node_community["Community hubs"]
  node_gameplay["Game session<br/>[GamePlayPage.tsx]"]
  node_doodle_ui["Doodle canvas<br/>[DoodleCanvas.tsx]"]
  node_chat_ui["Chat interface<br/>[ChatBox.tsx]"]
end

subgraph group_transport["Realtime transport"]
  node_socket_client["Socket client<br/>[SocketContext.tsx]"]
end

subgraph group_server["Server runtime"]
  node_server_entry["HTTP and WS entry<br/>[index.ts]"]
  node_rooms["Room handlers"]
  node_room_manager["Room manager<br/>[roomManager.ts]"]
  node_presence["Presence tracking<br/>[presence.ts]"]
  node_clock["Server clock<br/>[clock.ts]"]
end

subgraph group_state["State and content"]
  node_store[("Authoritative store<br/>[store.ts]")]
  node_prompt_data["Game prompt banks"]
  node_client_catalog["Game catalog<br/>[gamesList.ts]"]
  node_community_data["Community catalog<br/>[communities.ts]"]
  node_client_types["Shared client types<br/>[index.ts]"]
end

node_user(("Player"))

node_client_entry -->|"renders"| node_app
node_user -.->|"opens"| node_client_entry
node_home -->|"reads"| node_client_catalog
node_home -->|"reads"| node_community_data
node_community -->|"reads"| node_community_data
node_community -.->|"uses realtime"| node_socket_client
node_gameplay -->|"reads"| node_client_catalog
node_gameplay -->|"loads prompts"| node_prompt_data
node_gameplay -.->|"sends events"| node_socket_client
node_doodle_ui -->|"sends events"| node_socket_client
node_chat_ui -.->|"uses realtime"| node_socket_client
node_socket_client -.->|"WebSocket events"| node_server_entry
node_server_entry -->|"reads and updates"| node_store
node_server_entry -->|"dispatches events"| node_room_manager
node_server_entry -->|"dispatches room work"| node_rooms
node_server_entry -->|"reads presence"| node_presence
node_server_entry -->|"reads time"| node_clock
node_room_manager -->|"timestamps events"| node_clock
node_store -->|"seeds content"| node_prompt_data
node_user -.->|"plays"| node_gameplay

click node_client_entry "https://github.com/ashutosh-tanguria/orbit-back/blob/main/src/main.tsx"
click node_app "https://github.com/ashutosh-tanguria/orbit-back/blob/main/src/App.tsx"
click node_home "https://github.com/ashutosh-tanguria/orbit-back/blob/main/src/pages/HomePage.tsx"
click node_community "https://github.com/ashutosh-tanguria/orbit-back/blob/main/src/pages/CommunitiesPage.tsx"
click node_gameplay "https://github.com/ashutosh-tanguria/orbit-back/blob/main/src/pages/GamePlayPage.tsx"
click node_doodle_ui "https://github.com/ashutosh-tanguria/orbit-back/blob/main/src/components/doodle/DoodleCanvas.tsx"
click node_chat_ui "https://github.com/ashutosh-tanguria/orbit-back/blob/main/src/components/chat/ChatBox.tsx"
click node_socket_client "https://github.com/ashutosh-tanguria/orbit-back/blob/main/src/context/SocketContext.tsx"
click node_server_entry "https://github.com/ashutosh-tanguria/orbit-back/blob/main/server/index.ts"
click node_rooms "https://github.com/ashutosh-tanguria/orbit-back/tree/main/server/rooms"
click node_room_manager "https://github.com/ashutosh-tanguria/orbit-back/blob/main/server/rooms/roomManager.ts"
click node_presence "https://github.com/ashutosh-tanguria/orbit-back/blob/main/server/presence.ts"
click node_clock "https://github.com/ashutosh-tanguria/orbit-back/blob/main/server/clock.ts"
click node_store "https://github.com/ashutosh-tanguria/orbit-back/blob/main/server/store.ts"
click node_prompt_data "https://github.com/ashutosh-tanguria/orbit-back/tree/main/server/data"
click node_client_catalog "https://github.com/ashutosh-tanguria/orbit-back/blob/main/src/data/gamesList.ts"
click node_community_data "https://github.com/ashutosh-tanguria/orbit-back/blob/main/src/data/communities.ts"
click node_client_types "https://github.com/ashutosh-tanguria/orbit-back/blob/main/src/types/index.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_client_entry,node_app,node_home,node_community,node_gameplay,node_doodle_ui,node_chat_ui toneBlue
class node_socket_client toneAmber
class node_server_entry,node_rooms,node_room_manager,node_presence,node_clock toneMint
class node_store,node_prompt_data,node_client_catalog,node_community_data,node_client_types toneRose
class node_user toneIndigo
```

## Components

### Client experiences

- [Client entry](https://github.com/ashutosh-tanguria/orbit-back/blob/main/src/main.tsx): `src/main.tsx`
- [Application shell](https://github.com/ashutosh-tanguria/orbit-back/blob/main/src/App.tsx): `src/App.tsx`
- [Home discovery](https://github.com/ashutosh-tanguria/orbit-back/blob/main/src/pages/HomePage.tsx): `src/pages/HomePage.tsx`
- [Community hubs](https://github.com/ashutosh-tanguria/orbit-back/blob/main/src/pages/CommunitiesPage.tsx): `src/pages/CommunitiesPage.tsx`
- [Game session](https://github.com/ashutosh-tanguria/orbit-back/blob/main/src/pages/GamePlayPage.tsx): `src/pages/GamePlayPage.tsx`
- [Doodle canvas](https://github.com/ashutosh-tanguria/orbit-back/blob/main/src/components/doodle/DoodleCanvas.tsx): `src/components/doodle/DoodleCanvas.tsx`
- [Chat interface](https://github.com/ashutosh-tanguria/orbit-back/blob/main/src/components/chat/ChatBox.tsx): `src/components/chat/ChatBox.tsx`

### Realtime transport

- [Socket client](https://github.com/ashutosh-tanguria/orbit-back/blob/main/src/context/SocketContext.tsx): `src/context/SocketContext.tsx`

### Server runtime

- [HTTP and WS entry](https://github.com/ashutosh-tanguria/orbit-back/blob/main/server/index.ts): `server/index.ts`
- [Room handlers](https://github.com/ashutosh-tanguria/orbit-back/tree/main/server/rooms): `server/rooms`
- [Room manager](https://github.com/ashutosh-tanguria/orbit-back/blob/main/server/rooms/roomManager.ts): `server/rooms/roomManager.ts`
- [Presence tracking](https://github.com/ashutosh-tanguria/orbit-back/blob/main/server/presence.ts): `server/presence.ts`
- [Server clock](https://github.com/ashutosh-tanguria/orbit-back/blob/main/server/clock.ts): `server/clock.ts`

### State and content

- [Authoritative store](https://github.com/ashutosh-tanguria/orbit-back/blob/main/server/store.ts): `server/store.ts`
- [Game prompt banks](https://github.com/ashutosh-tanguria/orbit-back/tree/main/server/data): `server/data`
- [Game catalog](https://github.com/ashutosh-tanguria/orbit-back/blob/main/src/data/gamesList.ts): `src/data/gamesList.ts`
- [Community catalog](https://github.com/ashutosh-tanguria/orbit-back/blob/main/src/data/communities.ts): `src/data/communities.ts`
- [Shared client types](https://github.com/ashutosh-tanguria/orbit-back/blob/main/src/types/index.ts): `src/types/index.ts`

### Other components

- **Player**

## Connections

- Client entry → Application shell: renders (evidence: `src/main.tsx`)
- Player → Client entry: opens
- Home discovery → Game catalog: reads (evidence: `src/pages/HomePage.tsx`)
- Home discovery → Community catalog: reads (evidence: `src/pages/HomePage.tsx`)
- Community hubs → Community catalog: reads (evidence: `src/pages/CommunitiesPage.tsx`)
- Community hubs → Socket client: uses realtime
- Game session → Game catalog: reads (evidence: `src/pages/GamePlayPage.tsx`)
- Game session → Game prompt banks: loads prompts (evidence: `src/pages/GamePlayPage.tsx`)
- Game session → Socket client: sends events
- Doodle canvas → Socket client: sends events (evidence: `src/components/doodle/DoodleCanvas.tsx`)
- Chat interface → Socket client: uses realtime
- Socket client → HTTP and WS entry: WebSocket events
- HTTP and WS entry → Authoritative store: reads and updates (evidence: `server/index.ts`)
- HTTP and WS entry → Room manager: dispatches events (evidence: `server/index.ts`)
- HTTP and WS entry → Room handlers: dispatches room work (evidence: `server/index.ts`)
- HTTP and WS entry → Presence tracking: reads presence (evidence: `server/index.ts`)
- HTTP and WS entry → Server clock: reads time (evidence: `server/index.ts`)
- Room manager → Server clock: timestamps events (evidence: `server/rooms/roomManager.ts`)
- Authoritative store → Game prompt banks: seeds content (evidence: `server/store.ts`)
- Player → Game session: plays
