# ashutoshpaliwal26/virtual-office architecture

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

- Interactive diagram: https://gitdiagram.com/ashutoshpaliwal26/virtual-office
- Repository: https://github.com/ashutoshpaliwal26/virtual-office

## Overview

This is a browser-based virtual coworking platform: users authenticate, find or enter a workspace, then collaborate in an interactive 2D room with real-time presence and communication. The graph also preserves the documented messaging, video, and task-management capabilities. Source excerpts and the index establish the main route, API, database, and socket wiring; some workspace and frontend subsystems are represented by their exact directories because their implementation was not sampled.

Main entry points: [`frontend/src/Pages/VirtualSpace/Room.tsx`](https://github.com/ashutoshpaliwal26/virtual-office/blob/main/frontend/src/Pages/VirtualSpace/Room.tsx) (Virtual room), [`backend/src/index.ts`](https://github.com/ashutoshpaliwal26/virtual-office/blob/main/backend/src/index.ts) (Express and socket server), [`frontend/src/App.tsx`](https://github.com/ashutoshpaliwal26/virtual-office/blob/main/frontend/src/App.tsx) (App routes), [`frontend/src/context/SocketContext/SocketContext.tsx`](https://github.com/ashutoshpaliwal26/virtual-office/blob/main/frontend/src/context/SocketContext/SocketContext.tsx) (Socket provider)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_app["App routes<br/>[App.tsx]"]
  node_authui["Login and signup"]
  node_dashboard["Workspace dashboard<br/>[Dashboard.tsx]"]
  node_api["HTTP API client<br/>[APIService.ts]"]
end

subgraph group_workspace["Workspace collaboration"]
  node_spaceui["Space entry and setup"]
  node_room["Virtual room<br/>[Room.tsx]"]
  node_game["2D avatar world<br/>[Game.tsx]"]
  node_task["Task manager<br/>[TaskManager.tsx]"]
  node_chatui["Chat interface<br/>[Chat.tsx]"]
end

subgraph group_server["Backend services"]
  node_backend["Express and socket server<br/>[index.ts]"]
  node_authroutes["Authentication routes<br/>[Auth.ts]"]
  node_authcontrollers["Login and signup"]
  node_protection["JWT protection<br/>[Protect.ts]"]
  node_users[("User records<br/>[User.ts]")]
  node_workroutes["Workspace routes<br/>[WorkSpace.ts]"]
  node_workcontrollers["Workspace operations"]
  node_workspaces[("Workspace records<br/>[WorkingSpace.ts]")]
  node_chatroutes["Chat routes<br/>[Chat.ts]"]
  node_chatcontroller["Chat creation<br/>[ChatController.ts]"]
  node_chats[("Chat records<br/>[Chat.ts]")]
end

subgraph group_realtime["Real-time communication"]
  node_socketclient["Socket provider<br/>[SocketContext.tsx]"]
  node_peer["WebRTC peer<br/>[Peer.ts]"]
  node_socketservices["Presence and messaging sockets"]
  node_videoservice["Video call signaling<br/>[VideoCall.ts]"]
  node_videoui["Video participants<br/>[VideoStrip.tsx]"]
end

node_user(("Coworking user"))
node_database[("MongoDB")]

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_authui
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_spaceui
node_app -->|"routes to"| node_room
node_app -->|"routes to"| node_task
node_app -->|"provides"| node_socketclient
node_authui -->|"requests"| node_api
node_dashboard -->|"requests"| node_api
node_spaceui -.->|"requests"| node_api
node_room -->|"checks access"| node_api
node_room -->|"renders"| node_game
node_room -->|"handles events"| node_socketclient
node_room -->|"negotiates media"| node_peer
node_room -->|"shows participants"| node_videoui
node_room -->|"renders"| node_chatui
node_api -->|"HTTP requests"| node_backend
node_socketclient -->|"connects"| node_backend
node_backend -->|"mounts"| node_authroutes
node_backend -->|"mounts"| node_workroutes
node_backend -->|"mounts"| node_chatroutes
node_backend -->|"registers"| node_socketservices
node_backend -->|"registers"| node_videoservice
node_authroutes -->|"dispatches"| node_authcontrollers
node_authroutes -->|"guards"| node_protection
node_authcontrollers -->|"reads and writes"| node_users
node_protection -->|"checks identity"| node_users
node_workroutes -->|"dispatches"| node_workcontrollers
node_workcontrollers -->|"reads and writes"| node_workspaces
node_chatroutes -->|"dispatches"| node_chatcontroller
node_chatcontroller -->|"creates and queries"| node_chats
node_backend -->|"connects"| node_database
node_authcontrollers -.->|"persists users"| node_database
node_workcontrollers -.->|"persists spaces"| node_database
node_chatui -.->|"real-time messaging"| node_socketclient
node_game -.->|"shares movement"| node_socketclient
node_socketclient -.->|"exchanges events"| node_socketservices
node_room -->|"signals calls"| node_videoservice
node_task -.->|"supports collaboration"| node_user

click node_app "https://github.com/ashutoshpaliwal26/virtual-office/blob/main/frontend/src/App.tsx"
click node_authui "https://github.com/ashutoshpaliwal26/virtual-office/tree/main/frontend/src/Pages/Auth"
click node_dashboard "https://github.com/ashutoshpaliwal26/virtual-office/blob/main/frontend/src/Pages/Dashboard/Dashboard.tsx"
click node_spaceui "https://github.com/ashutoshpaliwal26/virtual-office/tree/main/frontend/src/Pages/VirtualSpace"
click node_room "https://github.com/ashutoshpaliwal26/virtual-office/blob/main/frontend/src/Pages/VirtualSpace/Room.tsx"
click node_game "https://github.com/ashutoshpaliwal26/virtual-office/blob/main/frontend/src/components/Game/Game.tsx"
click node_task "https://github.com/ashutoshpaliwal26/virtual-office/blob/main/frontend/src/components/TaskManager/TaskManager.tsx"
click node_api "https://github.com/ashutoshpaliwal26/virtual-office/blob/main/frontend/src/service/APIService.ts/APIService.ts"
click node_socketclient "https://github.com/ashutoshpaliwal26/virtual-office/blob/main/frontend/src/context/SocketContext/SocketContext.tsx"
click node_peer "https://github.com/ashutoshpaliwal26/virtual-office/blob/main/frontend/src/service/Peer.ts"
click node_backend "https://github.com/ashutoshpaliwal26/virtual-office/blob/main/backend/src/index.ts"
click node_authroutes "https://github.com/ashutoshpaliwal26/virtual-office/blob/main/backend/src/routes/Auth.ts"
click node_authcontrollers "https://github.com/ashutoshpaliwal26/virtual-office/tree/main/backend/src/controller/Auth"
click node_protection "https://github.com/ashutoshpaliwal26/virtual-office/blob/main/backend/src/middleware/Protect.ts"
click node_users "https://github.com/ashutoshpaliwal26/virtual-office/blob/main/backend/src/model/User.ts"
click node_workroutes "https://github.com/ashutoshpaliwal26/virtual-office/blob/main/backend/src/routes/WorkSpace.ts"
click node_workcontrollers "https://github.com/ashutoshpaliwal26/virtual-office/tree/main/backend/src/controller/Space"
click node_workspaces "https://github.com/ashutoshpaliwal26/virtual-office/blob/main/backend/src/model/WorkingSpace.ts"
click node_chatui "https://github.com/ashutoshpaliwal26/virtual-office/blob/main/frontend/src/components/Chat/Chat.tsx"
click node_chatroutes "https://github.com/ashutoshpaliwal26/virtual-office/blob/main/backend/src/routes/Chat.ts"
click node_chatcontroller "https://github.com/ashutoshpaliwal26/virtual-office/blob/main/backend/src/controller/Chat/ChatController.ts"
click node_chats "https://github.com/ashutoshpaliwal26/virtual-office/blob/main/backend/src/model/Chat.ts"
click node_socketservices "https://github.com/ashutoshpaliwal26/virtual-office/tree/main/backend/src/sockets"
click node_videoservice "https://github.com/ashutoshpaliwal26/virtual-office/blob/main/backend/src/sockets/VideoCall.ts"
click node_videoui "https://github.com/ashutoshpaliwal26/virtual-office/blob/main/frontend/src/components/VideoComponents/VideoStrip.tsx"

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_authui,node_dashboard,node_api,node_user toneBlue
class node_spaceui,node_room,node_game,node_task,node_chatui,node_database toneAmber
class node_backend,node_authroutes,node_authcontrollers,node_protection,node_users,node_workroutes,node_workcontrollers,node_workspaces,node_chatroutes,node_chatcontroller,node_chats toneMint
class node_socketclient,node_peer,node_socketservices,node_videoservice,node_videoui toneRose
```

## Components

### Web application

- [App routes](https://github.com/ashutoshpaliwal26/virtual-office/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Login and signup](https://github.com/ashutoshpaliwal26/virtual-office/tree/main/frontend/src/Pages/Auth): `frontend/src/Pages/Auth`
- [Workspace dashboard](https://github.com/ashutoshpaliwal26/virtual-office/blob/main/frontend/src/Pages/Dashboard/Dashboard.tsx): `frontend/src/Pages/Dashboard/Dashboard.tsx`
- [HTTP API client](https://github.com/ashutoshpaliwal26/virtual-office/blob/main/frontend/src/service/APIService.ts/APIService.ts): `frontend/src/service/APIService.ts/APIService.ts`

### Workspace collaboration

- [Space entry and setup](https://github.com/ashutoshpaliwal26/virtual-office/tree/main/frontend/src/Pages/VirtualSpace): `frontend/src/Pages/VirtualSpace`
- [Virtual room](https://github.com/ashutoshpaliwal26/virtual-office/blob/main/frontend/src/Pages/VirtualSpace/Room.tsx): `frontend/src/Pages/VirtualSpace/Room.tsx`
- [2D avatar world](https://github.com/ashutoshpaliwal26/virtual-office/blob/main/frontend/src/components/Game/Game.tsx): `frontend/src/components/Game/Game.tsx`
- [Task manager](https://github.com/ashutoshpaliwal26/virtual-office/blob/main/frontend/src/components/TaskManager/TaskManager.tsx): `frontend/src/components/TaskManager/TaskManager.tsx`
- [Chat interface](https://github.com/ashutoshpaliwal26/virtual-office/blob/main/frontend/src/components/Chat/Chat.tsx): `frontend/src/components/Chat/Chat.tsx`

### Backend services

- [Express and socket server](https://github.com/ashutoshpaliwal26/virtual-office/blob/main/backend/src/index.ts): `backend/src/index.ts`
- [Authentication routes](https://github.com/ashutoshpaliwal26/virtual-office/blob/main/backend/src/routes/Auth.ts): `backend/src/routes/Auth.ts`
- [Login and signup](https://github.com/ashutoshpaliwal26/virtual-office/tree/main/backend/src/controller/Auth): `backend/src/controller/Auth`
- [JWT protection](https://github.com/ashutoshpaliwal26/virtual-office/blob/main/backend/src/middleware/Protect.ts): `backend/src/middleware/Protect.ts`
- [User records](https://github.com/ashutoshpaliwal26/virtual-office/blob/main/backend/src/model/User.ts): `backend/src/model/User.ts`
- [Workspace routes](https://github.com/ashutoshpaliwal26/virtual-office/blob/main/backend/src/routes/WorkSpace.ts): `backend/src/routes/WorkSpace.ts`
- [Workspace operations](https://github.com/ashutoshpaliwal26/virtual-office/tree/main/backend/src/controller/Space): `backend/src/controller/Space`
- [Workspace records](https://github.com/ashutoshpaliwal26/virtual-office/blob/main/backend/src/model/WorkingSpace.ts): `backend/src/model/WorkingSpace.ts`
- [Chat routes](https://github.com/ashutoshpaliwal26/virtual-office/blob/main/backend/src/routes/Chat.ts): `backend/src/routes/Chat.ts`
- [Chat creation](https://github.com/ashutoshpaliwal26/virtual-office/blob/main/backend/src/controller/Chat/ChatController.ts): `backend/src/controller/Chat/ChatController.ts`
- [Chat records](https://github.com/ashutoshpaliwal26/virtual-office/blob/main/backend/src/model/Chat.ts): `backend/src/model/Chat.ts`

### Real-time communication

- [Socket provider](https://github.com/ashutoshpaliwal26/virtual-office/blob/main/frontend/src/context/SocketContext/SocketContext.tsx): `frontend/src/context/SocketContext/SocketContext.tsx`
- [WebRTC peer](https://github.com/ashutoshpaliwal26/virtual-office/blob/main/frontend/src/service/Peer.ts): `frontend/src/service/Peer.ts`
- [Presence and messaging sockets](https://github.com/ashutoshpaliwal26/virtual-office/tree/main/backend/src/sockets): `backend/src/sockets`
- [Video call signaling](https://github.com/ashutoshpaliwal26/virtual-office/blob/main/backend/src/sockets/VideoCall.ts): `backend/src/sockets/VideoCall.ts`
- [Video participants](https://github.com/ashutoshpaliwal26/virtual-office/blob/main/frontend/src/components/VideoComponents/VideoStrip.tsx): `frontend/src/components/VideoComponents/VideoStrip.tsx`

### Other components

- **Coworking user**
- **MongoDB**

## Connections

- Coworking user → App routes: uses (evidence: `README.md`)
- App routes → Login and signup: routes to (evidence: `frontend/src/App.tsx`)
- App routes → Workspace dashboard: routes to (evidence: `frontend/src/App.tsx`)
- App routes → Space entry and setup: routes to (evidence: `frontend/src/App.tsx`)
- App routes → Virtual room: routes to (evidence: `frontend/src/App.tsx`)
- App routes → Task manager: routes to (evidence: `frontend/src/App.tsx`)
- App routes → Socket provider: provides (evidence: `frontend/src/App.tsx`)
- Login and signup → HTTP API client: requests (evidence: `frontend/src/Pages/Auth/Login.tsx`)
- Workspace dashboard → HTTP API client: requests (evidence: `frontend/src/Pages/Dashboard/Dashboard.tsx`)
- Space entry and setup → HTTP API client: requests (evidence: `frontend/src/Pages/VirtualSpace/Room.tsx`)
- Virtual room → HTTP API client: checks access (evidence: `frontend/src/Pages/VirtualSpace/Room.tsx`)
- Virtual room → 2D avatar world: renders (evidence: `frontend/src/Pages/VirtualSpace/Room.tsx`)
- Virtual room → Socket provider: handles events (evidence: `frontend/src/Pages/VirtualSpace/Room.tsx`)
- Virtual room → WebRTC peer: negotiates media (evidence: `frontend/src/Pages/VirtualSpace/Room.tsx`)
- Virtual room → Video participants: shows participants (evidence: `frontend/src/Pages/VirtualSpace/Room.tsx`)
- Virtual room → Chat interface: renders (evidence: `frontend/src/Pages/VirtualSpace/Room.tsx`)
- HTTP API client → Express and socket server: HTTP requests (evidence: `README.md`)
- Socket provider → Express and socket server: connects (evidence: `frontend/src/context/SocketContext/SocketContext.tsx`)
- Express and socket server → Authentication routes: mounts (evidence: `backend/src/index.ts`)
- Express and socket server → Workspace routes: mounts (evidence: `backend/src/index.ts`)
- Express and socket server → Chat routes: mounts (evidence: `backend/src/index.ts`)
- Express and socket server → Presence and messaging sockets: registers (evidence: `backend/src/index.ts`)
- Express and socket server → Video call signaling: registers (evidence: `backend/src/index.ts`)
- Authentication routes → Login and signup: dispatches (evidence: `backend/src/routes/Auth.ts`)
- Authentication routes → JWT protection: guards (evidence: `backend/src/routes/Auth.ts`)
- Login and signup → User records: reads and writes (evidence: `backend/src/controller/Auth/loginUser.ts`)
- JWT protection → User records: checks identity (evidence: `backend/src/middleware/Protect.ts`)
- Workspace routes → Workspace operations: dispatches (evidence: `backend/src/routes/WorkSpace.ts`)
- Workspace operations → Workspace records: reads and writes (evidence: `backend/src/controller/Space/enterToSpace.ts`)
- Chat routes → Chat creation: dispatches (evidence: `backend/src/routes/Chat.ts`)
- Chat creation → Chat records: creates and queries (evidence: `backend/src/controller/Chat/ChatController.ts`)
- Express and socket server → MongoDB: connects (evidence: `backend/src/index.ts`)
- Login and signup → MongoDB: persists users
- Workspace operations → MongoDB: persists spaces
- Chat interface → Socket provider: real-time messaging (evidence: `frontend/src/components/Chat/Chat.tsx`)
- 2D avatar world → Socket provider: shares movement (evidence: `frontend/src/components/Game/Game.tsx`)
- Socket provider → Presence and messaging sockets: exchanges events
- Virtual room → Video call signaling: signals calls (evidence: `frontend/src/Pages/VirtualSpace/Room.tsx`)
- Task manager → Coworking user: supports collaboration
