# nitinkumar08072006-a11y/chetbox architecture

> Architecture diagram of the GitHub repository nitinkumar08072006-a11y/chetbox, 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/nitinkumar08072006-a11y/chetbox
- Repository: https://github.com/nitinkumar08072006-a11y/chetbox

## Overview

CipherRoom is a real-time chat application with account registration/login, room creation and joining, and room message history and relay. The main flow is a browser connecting to the Socket.IO server, authenticating, selecting a room, and exchanging messages; SQLite stores accounts, room keys, and encrypted message payloads. The README only names the project, so product capabilities and relationships here are based on the sampled server source; client-side behavior is not shown.

Main entry points: [`server.js`](https://github.com/nitinkumar08072006-a11y/chetbox/blob/main/server.js) (HTTP and Socket.IO), [`public/index.html`](https://github.com/nitinkumar08072006-a11y/chetbox/blob/main/public/index.html) (Browser client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime and client"]
  node_client["Browser client<br/>[index.html]"]
  node_server["HTTP and Socket.IO<br/>[server.js]"]
end

subgraph group_identity["Identity and sessions"]
  node_auth["Account handlers<br/>[server.js]"]
  node_sessions["Active sessions<br/>[server.js]"]
  node_passwords["Password hashing"]
end

subgraph group_rooms["Room management"]
  node_rooms["Room handlers<br/>[server.js]"]
end

subgraph group_chat["Chat and storage"]
  node_chat["Chat handlers<br/>[server.js]"]
  node_db[("SQLite database<br/>[server.js]")]
end

node_user(("Chat user"))

node_user -.->|"uses"| node_client
node_client -.->|"Socket.IO events"| node_server
node_server -->|"serves static files"| node_client
node_server -->|"dispatches auth"| node_auth
node_server -->|"dispatches room events"| node_rooms
node_server -->|"dispatches chat events"| node_chat
node_auth -->|"reads and writes"| node_db
node_auth -->|"hashes and compares"| node_passwords
node_auth -->|"creates session"| node_sessions
node_server -->|"clears on disconnect"| node_sessions
node_rooms -->|"reads and writes"| node_db
node_chat -->|"loads and saves"| node_db
node_chat -->|"checks room session"| node_sessions
node_chat -->|"relays messages"| node_server

click node_client "https://github.com/nitinkumar08072006-a11y/chetbox/blob/main/public/index.html"
click node_server "https://github.com/nitinkumar08072006-a11y/chetbox/blob/main/server.js"
click node_auth "https://github.com/nitinkumar08072006-a11y/chetbox/blob/main/server.js"
click node_sessions "https://github.com/nitinkumar08072006-a11y/chetbox/blob/main/server.js"
click node_rooms "https://github.com/nitinkumar08072006-a11y/chetbox/blob/main/server.js"
click node_chat "https://github.com/nitinkumar08072006-a11y/chetbox/blob/main/server.js"
click node_db "https://github.com/nitinkumar08072006-a11y/chetbox/blob/main/server.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_client,node_server,node_user toneBlue
class node_auth,node_sessions,node_passwords toneAmber
class node_rooms toneMint
class node_chat,node_db toneRose
```

## Components

### Runtime and client

- [Browser client](https://github.com/nitinkumar08072006-a11y/chetbox/blob/main/public/index.html): `public/index.html`
- [HTTP and Socket.IO](https://github.com/nitinkumar08072006-a11y/chetbox/blob/main/server.js): `server.js`

### Identity and sessions

- [Account handlers](https://github.com/nitinkumar08072006-a11y/chetbox/blob/main/server.js): `server.js`
- [Active sessions](https://github.com/nitinkumar08072006-a11y/chetbox/blob/main/server.js): `server.js`
- **Password hashing**

### Room management

- [Room handlers](https://github.com/nitinkumar08072006-a11y/chetbox/blob/main/server.js): `server.js`

### Chat and storage

- [Chat handlers](https://github.com/nitinkumar08072006-a11y/chetbox/blob/main/server.js): `server.js`
- [SQLite database](https://github.com/nitinkumar08072006-a11y/chetbox/blob/main/server.js): `server.js`

### Other components

- **Chat user**

## Connections

- Chat user → Browser client: uses
- Browser client → HTTP and Socket.IO: Socket.IO events
- HTTP and Socket.IO → Browser client: serves static files (evidence: `server.js`)
- HTTP and Socket.IO → Account handlers: dispatches auth (evidence: `server.js`)
- HTTP and Socket.IO → Room handlers: dispatches room events (evidence: `server.js`)
- HTTP and Socket.IO → Chat handlers: dispatches chat events (evidence: `server.js`)
- Account handlers → SQLite database: reads and writes (evidence: `server.js`)
- Account handlers → Password hashing: hashes and compares (evidence: `server.js`)
- Account handlers → Active sessions: creates session (evidence: `server.js`)
- HTTP and Socket.IO → Active sessions: clears on disconnect (evidence: `server.js`)
- Room handlers → SQLite database: reads and writes (evidence: `server.js`)
- Chat handlers → SQLite database: loads and saves (evidence: `server.js`)
- Chat handlers → Active sessions: checks room session (evidence: `server.js`)
- Chat handlers → HTTP and Socket.IO: relays messages (evidence: `server.js`)
