# kaushikcodes-112/chat_application_using_websockets architecture

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

- Interactive diagram: https://gitdiagram.com/kaushikcodes-112/chat_application_using_websockets
- Repository: https://github.com/kaushikcodes-112/chat_application_using_websockets

## Overview

Back Rooms is a room-based, real-time chat application. A user creates a room or submits a room ID and alias; after the backend authorizes the join, the app opens the chat view, fetches active users, and connects by WebSocket. Chat messages, typing notifications, and join/leave events are broadcast to room participants. The backend keeps room membership and sockets in memory. Source excerpts support the frontend-to-backend calls and the backend's manager operations; no persistent database is shown.

Main entry points: [`backend/new_main.py`](https://github.com/kaushikcodes-112/chat_application_using_websockets/blob/main/backend/new_main.py) (Room HTTP routes), [`frontend/Chat_app/src/components/AccessPortal.jsx`](https://github.com/kaushikcodes-112/chat_application_using_websockets/blob/main/frontend/Chat_app/src/components/AccessPortal.jsx) (Room access portal), [`frontend/Chat_app/src/components/ChatArea.jsx`](https://github.com/kaushikcodes-112/chat_application_using_websockets/blob/main/frontend/Chat_app/src/components/ChatArea.jsx) (Chat view), [`frontend/Chat_app/src/App.jsx`](https://github.com/kaushikcodes-112/chat_application_using_websockets/blob/main/frontend/Chat_app/src/App.jsx) (Screen coordinator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Chat client"]
  node_app_entry["React entry<br/>[main.jsx]"]
  node_app["Screen coordinator<br/>[App.jsx]"]
  node_portal["Room access portal<br/>[AccessPortal.jsx]"]
  node_loading["Loading screen<br/>[LoadingScreen.jsx]"]
  node_chat_view["Chat view<br/>[ChatArea.jsx]"]
  node_sidebar["Room roster<br/>[Sidebar.jsx]"]
  node_socket_hook["WebSocket client"]
end

subgraph group_server["Chat backend"]
  node_room_api["Room HTTP routes<br/>[new_main.py]"]
  node_code_generator["Room code generator<br/>[check_secrets.py]"]
end

subgraph group_realtime["Room messaging"]
  node_room_registry[("Room registry<br/>[new_main.py]")]
  node_socket_routes["WebSocket route<br/>[new_main.py]"]
end

node_visitor(("Room participant"))

node_visitor -->|"uses"| node_portal
node_app_entry -->|"renders"| node_app
node_app -->|"renders"| node_portal
node_app -->|"renders"| node_chat_view
node_portal -->|"renders"| node_loading
node_portal -->|"requests registration"| node_room_api
node_portal -->|"requests room creation"| node_room_api
node_room_api -->|"checks room membership"| node_room_registry
node_room_api -->|"requests room code"| node_code_generator
node_chat_view -->|"renders"| node_sidebar
node_chat_view -->|"fetches occupants"| node_room_api
node_chat_view -->|"sends chat and typing"| node_socket_hook
node_socket_hook -->|"opens WebSocket"| node_socket_routes
node_socket_routes -->|"connects and broadcasts"| node_room_registry
node_room_api -->|"creates rooms and lists users"| node_room_registry

click node_app_entry "https://github.com/kaushikcodes-112/chat_application_using_websockets/blob/main/frontend/Chat_app/src/main.jsx"
click node_app "https://github.com/kaushikcodes-112/chat_application_using_websockets/blob/main/frontend/Chat_app/src/App.jsx"
click node_portal "https://github.com/kaushikcodes-112/chat_application_using_websockets/blob/main/frontend/Chat_app/src/components/AccessPortal.jsx"
click node_loading "https://github.com/kaushikcodes-112/chat_application_using_websockets/blob/main/frontend/Chat_app/src/components/LoadingScreen.jsx"
click node_chat_view "https://github.com/kaushikcodes-112/chat_application_using_websockets/blob/main/frontend/Chat_app/src/components/ChatArea.jsx"
click node_sidebar "https://github.com/kaushikcodes-112/chat_application_using_websockets/blob/main/frontend/Chat_app/src/components/Sidebar.jsx"
click node_socket_hook "https://github.com/kaushikcodes-112/chat_application_using_websockets/blob/main/frontend/Chat_app/src/hooks/useChatWebSocket.js"
click node_room_api "https://github.com/kaushikcodes-112/chat_application_using_websockets/blob/main/backend/new_main.py"
click node_room_registry "https://github.com/kaushikcodes-112/chat_application_using_websockets/blob/main/backend/new_main.py"
click node_socket_routes "https://github.com/kaushikcodes-112/chat_application_using_websockets/blob/main/backend/new_main.py"
click node_code_generator "https://github.com/kaushikcodes-112/chat_application_using_websockets/blob/main/backend/check_secrets.py"

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_entry,node_app,node_portal,node_loading,node_chat_view,node_sidebar,node_socket_hook toneBlue
class node_room_api,node_code_generator toneAmber
class node_room_registry,node_socket_routes toneMint
class node_visitor toneIndigo
```

## Components

### Chat client

- [React entry](https://github.com/kaushikcodes-112/chat_application_using_websockets/blob/main/frontend/Chat_app/src/main.jsx): `frontend/Chat_app/src/main.jsx`
- [Screen coordinator](https://github.com/kaushikcodes-112/chat_application_using_websockets/blob/main/frontend/Chat_app/src/App.jsx): `frontend/Chat_app/src/App.jsx`
- [Room access portal](https://github.com/kaushikcodes-112/chat_application_using_websockets/blob/main/frontend/Chat_app/src/components/AccessPortal.jsx): `frontend/Chat_app/src/components/AccessPortal.jsx`
- [Loading screen](https://github.com/kaushikcodes-112/chat_application_using_websockets/blob/main/frontend/Chat_app/src/components/LoadingScreen.jsx): `frontend/Chat_app/src/components/LoadingScreen.jsx`
- [Chat view](https://github.com/kaushikcodes-112/chat_application_using_websockets/blob/main/frontend/Chat_app/src/components/ChatArea.jsx): `frontend/Chat_app/src/components/ChatArea.jsx`
- [Room roster](https://github.com/kaushikcodes-112/chat_application_using_websockets/blob/main/frontend/Chat_app/src/components/Sidebar.jsx): `frontend/Chat_app/src/components/Sidebar.jsx`
- [WebSocket client](https://github.com/kaushikcodes-112/chat_application_using_websockets/blob/main/frontend/Chat_app/src/hooks/useChatWebSocket.js): `frontend/Chat_app/src/hooks/useChatWebSocket.js`

### Chat backend

- [Room HTTP routes](https://github.com/kaushikcodes-112/chat_application_using_websockets/blob/main/backend/new_main.py): `backend/new_main.py`
- [Room code generator](https://github.com/kaushikcodes-112/chat_application_using_websockets/blob/main/backend/check_secrets.py): `backend/check_secrets.py`

### Room messaging

- [Room registry](https://github.com/kaushikcodes-112/chat_application_using_websockets/blob/main/backend/new_main.py): `backend/new_main.py`
- [WebSocket route](https://github.com/kaushikcodes-112/chat_application_using_websockets/blob/main/backend/new_main.py): `backend/new_main.py`

### Other components

- **Room participant**

## Connections

- Room participant → Room access portal: uses (evidence: `frontend/Chat_app/src/components/AccessPortal.jsx`)
- React entry → Screen coordinator: renders (evidence: `frontend/Chat_app/src/main.jsx`)
- Screen coordinator → Room access portal: renders (evidence: `frontend/Chat_app/src/App.jsx`)
- Screen coordinator → Chat view: renders (evidence: `frontend/Chat_app/src/App.jsx`)
- Room access portal → Loading screen: renders (evidence: `frontend/Chat_app/src/components/AccessPortal.jsx`)
- Room access portal → Room HTTP routes: requests registration (evidence: `frontend/Chat_app/src/components/AccessPortal.jsx`)
- Room access portal → Room HTTP routes: requests room creation (evidence: `frontend/Chat_app/src/components/AccessPortal.jsx`)
- Room HTTP routes → Room registry: checks room membership (evidence: `backend/new_main.py`)
- Room HTTP routes → Room code generator: requests room code (evidence: `backend/new_main.py`)
- Chat view → Room roster: renders (evidence: `frontend/Chat_app/src/components/ChatArea.jsx`)
- Chat view → Room HTTP routes: fetches occupants (evidence: `frontend/Chat_app/src/components/ChatArea.jsx`)
- Chat view → WebSocket client: sends chat and typing (evidence: `frontend/Chat_app/src/components/ChatArea.jsx`)
- WebSocket client → WebSocket route: opens WebSocket (evidence: `frontend/Chat_app/src/hooks/useChatWebSocket.js`)
- WebSocket route → Room registry: connects and broadcasts (evidence: `backend/new_main.py`)
- Room HTTP routes → Room registry: creates rooms and lists users (evidence: `backend/new_main.py`)
