# bryceliu17/private-chat architecture

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

- Interactive diagram: https://gitdiagram.com/bryceliu17/private-chat
- Repository: https://github.com/bryceliu17/private-chat

## Overview

Private Chat is a React client with an Express and Socket.IO backend for authenticated, real-time chat among known users. The main workflow is login, choose a preset room, exchange text or media messages, and see room presence; the app also supports voice/video calls, administration, support payments, and Tetris game records. The server entry point wires route and socket modules. README capabilities and filenames inform unsampled branches; their internal implementation details are not inferred.

Main entry points: [`server/index.js`](https://github.com/bryceliu17/private-chat/blob/main/server/index.js) (HTTP and socket entry), [`client/src/App.jsx`](https://github.com/bryceliu17/private-chat/blob/main/client/src/App.jsx) (App coordinator), [`server/db.js`](https://github.com/bryceliu17/private-chat/blob/main/server/db.js) (PostgreSQL), [`server/messages.js`](https://github.com/bryceliu17/private-chat/blob/main/server/messages.js) (Room messaging)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client experience"]
  node_app["App coordinator<br/>[App.jsx]"]
  node_login["Login view<br/>[LoginView.jsx]"]
  node_roomlist["Room list<br/>[RoomListView.jsx]"]
  node_chatview["Chat room view<br/>[ChatRoomView.jsx]"]
  node_adminpanel["User admin"]
  node_tetris["Tetris game<br/>[TetrisGame.jsx]"]
  node_records["Game records<br/>[RecordsPage.jsx]"]
  node_android["Android shell<br/>[MainActivity.java]"]
end

subgraph group_server["Server features"]
  node_api["HTTP and socket entry<br/>[index.js]"]
  node_auth["Authentication<br/>[auth.js]"]
  node_messages["Room messaging<br/>[messages.js]"]
  node_realtime["Socket events<br/>[sockets.js]"]
  node_presence["Room presence<br/>[presence.js]"]
  node_payments["Support payments<br/>[payments.js]"]
  node_game_records["Record routes<br/>[gameRecords.js]"]
  node_push["Push notifications"]
  node_storage["Media storage<br/>[storage.js]"]
  node_encryption["Message encryption<br/>[encryption.js]"]
end

subgraph group_state["State and storage"]
  node_database[("PostgreSQL<br/>[db.js]")]
  node_uploads[("Uploaded media<br/>[storage.js]")]
end

subgraph group_integrations["External services"]
  node_stripe["Stripe"]
  node_firebase["Firebase messaging"]
  node_email["Email service"]
end

node_person(("Chat user"))

node_person -->|"uses"| node_app
node_app -->|"renders"| node_login
node_app -->|"renders"| node_roomlist
node_app -->|"renders"| node_chatview
node_app -->|"renders"| node_adminpanel
node_person -->|"signs in"| node_login
node_app -->|"HTTP requests"| node_api
node_app -->|"Socket.IO events"| node_realtime
node_api -->|"registers routes"| node_auth
node_api -->|"registers routes"| node_messages
node_api -->|"registers routes"| node_payments
node_api -->|"registers routes"| node_game_records
node_api -->|"registers routes"| node_push
node_api -->|"registers routes"| node_storage
node_api -->|"registers handlers"| node_realtime
node_api -->|"creates"| node_presence
node_auth -->|"reads and writes"| node_database
node_messages -->|"reads and writes"| node_database
node_messages -->|"stores media"| node_storage
node_realtime -->|"uses"| node_presence
node_realtime -->|"persists chat"| node_database
node_presence -->|"reads and writes"| node_database
node_storage -->|"reads and writes"| node_uploads
node_storage -->|"encrypts files"| node_encryption
node_messages -->|"encrypts text"| node_encryption
node_payments -.->|"creates payments"| node_stripe
node_push -.->|"sends notifications"| node_firebase
node_auth -.->|"sends MFA codes"| node_email
node_tetris -->|"submits records"| node_api
node_records -->|"loads and deletes"| node_api
node_game_records -->|"reads and writes"| node_database
node_android -->|"hosts client"| node_app

click node_app "https://github.com/bryceliu17/private-chat/blob/main/client/src/App.jsx"
click node_login "https://github.com/bryceliu17/private-chat/blob/main/client/src/components/LoginView.jsx"
click node_roomlist "https://github.com/bryceliu17/private-chat/blob/main/client/src/components/RoomListView.jsx"
click node_chatview "https://github.com/bryceliu17/private-chat/blob/main/client/src/components/ChatRoomView.jsx"
click node_adminpanel "https://github.com/bryceliu17/private-chat/blob/main/client/src/components/AdminUsersPanel.jsx"
click node_tetris "https://github.com/bryceliu17/private-chat/blob/main/client/src/components/TetrisGame.jsx"
click node_records "https://github.com/bryceliu17/private-chat/blob/main/client/src/components/RecordsPage.jsx"
click node_api "https://github.com/bryceliu17/private-chat/blob/main/server/index.js"
click node_auth "https://github.com/bryceliu17/private-chat/blob/main/server/auth.js"
click node_messages "https://github.com/bryceliu17/private-chat/blob/main/server/messages.js"
click node_realtime "https://github.com/bryceliu17/private-chat/blob/main/server/sockets.js"
click node_presence "https://github.com/bryceliu17/private-chat/blob/main/server/presence.js"
click node_payments "https://github.com/bryceliu17/private-chat/blob/main/server/payments.js"
click node_game_records "https://github.com/bryceliu17/private-chat/blob/main/server/gameRecords.js"
click node_push "https://github.com/bryceliu17/private-chat/blob/main/server/pushNotifications.js"
click node_storage "https://github.com/bryceliu17/private-chat/blob/main/server/storage.js"
click node_encryption "https://github.com/bryceliu17/private-chat/blob/main/server/encryption.js"
click node_database "https://github.com/bryceliu17/private-chat/blob/main/server/db.js"
click node_uploads "https://github.com/bryceliu17/private-chat/blob/main/server/storage.js"
click node_android "https://github.com/bryceliu17/private-chat/blob/main/android/app/src/main/java/com/bryceliu/privatechat/MainActivity.java"

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_login,node_roomlist,node_chatview,node_adminpanel,node_tetris,node_records,node_android,node_person toneBlue
class node_api,node_auth,node_messages,node_realtime,node_presence,node_payments,node_game_records,node_push,node_storage,node_encryption toneAmber
class node_database,node_uploads toneMint
class node_stripe,node_firebase,node_email toneRose
```

## Components

### Client experience

- [App coordinator](https://github.com/bryceliu17/private-chat/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Login view](https://github.com/bryceliu17/private-chat/blob/main/client/src/components/LoginView.jsx): `client/src/components/LoginView.jsx`
- [Room list](https://github.com/bryceliu17/private-chat/blob/main/client/src/components/RoomListView.jsx): `client/src/components/RoomListView.jsx`
- [Chat room view](https://github.com/bryceliu17/private-chat/blob/main/client/src/components/ChatRoomView.jsx): `client/src/components/ChatRoomView.jsx`
- [User admin](https://github.com/bryceliu17/private-chat/blob/main/client/src/components/AdminUsersPanel.jsx): `client/src/components/AdminUsersPanel.jsx`
- [Tetris game](https://github.com/bryceliu17/private-chat/blob/main/client/src/components/TetrisGame.jsx): `client/src/components/TetrisGame.jsx`
- [Game records](https://github.com/bryceliu17/private-chat/blob/main/client/src/components/RecordsPage.jsx): `client/src/components/RecordsPage.jsx`
- [Android shell](https://github.com/bryceliu17/private-chat/blob/main/android/app/src/main/java/com/bryceliu/privatechat/MainActivity.java): `android/app/src/main/java/com/bryceliu/privatechat/MainActivity.java`

### Server features

- [HTTP and socket entry](https://github.com/bryceliu17/private-chat/blob/main/server/index.js): `server/index.js`
- [Authentication](https://github.com/bryceliu17/private-chat/blob/main/server/auth.js): `server/auth.js`
- [Room messaging](https://github.com/bryceliu17/private-chat/blob/main/server/messages.js): `server/messages.js`
- [Socket events](https://github.com/bryceliu17/private-chat/blob/main/server/sockets.js): `server/sockets.js`
- [Room presence](https://github.com/bryceliu17/private-chat/blob/main/server/presence.js): `server/presence.js`
- [Support payments](https://github.com/bryceliu17/private-chat/blob/main/server/payments.js): `server/payments.js`
- [Record routes](https://github.com/bryceliu17/private-chat/blob/main/server/gameRecords.js): `server/gameRecords.js`
- [Push notifications](https://github.com/bryceliu17/private-chat/blob/main/server/pushNotifications.js): `server/pushNotifications.js`
- [Media storage](https://github.com/bryceliu17/private-chat/blob/main/server/storage.js): `server/storage.js`
- [Message encryption](https://github.com/bryceliu17/private-chat/blob/main/server/encryption.js): `server/encryption.js`

### State and storage

- [PostgreSQL](https://github.com/bryceliu17/private-chat/blob/main/server/db.js): `server/db.js`
- [Uploaded media](https://github.com/bryceliu17/private-chat/blob/main/server/storage.js): `server/storage.js`

### External services

- **Stripe**
- **Firebase messaging**
- **Email service**

### Other components

- **Chat user**

## Connections

- Chat user → App coordinator: uses
- App coordinator → Login view: renders
- App coordinator → Room list: renders
- App coordinator → Chat room view: renders
- App coordinator → User admin: renders
- Chat user → Login view: signs in
- App coordinator → HTTP and socket entry: HTTP requests
- App coordinator → Socket events: Socket.IO events
- HTTP and socket entry → Authentication: registers routes
- HTTP and socket entry → Room messaging: registers routes
- HTTP and socket entry → Support payments: registers routes
- HTTP and socket entry → Record routes: registers routes
- HTTP and socket entry → Push notifications: registers routes
- HTTP and socket entry → Media storage: registers routes
- HTTP and socket entry → Socket events: registers handlers
- HTTP and socket entry → Room presence: creates
- Authentication → PostgreSQL: reads and writes
- Room messaging → PostgreSQL: reads and writes
- Room messaging → Media storage: stores media
- Socket events → Room presence: uses
- Socket events → PostgreSQL: persists chat
- Room presence → PostgreSQL: reads and writes
- Media storage → Uploaded media: reads and writes
- Media storage → Message encryption: encrypts files
- Room messaging → Message encryption: encrypts text
- Support payments → Stripe: creates payments
- Push notifications → Firebase messaging: sends notifications
- Authentication → Email service: sends MFA codes
- Tetris game → HTTP and socket entry: submits records
- Game records → HTTP and socket entry: loads and deletes
- Record routes → PostgreSQL: reads and writes
- Android shell → App coordinator: hosts client
