# ankit123-burman/connecthub architecture

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

- Interactive diagram: https://gitdiagram.com/ankit123-burman/connecthub
- Repository: https://github.com/ankit123-burman/connecthub

## Overview

ConnectHub lets users authenticate, create or join password-protected rooms, and then call, chat, and record in a small mesh video session. The browser captures media and handles WebRTC; the Express/Socket.IO backend manages identity, room membership, and signaling rather than carrying media. The README documents additional in-call controls and quality indicators. The graph follows shown imports and calls plus explicit README behavior; some routes, socket handlers, and UI components were not sampled, so their internal links are omitted.

Main entry points: [`frontend/src/pages/Room.jsx`](https://github.com/ankit123-burman/connecthub/blob/main/frontend/src/pages/Room.jsx) (Room session), [`frontend/src/App.jsx`](https://github.com/ankit123-burman/connecthub/blob/main/frontend/src/App.jsx) (App routing), [`backend/app.js`](https://github.com/ankit123-burman/connecthub/blob/main/backend/app.js) (HTTP API), [`backend/src/route/roomRoute.js`](https://github.com/ankit123-burman/connecthub/blob/main/backend/src/route/roomRoute.js) (Room routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_app["App routing<br/>[App.jsx]"]
  node_auth_ui["Sign-in UI<br/>[LoginPage.jsx]"]
  node_auth_state["Auth session<br/>[AuthContext.jsx]"]
  node_home["Room lobby<br/>[Homepage.jsx]"]
end

subgraph group_backend["Backend services"]
  node_api["HTTP API<br/>[app.js]"]
  node_auth_routes["Auth routes<br/>[authRoute.js]"]
  node_room_routes["Room routes<br/>[roomRoute.js]"]
  node_auth_middleware["JWT guard<br/>[authMiddleware.js]"]
  node_socket_server["Socket signaling<br/>[roomScoket.js]"]
  node_db[("MongoDB connection<br/>[db.js]")]
end

subgraph group_call["Call experience"]
  node_room_ui["Room session<br/>[Room.jsx]"]
  node_socket_client["Socket client<br/>[Socket.jsx]"]
  node_peer["WebRTC mesh<br/>[Peer.jsx]"]
  node_video["Video tiles<br/>[VideoTile.jsx]"]
  node_chat["In-call chat<br/>[ChatPanel.jsx]"]
  node_controls["Call controls<br/>[Controls.jsx]"]
  node_recorder["Composite recorder<br/>[recorder.js]"]
end

subgraph group_domain["Room and identity"]
  node_auth_controller["Auth operations<br/>[authController.js]"]
  node_users[("User records<br/>[authModel.js]")]
  node_room_controller["Room operations<br/>[roomController.js]"]
  node_room_service["Room membership<br/>[roomServices.js]"]
end

node_user(("Participant"))

node_user -->|"opens"| node_app
node_app -->|"routes to"| node_auth_ui
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_room_ui
node_auth_ui -->|"signs in"| node_auth_state
node_auth_state -->|"requests auth"| node_auth_controller
node_auth_routes -->|"routes to"| node_auth_controller
node_auth_routes -->|"guards profile"| node_auth_middleware
node_auth_controller -->|"reads and writes"| node_users
node_api -->|"mounts"| node_auth_routes
node_api -->|"mounts"| node_room_routes
node_home -.->|"creates or checks room"| node_api
node_room_routes -->|"guards room API"| node_auth_middleware
node_room_routes -->|"routes to"| node_room_controller
node_room_controller -->|"delegates room actions"| node_room_service
node_room_ui -->|"emits signaling and chat"| node_socket_client
node_room_ui -->|"negotiates peers"| node_peer
node_room_ui -->|"renders streams"| node_video
node_room_ui -->|"renders chat"| node_chat
node_room_ui -->|"renders controls"| node_controls
node_room_ui -->|"records and downloads"| node_recorder
node_peer -->|"exchanges media"| node_user
node_socket_client -.->|"connects"| node_socket_server
node_socket_server -->|"manages room membership"| node_room_service
node_room_service -->|"tracks participants"| node_user
node_api -.->|"initializes connection"| node_db

click node_app "https://github.com/ankit123-burman/connecthub/blob/main/frontend/src/App.jsx"
click node_auth_ui "https://github.com/ankit123-burman/connecthub/blob/main/frontend/src/pages/LoginPage.jsx"
click node_auth_state "https://github.com/ankit123-burman/connecthub/blob/main/frontend/src/context/AuthContext.jsx"
click node_home "https://github.com/ankit123-burman/connecthub/blob/main/frontend/src/pages/Homepage.jsx"
click node_room_ui "https://github.com/ankit123-burman/connecthub/blob/main/frontend/src/pages/Room.jsx"
click node_socket_client "https://github.com/ankit123-burman/connecthub/blob/main/frontend/src/provider/Socket.jsx"
click node_peer "https://github.com/ankit123-burman/connecthub/blob/main/frontend/src/provider/Peer.jsx"
click node_video "https://github.com/ankit123-burman/connecthub/blob/main/frontend/src/components/VideoTile.jsx"
click node_chat "https://github.com/ankit123-burman/connecthub/blob/main/frontend/src/components/ChatPanel.jsx"
click node_controls "https://github.com/ankit123-burman/connecthub/blob/main/frontend/src/components/Controls.jsx"
click node_recorder "https://github.com/ankit123-burman/connecthub/blob/main/frontend/src/utils/recorder.js"
click node_api "https://github.com/ankit123-burman/connecthub/blob/main/backend/app.js"
click node_auth_routes "https://github.com/ankit123-burman/connecthub/blob/main/backend/src/route/authRoute.js"
click node_room_routes "https://github.com/ankit123-burman/connecthub/blob/main/backend/src/route/roomRoute.js"
click node_auth_controller "https://github.com/ankit123-burman/connecthub/blob/main/backend/src/controller/authController.js"
click node_auth_middleware "https://github.com/ankit123-burman/connecthub/blob/main/backend/src/middleware/authMiddleware.js"
click node_users "https://github.com/ankit123-burman/connecthub/blob/main/backend/src/model/authModel.js"
click node_room_controller "https://github.com/ankit123-burman/connecthub/blob/main/backend/src/controller/roomController.js"
click node_room_service "https://github.com/ankit123-burman/connecthub/blob/main/backend/services/roomServices.js"
click node_socket_server "https://github.com/ankit123-burman/connecthub/blob/main/backend/socket/roomScoket.js"
click node_db "https://github.com/ankit123-burman/connecthub/blob/main/backend/src/config/db.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_auth_ui,node_auth_state,node_home toneBlue
class node_api,node_auth_routes,node_room_routes,node_auth_middleware,node_socket_server,node_db toneAmber
class node_room_ui,node_socket_client,node_peer,node_video,node_chat,node_controls,node_recorder toneMint
class node_auth_controller,node_users,node_room_controller,node_room_service toneRose
class node_user toneIndigo
```

## Components

### Web client

- [App routing](https://github.com/ankit123-burman/connecthub/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Sign-in UI](https://github.com/ankit123-burman/connecthub/blob/main/frontend/src/pages/LoginPage.jsx): `frontend/src/pages/LoginPage.jsx`
- [Auth session](https://github.com/ankit123-burman/connecthub/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [Room lobby](https://github.com/ankit123-burman/connecthub/blob/main/frontend/src/pages/Homepage.jsx): `frontend/src/pages/Homepage.jsx`

### Backend services

- [HTTP API](https://github.com/ankit123-burman/connecthub/blob/main/backend/app.js): `backend/app.js`
- [Auth routes](https://github.com/ankit123-burman/connecthub/blob/main/backend/src/route/authRoute.js): `backend/src/route/authRoute.js`
- [Room routes](https://github.com/ankit123-burman/connecthub/blob/main/backend/src/route/roomRoute.js): `backend/src/route/roomRoute.js`
- [JWT guard](https://github.com/ankit123-burman/connecthub/blob/main/backend/src/middleware/authMiddleware.js): `backend/src/middleware/authMiddleware.js`
- [Socket signaling](https://github.com/ankit123-burman/connecthub/blob/main/backend/socket/roomScoket.js): `backend/socket/roomScoket.js`
- [MongoDB connection](https://github.com/ankit123-burman/connecthub/blob/main/backend/src/config/db.js): `backend/src/config/db.js`

### Call experience

- [Room session](https://github.com/ankit123-burman/connecthub/blob/main/frontend/src/pages/Room.jsx): `frontend/src/pages/Room.jsx`
- [Socket client](https://github.com/ankit123-burman/connecthub/blob/main/frontend/src/provider/Socket.jsx): `frontend/src/provider/Socket.jsx`
- [WebRTC mesh](https://github.com/ankit123-burman/connecthub/blob/main/frontend/src/provider/Peer.jsx): `frontend/src/provider/Peer.jsx`
- [Video tiles](https://github.com/ankit123-burman/connecthub/blob/main/frontend/src/components/VideoTile.jsx): `frontend/src/components/VideoTile.jsx`
- [In-call chat](https://github.com/ankit123-burman/connecthub/blob/main/frontend/src/components/ChatPanel.jsx): `frontend/src/components/ChatPanel.jsx`
- [Call controls](https://github.com/ankit123-burman/connecthub/blob/main/frontend/src/components/Controls.jsx): `frontend/src/components/Controls.jsx`
- [Composite recorder](https://github.com/ankit123-burman/connecthub/blob/main/frontend/src/utils/recorder.js): `frontend/src/utils/recorder.js`

### Room and identity

- [Auth operations](https://github.com/ankit123-burman/connecthub/blob/main/backend/src/controller/authController.js): `backend/src/controller/authController.js`
- [User records](https://github.com/ankit123-burman/connecthub/blob/main/backend/src/model/authModel.js): `backend/src/model/authModel.js`
- [Room operations](https://github.com/ankit123-burman/connecthub/blob/main/backend/src/controller/roomController.js): `backend/src/controller/roomController.js`
- [Room membership](https://github.com/ankit123-burman/connecthub/blob/main/backend/services/roomServices.js): `backend/services/roomServices.js`

### Other components

- **Participant**

## Connections

- Participant → App routing: opens (evidence: `README.md`)
- App routing → Sign-in UI: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Room lobby: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Room session: routes to (evidence: `frontend/src/App.jsx`)
- Sign-in UI → Auth session: signs in (evidence: `frontend/src/pages/LoginPage.jsx`)
- Auth session → Auth operations: requests auth (evidence: `frontend/src/context/AuthContext.jsx`)
- Auth routes → Auth operations: routes to (evidence: `backend/src/route/authRoute.js`)
- Auth routes → JWT guard: guards profile (evidence: `backend/src/route/authRoute.js`)
- Auth operations → User records: reads and writes (evidence: `backend/src/controller/authController.js`)
- HTTP API → Auth routes: mounts (evidence: `backend/app.js`)
- HTTP API → Room routes: mounts (evidence: `backend/app.js`)
- Room lobby → HTTP API: creates or checks room
- Room routes → JWT guard: guards room API (evidence: `backend/src/route/roomRoute.js`)
- Room routes → Room operations: routes to (evidence: `backend/src/route/roomRoute.js`)
- Room operations → Room membership: delegates room actions (evidence: `backend/src/controller/roomController.js`)
- Room session → Socket client: emits signaling and chat (evidence: `frontend/src/pages/Room.jsx`)
- Room session → WebRTC mesh: negotiates peers (evidence: `frontend/src/pages/Room.jsx`)
- Room session → Video tiles: renders streams (evidence: `frontend/src/pages/Room.jsx`)
- Room session → In-call chat: renders chat (evidence: `frontend/src/pages/Room.jsx`)
- Room session → Call controls: renders controls (evidence: `frontend/src/pages/Room.jsx`)
- Room session → Composite recorder: records and downloads (evidence: `frontend/src/pages/Room.jsx`)
- WebRTC mesh → Participant: exchanges media (evidence: `README.md`)
- Socket client → Socket signaling: connects
- Socket signaling → Room membership: manages room membership (evidence: `backend/socket/roomScoket.js`)
- Room membership → Participant: tracks participants (evidence: `backend/services/roomServices.js`)
- HTTP API → MongoDB connection: initializes connection
