# sornalatha-2002/syntecxhub_chat-application architecture

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

- Interactive diagram: https://gitdiagram.com/sornalatha-2002/syntecxhub_chat-application
- Repository: https://github.com/sornalatha-2002/syntecxhub_chat-application

## Overview

ChatSphere is a MERN real-time chat application. Users sign up or log in, enter a protected dashboard, discover or create rooms, then exchange persisted messages and live chat events. The graph separates the React experience, HTTP/API handling, room and message domain logic, and persistence/realtime infrastructure. README documents file uploads, private rooms, typing, presence, and read receipts; sampled code confirms several of these, while unsampled feature internals are represented at their documented subsystem paths. Some links are omitted where sampled evidence does not establish the call.

Main entry points: [`client/src/pages/Dashboard.jsx`](https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/client/src/pages/Dashboard.jsx) (Chat dashboard), [`server/server.js`](https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/server/server.js) (Express server), [`server/routes/messageRoutes.js`](https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/server/routes/messageRoutes.js) (Message routes), [`server/socket/socketHandler.js`](https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/server/socket/socketHandler.js) (Socket events)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["React client"]
  node_app["App routing<br/>[App.jsx]"]
  node_authpages["Login and signup"]
  node_authstate["Auth state<br/>[AuthContext.jsx]"]
  node_dashboard["Chat dashboard<br/>[Dashboard.jsx]"]
  node_sidebar["Room sidebar<br/>[Sidebar.jsx]"]
  node_roomcreate["Room creation"]
  node_chatui["Chat interface"]
  node_socketclient["Socket client<br/>[SocketContext.jsx]"]
  node_authservices["Auth services<br/>[authService.js]"]
  node_roomservices["Room services<br/>[roomService.js]"]
  node_messageservices["Message services<br/>[messageService.js]"]
  node_apiadapter["HTTP adapter<br/>[api.js]"]
end

subgraph group_api["HTTP API"]
  node_server["Express server<br/>[server.js]"]
  node_authroutes["Auth routes<br/>[authRoutes.js]"]
  node_roomroutes["Room routes<br/>[roomRoutes.js]"]
  node_messageroutes["Message routes<br/>[messageRoutes.js]"]
  node_authmiddleware["JWT protection<br/>[authMiddleware.js]"]
  node_uploadmiddleware["File uploads"]
end

subgraph group_domain["Chat domain"]
  node_authcontroller["Authentication<br/>[authController.js]"]
  node_roomcontroller["Room management<br/>[roomController.js]"]
  node_messagecontroller["Message handling"]
  node_usercontroller["User profiles<br/>[userController.js]"]
end

subgraph group_runtime["Runtime services"]
  node_socketserver["Socket events<br/>[socketHandler.js]"]
  node_users[("User records<br/>[User.js]")]
  node_rooms[("Room records<br/>[Room.js]")]
  node_messages[("Message records<br/>[Message.js]")]
end

node_visitor(("Chat user"))
node_mongodb[("MongoDB")]

node_visitor -->|"opens"| node_app
node_app -->|"routes to"| node_authpages
node_app -->|"protects route"| node_dashboard
node_authpages -->|"uses auth"| node_authstate
node_authstate -->|"requests auth"| node_authservices
node_dashboard -->|"renders"| node_sidebar
node_dashboard -->|"renders"| node_chatui
node_dashboard -->|"requests rooms"| node_roomservices
node_dashboard -->|"requests messages"| node_messageservices
node_sidebar -->|"opens"| node_roomcreate
node_roomcreate -->|"creates room"| node_roomservices
node_roomcreate -->|"announces room"| node_socketclient
node_chatui -->|"uses events"| node_socketclient
node_authservices -->|"uses HTTP"| node_apiadapter
node_roomservices -->|"uses HTTP"| node_apiadapter
node_messageservices -->|"uses HTTP"| node_apiadapter
node_apiadapter -->|"calls API"| node_server
node_socketclient -->|"exchanges events"| node_socketserver
node_server -->|"mounts"| node_authroutes
node_server -->|"mounts"| node_roomroutes
node_server -->|"mounts"| node_messageroutes
node_authroutes -->|"dispatches"| node_authcontroller
node_roomroutes -->|"dispatches"| node_roomcontroller
node_messageroutes -->|"dispatches"| node_messagecontroller
node_messageroutes -->|"protects"| node_authmiddleware
node_messageroutes -->|"uploads through"| node_uploadmiddleware
node_authcontroller -->|"reads and writes"| node_users
node_roomcontroller -->|"reads and writes"| node_rooms
node_roomcontroller -->|"deletes room messages"| node_messages
node_messagecontroller -->|"reads and writes"| node_messages
node_messagecontroller -->|"updates room activity"| node_rooms
node_authmiddleware -->|"resolves identity"| node_users
node_socketserver -->|"updates presence"| node_users
node_socketserver -->|"joins and updates"| node_rooms
node_socketserver -->|"persists chat"| node_messages
node_users -.->|"persists"| node_mongodb
node_rooms -.->|"persists"| node_mongodb
node_messages -.->|"persists"| node_mongodb

click node_app "https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/client/src/App.jsx"
click node_authpages "https://github.com/sornalatha-2002/syntecxhub_chat-application/tree/main/client/src/pages"
click node_authstate "https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/client/src/context/AuthContext.jsx"
click node_dashboard "https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/client/src/pages/Dashboard.jsx"
click node_sidebar "https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/client/src/components/Sidebar/Sidebar.jsx"
click node_roomcreate "https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/client/src/components/Room/CreateRoomModal.jsx"
click node_chatui "https://github.com/sornalatha-2002/syntecxhub_chat-application/tree/main/client/src/components/Chat"
click node_socketclient "https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/client/src/context/SocketContext.jsx"
click node_authservices "https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/client/src/services/authService.js"
click node_roomservices "https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/client/src/services/roomService.js"
click node_messageservices "https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/client/src/services/messageService.js"
click node_apiadapter "https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/client/src/services/api.js"
click node_server "https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/server/server.js"
click node_authroutes "https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/server/routes/authRoutes.js"
click node_roomroutes "https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/server/routes/roomRoutes.js"
click node_messageroutes "https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/server/routes/messageRoutes.js"
click node_authcontroller "https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/server/controllers/authController.js"
click node_roomcontroller "https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/server/controllers/roomController.js"
click node_messagecontroller "https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/server/controllers/messageController.js"
click node_usercontroller "https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/server/controllers/userController.js"
click node_authmiddleware "https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/server/middleware/authMiddleware.js"
click node_uploadmiddleware "https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/server/middleware/uploadMiddleware.js"
click node_socketserver "https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/server/socket/socketHandler.js"
click node_users "https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/server/models/User.js"
click node_rooms "https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/server/models/Room.js"
click node_messages "https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/server/models/Message.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_authpages,node_authstate,node_dashboard,node_sidebar,node_roomcreate,node_chatui,node_socketclient,node_authservices,node_roomservices,node_messageservices,node_apiadapter,node_visitor toneBlue
class node_server,node_authroutes,node_roomroutes,node_messageroutes,node_authmiddleware,node_uploadmiddleware,node_mongodb toneAmber
class node_authcontroller,node_roomcontroller,node_messagecontroller,node_usercontroller toneMint
class node_socketserver,node_users,node_rooms,node_messages toneRose
```

## Components

### React client

- [App routing](https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Login and signup](https://github.com/sornalatha-2002/syntecxhub_chat-application/tree/main/client/src/pages): `client/src/pages`
- [Auth state](https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/client/src/context/AuthContext.jsx): `client/src/context/AuthContext.jsx`
- [Chat dashboard](https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/client/src/pages/Dashboard.jsx): `client/src/pages/Dashboard.jsx`
- [Room sidebar](https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/client/src/components/Sidebar/Sidebar.jsx): `client/src/components/Sidebar/Sidebar.jsx`
- [Room creation](https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/client/src/components/Room/CreateRoomModal.jsx): `client/src/components/Room/CreateRoomModal.jsx`
- [Chat interface](https://github.com/sornalatha-2002/syntecxhub_chat-application/tree/main/client/src/components/Chat): `client/src/components/Chat`
- [Socket client](https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/client/src/context/SocketContext.jsx): `client/src/context/SocketContext.jsx`
- [Auth services](https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/client/src/services/authService.js): `client/src/services/authService.js`
- [Room services](https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/client/src/services/roomService.js): `client/src/services/roomService.js`
- [Message services](https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/client/src/services/messageService.js): `client/src/services/messageService.js`
- [HTTP adapter](https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/client/src/services/api.js): `client/src/services/api.js`

### HTTP API

- [Express server](https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/server/server.js): `server/server.js`
- [Auth routes](https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/server/routes/authRoutes.js): `server/routes/authRoutes.js`
- [Room routes](https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/server/routes/roomRoutes.js): `server/routes/roomRoutes.js`
- [Message routes](https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/server/routes/messageRoutes.js): `server/routes/messageRoutes.js`
- [JWT protection](https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/server/middleware/authMiddleware.js): `server/middleware/authMiddleware.js`
- [File uploads](https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/server/middleware/uploadMiddleware.js): `server/middleware/uploadMiddleware.js`

### Chat domain

- [Authentication](https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/server/controllers/authController.js): `server/controllers/authController.js`
- [Room management](https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/server/controllers/roomController.js): `server/controllers/roomController.js`
- [Message handling](https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/server/controllers/messageController.js): `server/controllers/messageController.js`
- [User profiles](https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/server/controllers/userController.js): `server/controllers/userController.js`

### Runtime services

- [Socket events](https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/server/socket/socketHandler.js): `server/socket/socketHandler.js`
- [User records](https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/server/models/User.js): `server/models/User.js`
- [Room records](https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/server/models/Room.js): `server/models/Room.js`
- [Message records](https://github.com/sornalatha-2002/syntecxhub_chat-application/blob/main/server/models/Message.js): `server/models/Message.js`

### Other components

- **Chat user**
- **MongoDB**

## Connections

- Chat user → App routing: opens (evidence: `README.md`)
- App routing → Login and signup: routes to (evidence: `client/src/App.jsx`)
- App routing → Chat dashboard: protects route (evidence: `client/src/App.jsx`)
- Login and signup → Auth state: uses auth (evidence: `client/src/pages/Login.jsx`)
- Auth state → Auth services: requests auth (evidence: `client/src/context/AuthContext.jsx`)
- Chat dashboard → Room sidebar: renders (evidence: `client/src/pages/Dashboard.jsx`)
- Chat dashboard → Chat interface: renders (evidence: `client/src/pages/Dashboard.jsx`)
- Chat dashboard → Room services: requests rooms (evidence: `client/src/pages/Dashboard.jsx`)
- Chat dashboard → Message services: requests messages (evidence: `client/src/pages/Dashboard.jsx`)
- Room sidebar → Room creation: opens (evidence: `client/src/components/Sidebar/Sidebar.jsx`)
- Room creation → Room services: creates room (evidence: `client/src/components/Room/CreateRoomModal.jsx`)
- Room creation → Socket client: announces room (evidence: `client/src/components/Room/CreateRoomModal.jsx`)
- Chat interface → Socket client: uses events (evidence: `client/src/components/Chat/ChatInput.jsx`)
- Auth services → HTTP adapter: uses HTTP (evidence: `client/src/services/authService.js`)
- Room services → HTTP adapter: uses HTTP (evidence: `client/src/services/roomService.js`)
- Message services → HTTP adapter: uses HTTP (evidence: `client/src/services/messageService.js`)
- HTTP adapter → Express server: calls API (evidence: `README.md`)
- Socket client → Socket events: exchanges events (evidence: `README.md`)
- Express server → Auth routes: mounts (evidence: `server/server.js`)
- Express server → Room routes: mounts (evidence: `server/server.js`)
- Express server → Message routes: mounts (evidence: `server/server.js`)
- Auth routes → Authentication: dispatches (evidence: `server/routes/authRoutes.js`)
- Room routes → Room management: dispatches (evidence: `server/routes/roomRoutes.js`)
- Message routes → Message handling: dispatches (evidence: `server/routes/messageRoutes.js`)
- Message routes → JWT protection: protects (evidence: `server/routes/messageRoutes.js`)
- Message routes → File uploads: uploads through (evidence: `server/routes/messageRoutes.js`)
- Authentication → User records: reads and writes (evidence: `server/controllers/authController.js`)
- Room management → Room records: reads and writes (evidence: `server/controllers/roomController.js`)
- Room management → Message records: deletes room messages (evidence: `server/controllers/roomController.js`)
- Message handling → Message records: reads and writes (evidence: `server/controllers/messageController.js`)
- Message handling → Room records: updates room activity (evidence: `server/controllers/messageController.js`)
- JWT protection → User records: resolves identity (evidence: `server/middleware/authMiddleware.js`)
- Socket events → User records: updates presence (evidence: `server/socket/socketHandler.js`)
- Socket events → Room records: joins and updates (evidence: `server/socket/socketHandler.js`)
- Socket events → Message records: persists chat (evidence: `server/socket/socketHandler.js`)
- User records → MongoDB: persists (evidence: `README.md`)
- Room records → MongoDB: persists (evidence: `README.md`)
- Message records → MongoDB: persists (evidence: `README.md`)
