# harshrai2910/real-time-chat-system architecture

> Architecture diagram of the GitHub repository harshrai2910/real-time-chat-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/harshrai2910/real-time-chat-system
- Repository: https://github.com/harshrai2910/real-time-chat-system

## Overview

This is a small real-time group chat: a participant enters a nickname, joins the shared room, exchanges messages, and sees typing indicators. The React app owns the interaction and message display; a Socket.IO client connects it to the server, which joins sockets to a room and broadcasts chat events. The sampled files support this event flow; no persistent message store is shown.

Main entry points: [`client/src/App.jsx`](https://github.com/harshrai2910/real-time-chat-system/blob/main/client/src/App.jsx) (Chat interface), [`server/app.js`](https://github.com/harshrai2910/real-time-chat-system/blob/main/server/app.js) (Socket.IO server), [`client/src/WS.js`](https://github.com/harshrai2910/real-time-chat-system/blob/main/client/src/WS.js) (Socket connector)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Chat client"]
  node_chat_ui["Chat interface<br/>[App.jsx]"]
  node_socket_client["Socket connector<br/>[WS.js]"]
end

subgraph group_realtime["Realtime service"]
  node_socket_server["Socket.IO server<br/>[app.js]"]
  node_group_room["Group room<br/>[app.js]"]
end

node_participant(("Participant"))

node_participant -->|"joins and chats"| node_chat_ui
node_chat_ui -->|"connects through"| node_socket_client
node_socket_client -->|"opens connection"| node_socket_server
node_chat_ui -->|"emits chat events"| node_socket_server
node_socket_server -->|"joins and broadcasts"| node_group_room
node_socket_server -->|"broadcasts room events"| node_chat_ui

click node_chat_ui "https://github.com/harshrai2910/real-time-chat-system/blob/main/client/src/App.jsx"
click node_socket_client "https://github.com/harshrai2910/real-time-chat-system/blob/main/client/src/WS.js"
click node_socket_server "https://github.com/harshrai2910/real-time-chat-system/blob/main/server/app.js"
click node_group_room "https://github.com/harshrai2910/real-time-chat-system/blob/main/server/app.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_chat_ui,node_socket_client toneBlue
class node_socket_server,node_group_room toneAmber
class node_participant toneIndigo
```

## Components

### Chat client

- [Chat interface](https://github.com/harshrai2910/real-time-chat-system/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Socket connector](https://github.com/harshrai2910/real-time-chat-system/blob/main/client/src/WS.js): `client/src/WS.js`

### Realtime service

- [Socket.IO server](https://github.com/harshrai2910/real-time-chat-system/blob/main/server/app.js): `server/app.js`
- [Group room](https://github.com/harshrai2910/real-time-chat-system/blob/main/server/app.js): `server/app.js`

### Other components

- **Participant**

## Connections

- Participant → Chat interface: joins and chats (evidence: `client/src/App.jsx`)
- Chat interface → Socket connector: connects through (evidence: `client/src/App.jsx`)
- Socket connector → Socket.IO server: opens connection (evidence: `client/src/WS.js`)
- Chat interface → Socket.IO server: emits chat events (evidence: `client/src/App.jsx`)
- Socket.IO server → Group room: joins and broadcasts (evidence: `server/app.js`)
- Socket.IO server → Chat interface: broadcasts room events (evidence: `server/app.js`)
