# gherg006/bluebubbles-test architecture

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

- Interactive diagram: https://gitdiagram.com/gherg006/bluebubbles-test
- Repository: https://github.com/gherg006/bluebubbles-test

## Overview

BlueBubbles is a desktop messaging client backed by an HTTPS web API. Users register or log in, browse users and saved contacts, open paged conversations, and send text or file attachments; the server authenticates requests, persists account and message data, and encrypts messages and uploaded files. The client also supports contact sorting/read tracking and file retrieval, which are indicated by the sampled code and API comments. Source excerpts are partial, so links for unsampled route behavior and startup wiring are not asserted.

Main entry points: [`server/message_system.py`](https://github.com/gherg006/bluebubbles-test/blob/main/server/message_system.py) (Message system), [`client/login_window.py`](https://github.com/gherg006/bluebubbles-test/blob/main/client/login_window.py) (Login and registration), [`server/server_auth.py`](https://github.com/gherg006/bluebubbles-test/blob/main/server/server_auth.py) (API routes), [`client/transport.py`](https://github.com/gherg006/bluebubbles-test/blob/main/client/transport.py) (Secure transport)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Desktop client"]
  node_application["Client application<br/>[main.py]"]
  node_login["Login and registration<br/>[login_window.py]"]
  node_chat["Chat interface<br/>[chat_window.py]"]
  node_transport["Secure transport<br/>[transport.py]"]
end

subgraph group_api["HTTPS API"]
  node_api["API routes<br/>[server_auth.py]"]
  node_auth["Accounts and contacts<br/>[server_auth.py]"]
end

subgraph group_messaging["Message services"]
  node_messages["Message system<br/>[message_system.py]"]
  node_keys["Recipient key store<br/>[message_system.py]"]
  node_encryption["Message encryption"]
  node_file_storage["Encrypted file storage<br/>[message_system.py]"]
end

subgraph group_storage["Persistence"]
  node_database[("PostgreSQL database")]
  node_blobs[("Encrypted file blobs")]
end

node_person(("User"))

node_person -->|"starts"| node_application
node_application -->|"opens"| node_login
node_login -->|"sends credentials"| node_transport
node_login -->|"opens after login"| node_chat
node_chat -->|"requests data"| node_transport
node_transport -->|"HTTPS requests"| node_api
node_api -->|"checks accounts"| node_auth
node_api -->|"dispatches messaging"| node_messages
node_auth -->|"queries accounts"| node_database
node_messages -->|"gets keys"| node_keys
node_messages -->|"encrypts messages"| node_encryption
node_messages -->|"stores or retrieves files"| node_file_storage
node_messages -->|"queries messages"| node_database
node_keys -->|"reads and writes keys"| node_database
node_keys -->|"wraps data keys"| node_encryption
node_file_storage -->|"reads and writes encrypted blobs"| node_blobs

click node_application "https://github.com/gherg006/bluebubbles-test/blob/main/client/main.py"
click node_login "https://github.com/gherg006/bluebubbles-test/blob/main/client/login_window.py"
click node_chat "https://github.com/gherg006/bluebubbles-test/blob/main/client/chat_window.py"
click node_transport "https://github.com/gherg006/bluebubbles-test/blob/main/client/transport.py"
click node_api "https://github.com/gherg006/bluebubbles-test/blob/main/server/server_auth.py"
click node_auth "https://github.com/gherg006/bluebubbles-test/blob/main/server/server_auth.py"
click node_messages "https://github.com/gherg006/bluebubbles-test/blob/main/server/message_system.py"
click node_keys "https://github.com/gherg006/bluebubbles-test/blob/main/server/message_system.py"
click node_encryption "https://github.com/gherg006/bluebubbles-test/blob/main/server/message_encryption.py"
click node_file_storage "https://github.com/gherg006/bluebubbles-test/blob/main/server/message_system.py"
click node_database "https://github.com/gherg006/bluebubbles-test/blob/main/server/SQL/bluebubbles_database.sql"

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_application,node_login,node_chat,node_transport,node_person toneBlue
class node_api,node_auth toneAmber
class node_messages,node_keys,node_encryption,node_file_storage toneMint
class node_database,node_blobs toneRose
```

## Components

### Desktop client

- [Client application](https://github.com/gherg006/bluebubbles-test/blob/main/client/main.py): `client/main.py`
- [Login and registration](https://github.com/gherg006/bluebubbles-test/blob/main/client/login_window.py): `client/login_window.py`
- [Chat interface](https://github.com/gherg006/bluebubbles-test/blob/main/client/chat_window.py): `client/chat_window.py`
- [Secure transport](https://github.com/gherg006/bluebubbles-test/blob/main/client/transport.py): `client/transport.py`

### HTTPS API

- [API routes](https://github.com/gherg006/bluebubbles-test/blob/main/server/server_auth.py): `server/server_auth.py`
- [Accounts and contacts](https://github.com/gherg006/bluebubbles-test/blob/main/server/server_auth.py): `server/server_auth.py`

### Message services

- [Message system](https://github.com/gherg006/bluebubbles-test/blob/main/server/message_system.py): `server/message_system.py`
- [Recipient key store](https://github.com/gherg006/bluebubbles-test/blob/main/server/message_system.py): `server/message_system.py`
- [Message encryption](https://github.com/gherg006/bluebubbles-test/blob/main/server/message_encryption.py): `server/message_encryption.py`
- [Encrypted file storage](https://github.com/gherg006/bluebubbles-test/blob/main/server/message_system.py): `server/message_system.py`

### Persistence

- [PostgreSQL database](https://github.com/gherg006/bluebubbles-test/blob/main/server/SQL/bluebubbles_database.sql): `server/SQL/bluebubbles_database.sql`
- **Encrypted file blobs**

### Other components

- **User**

## Connections

- User → Client application: starts
- Client application → Login and registration: opens
- Login and registration → Secure transport: sends credentials
- Login and registration → Chat interface: opens after login
- Chat interface → Secure transport: requests data
- Secure transport → API routes: HTTPS requests
- API routes → Accounts and contacts: checks accounts
- API routes → Message system: dispatches messaging
- Accounts and contacts → PostgreSQL database: queries accounts
- Message system → Recipient key store: gets keys
- Message system → Message encryption: encrypts messages
- Message system → Encrypted file storage: stores or retrieves files
- Message system → PostgreSQL database: queries messages
- Recipient key store → PostgreSQL database: reads and writes keys
- Recipient key store → Message encryption: wraps data keys
- Encrypted file storage → Encrypted file blobs: reads and writes encrypted blobs
