# vbs-0/quantumlink-pqc architecture

> Architecture diagram of the GitHub repository vbs-0/quantumlink-pqc, 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/vbs-0/quantumlink-pqc
- Repository: https://github.com/vbs-0/quantumlink-pqc

## Overview

QuantumLink-PQC is a local Flask peer-to-peer messaging research prototype. A user registers in a browser, adds a peer, requests and accepts a connection, then exchanges messages; each peer process handles plaintext and cryptographic operations locally. The implementation also includes neural seed generation, dataset creation/training, persistent account/peer/connection data, and visible security and ML status. Edges reflect the README and shown source references/calls; unsampled route wiring is not inferred.

Main entry points: [`app.py`](https://github.com/vbs-0/quantumlink-pqc/blob/main/app.py) (Flask peer), [`ml_seed_generator.py`](https://github.com/vbs-0/quantumlink-pqc/blob/main/ml_seed_generator.py) (Seed generation), [`ml_model_trainer.py`](https://github.com/vbs-0/quantumlink-pqc/blob/main/ml_model_trainer.py) (Model training and prediction), [`static/js/app.js`](https://github.com/vbs-0/quantumlink-pqc/blob/main/static/js/app.js) (Browser interactions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser client"]
  node_dashboard["Chat dashboard<br/>[dashboard.html]"]
  node_browser_client["Browser interactions<br/>[app.js]"]
end

subgraph group_peer_runtime["Peer application"]
  node_peer_process["Flask peer<br/>[app.py]"]
  node_peer_network["Peer HTTP client<br/>[network_manager.py]"]
  node_database_ops["Account and connection data<br/>[database.py]"]
  node_database_store[("Chat database<br/>[database.py]")]
end

subgraph group_crypto["Cryptography"]
  node_crypto_engine["PQC message engine<br/>[crypto_engine.py]"]
end

subgraph group_ml["Seed modeling"]
  node_seed_generator["Seed generation"]
  node_model_trainer["Model training and prediction"]
  node_dataset_generator["Synthetic dataset"]
end

node_user(("Chat user"))
node_peer_remote["Remote Flask peer"]
node_tensorflow_model["TensorFlow runtime"]

node_user -->|"uses"| node_dashboard
node_dashboard -->|"loads interactions"| node_browser_client
node_browser_client -->|"HTTP and Socket.IO"| node_peer_process
node_peer_process -->|"reads and updates"| node_database_ops
node_database_ops -->|"persists records"| node_database_store
node_peer_process -->|"processes handshakes"| node_crypto_engine
node_peer_process -->|"uses peer client"| node_peer_network
node_peer_network -->|"sends peer requests"| node_peer_remote
node_peer_remote -->|"handles requests"| node_peer_process
node_crypto_engine -->|"creates peer generators"| node_seed_generator
node_seed_generator -->|"predicts and trains"| node_model_trainer
node_seed_generator -->|"creates training data"| node_dataset_generator
node_model_trainer -->|"loads dataset"| node_dataset_generator
node_model_trainer -.->|"trains and predicts"| node_tensorflow_model
node_peer_process -->|"reports status and events"| node_browser_client

click node_dashboard "https://github.com/vbs-0/quantumlink-pqc/blob/main/templates/dashboard.html"
click node_browser_client "https://github.com/vbs-0/quantumlink-pqc/blob/main/static/js/app.js"
click node_peer_process "https://github.com/vbs-0/quantumlink-pqc/blob/main/app.py"
click node_peer_network "https://github.com/vbs-0/quantumlink-pqc/blob/main/network_manager.py"
click node_database_ops "https://github.com/vbs-0/quantumlink-pqc/blob/main/database.py"
click node_database_store "https://github.com/vbs-0/quantumlink-pqc/blob/main/database.py"
click node_crypto_engine "https://github.com/vbs-0/quantumlink-pqc/blob/main/crypto_engine.py"
click node_seed_generator "https://github.com/vbs-0/quantumlink-pqc/blob/main/ml_seed_generator.py"
click node_model_trainer "https://github.com/vbs-0/quantumlink-pqc/blob/main/ml_model_trainer.py"
click node_dataset_generator "https://github.com/vbs-0/quantumlink-pqc/blob/main/dataset_generator.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_dashboard,node_browser_client,node_user toneBlue
class node_peer_process,node_peer_network,node_database_ops,node_database_store toneAmber
class node_crypto_engine toneMint
class node_seed_generator,node_model_trainer,node_dataset_generator toneRose
class node_peer_remote,node_tensorflow_model toneIndigo
```

## Components

### Browser client

- [Chat dashboard](https://github.com/vbs-0/quantumlink-pqc/blob/main/templates/dashboard.html): `templates/dashboard.html`
- [Browser interactions](https://github.com/vbs-0/quantumlink-pqc/blob/main/static/js/app.js): `static/js/app.js`

### Peer application

- [Flask peer](https://github.com/vbs-0/quantumlink-pqc/blob/main/app.py): `app.py`
- [Peer HTTP client](https://github.com/vbs-0/quantumlink-pqc/blob/main/network_manager.py): `network_manager.py`
- [Account and connection data](https://github.com/vbs-0/quantumlink-pqc/blob/main/database.py): `database.py`
- [Chat database](https://github.com/vbs-0/quantumlink-pqc/blob/main/database.py): `database.py`

### Cryptography

- [PQC message engine](https://github.com/vbs-0/quantumlink-pqc/blob/main/crypto_engine.py): `crypto_engine.py`

### Seed modeling

- [Seed generation](https://github.com/vbs-0/quantumlink-pqc/blob/main/ml_seed_generator.py): `ml_seed_generator.py`
- [Model training and prediction](https://github.com/vbs-0/quantumlink-pqc/blob/main/ml_model_trainer.py): `ml_model_trainer.py`
- [Synthetic dataset](https://github.com/vbs-0/quantumlink-pqc/blob/main/dataset_generator.py): `dataset_generator.py`

### Other components

- **Chat user**
- **Remote Flask peer**
- **TensorFlow runtime**

## Connections

- Chat user → Chat dashboard: uses (evidence: `README.md`)
- Chat dashboard → Browser interactions: loads interactions (evidence: `README.md`)
- Browser interactions → Flask peer: HTTP and Socket.IO (evidence: `README.md`)
- Flask peer → Account and connection data: reads and updates (evidence: `app.py`)
- Account and connection data → Chat database: persists records (evidence: `database.py`)
- Flask peer → PQC message engine: processes handshakes (evidence: `app.py`)
- Flask peer → Peer HTTP client: uses peer client (evidence: `app.py`)
- Peer HTTP client → Remote Flask peer: sends peer requests (evidence: `network_manager.py`)
- Remote Flask peer → Flask peer: handles requests (evidence: `README.md`)
- PQC message engine → Seed generation: creates peer generators (evidence: `crypto_engine.py`)
- Seed generation → Model training and prediction: predicts and trains (evidence: `ml_seed_generator.py`)
- Seed generation → Synthetic dataset: creates training data (evidence: `ml_seed_generator.py`)
- Model training and prediction → Synthetic dataset: loads dataset (evidence: `ml_model_trainer.py`)
- Model training and prediction → TensorFlow runtime: trains and predicts
- Flask peer → Browser interactions: reports status and events (evidence: `README.md`)
