# thotasravyavardhani/aqvh-bb84-qkd-semifinal architecture

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

- Interactive diagram: https://gitdiagram.com/thotasravyavardhani/aqvh-bb84-qkd-semifinal
- Repository: https://github.com/thotasravyavardhani/aqvh-bb84-qkd-semifinal

## Overview

This is a Flask-based BB84 quantum key distribution simulator and device testbed. Users configure and run simulations, inspect protocol and security metrics, and can evaluate devices through lab simulations or mobile measurements. The main request flow is the browser interface to Flask routes, which dispatch simulation and testbed work and return results for visualization. The README documents broader UI and security capabilities; sampled excerpts do not expose every route or frontend request, so some documented links use the README as evidence.

Main entry points: [`routes.py`](https://github.com/thotasravyavardhani/aqvh-bb84-qkd-semifinal/blob/main/routes.py) (API and page routes), [`app.py`](https://github.com/thotasravyavardhani/aqvh-bb84-qkd-semifinal/blob/main/app.py) (Flask application), [`templates`](https://github.com/thotasravyavardhani/aqvh-bb84-qkd-semifinal/tree/main/templates) (Research pages), [`static/app.js`](https://github.com/thotasravyavardhani/aqvh-bb84-qkd-semifinal/blob/main/static/app.js) (Simulation UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Research interface"]
  node_pages["Research pages"]
  node_simulation_ui["Simulation UI<br/>[app.js]"]
  node_lab_ui["Lab UI<br/>[lab.js]"]
  node_visualization["Results visualization<br/>[visualization.js]"]
end

subgraph group_server["Web application"]
  node_flask_app["Flask application<br/>[app.py]"]
  node_api_routes["API and page routes<br/>[routes.py]"]
end

subgraph group_protocol["QKD simulation"]
  node_bb84["BB84 simulation engine<br/>[bb84_simulator.py]"]
  node_lab_sim["Quantum lab simulation<br/>[lab_simulator.py]"]
end

subgraph group_testbed["Device testbed"]
  node_device_testbed["Device testbed analysis<br/>[quantum_device.py]"]
end

subgraph group_persistence["Data persistence"]
  node_sql_models["Experiment and session models<br/>[models.py]"]
  node_sql_db[("SQL database integration<br/>[database.py]")]
  node_firebase["Firestore integration<br/>[firebase_config.py]"]
end

node_researcher(("Researcher"))
node_ibm_quantum["IBM Quantum"]
node_firestore[("Firebase Firestore")]

node_researcher -->|"opens"| node_pages
node_pages -->|"loads interface"| node_simulation_ui
node_pages -->|"loads interface"| node_lab_ui
node_simulation_ui -->|"sends requests"| node_api_routes
node_lab_ui -->|"sends requests"| node_api_routes
node_api_routes -->|"returns results for"| node_visualization
node_flask_app -->|"registers routes"| node_api_routes
node_api_routes -->|"dispatches simulation"| node_bb84
node_api_routes -->|"dispatches lab runs"| node_lab_sim
node_api_routes -->|"analyzes measurements"| node_device_testbed
node_device_testbed -.->|"tests connectivity"| node_ibm_quantum
node_api_routes -->|"uses persistence"| node_firebase
node_firebase -->|"reads and writes"| node_firestore
node_flask_app -->|"initializes"| node_sql_db
node_flask_app -->|"creates tables"| node_sql_models
node_sql_models -->|"defines models on"| node_sql_db

click node_pages "https://github.com/thotasravyavardhani/aqvh-bb84-qkd-semifinal/tree/main/templates"
click node_simulation_ui "https://github.com/thotasravyavardhani/aqvh-bb84-qkd-semifinal/blob/main/static/app.js"
click node_lab_ui "https://github.com/thotasravyavardhani/aqvh-bb84-qkd-semifinal/blob/main/static/lab.js"
click node_visualization "https://github.com/thotasravyavardhani/aqvh-bb84-qkd-semifinal/blob/main/static/visualization.js"
click node_flask_app "https://github.com/thotasravyavardhani/aqvh-bb84-qkd-semifinal/blob/main/app.py"
click node_api_routes "https://github.com/thotasravyavardhani/aqvh-bb84-qkd-semifinal/blob/main/routes.py"
click node_bb84 "https://github.com/thotasravyavardhani/aqvh-bb84-qkd-semifinal/blob/main/bb84_simulator.py"
click node_lab_sim "https://github.com/thotasravyavardhani/aqvh-bb84-qkd-semifinal/blob/main/lab_simulator.py"
click node_device_testbed "https://github.com/thotasravyavardhani/aqvh-bb84-qkd-semifinal/blob/main/quantum_device.py"
click node_sql_models "https://github.com/thotasravyavardhani/aqvh-bb84-qkd-semifinal/blob/main/models.py"
click node_sql_db "https://github.com/thotasravyavardhani/aqvh-bb84-qkd-semifinal/blob/main/database.py"
click node_firebase "https://github.com/thotasravyavardhani/aqvh-bb84-qkd-semifinal/blob/main/firebase_config.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_pages,node_simulation_ui,node_lab_ui,node_visualization toneBlue
class node_flask_app,node_api_routes,node_firestore toneAmber
class node_bb84,node_lab_sim toneMint
class node_device_testbed toneRose
class node_sql_models,node_sql_db,node_firebase,node_researcher,node_ibm_quantum toneIndigo
```

## Components

### Research interface

- [Research pages](https://github.com/thotasravyavardhani/aqvh-bb84-qkd-semifinal/tree/main/templates): `templates`
- [Simulation UI](https://github.com/thotasravyavardhani/aqvh-bb84-qkd-semifinal/blob/main/static/app.js): `static/app.js`
- [Lab UI](https://github.com/thotasravyavardhani/aqvh-bb84-qkd-semifinal/blob/main/static/lab.js): `static/lab.js`
- [Results visualization](https://github.com/thotasravyavardhani/aqvh-bb84-qkd-semifinal/blob/main/static/visualization.js): `static/visualization.js`

### Web application

- [Flask application](https://github.com/thotasravyavardhani/aqvh-bb84-qkd-semifinal/blob/main/app.py): `app.py`
- [API and page routes](https://github.com/thotasravyavardhani/aqvh-bb84-qkd-semifinal/blob/main/routes.py): `routes.py`

### QKD simulation

- [BB84 simulation engine](https://github.com/thotasravyavardhani/aqvh-bb84-qkd-semifinal/blob/main/bb84_simulator.py): `bb84_simulator.py`
- [Quantum lab simulation](https://github.com/thotasravyavardhani/aqvh-bb84-qkd-semifinal/blob/main/lab_simulator.py): `lab_simulator.py`

### Device testbed

- [Device testbed analysis](https://github.com/thotasravyavardhani/aqvh-bb84-qkd-semifinal/blob/main/quantum_device.py): `quantum_device.py`

### Data persistence

- [Experiment and session models](https://github.com/thotasravyavardhani/aqvh-bb84-qkd-semifinal/blob/main/models.py): `models.py`
- [SQL database integration](https://github.com/thotasravyavardhani/aqvh-bb84-qkd-semifinal/blob/main/database.py): `database.py`
- [Firestore integration](https://github.com/thotasravyavardhani/aqvh-bb84-qkd-semifinal/blob/main/firebase_config.py): `firebase_config.py`

### Other components

- **Researcher**
- **IBM Quantum**
- **Firebase Firestore**

## Connections

- Researcher → Research pages: opens (evidence: `README.md`)
- Research pages → Simulation UI: loads interface (evidence: `README.md`)
- Research pages → Lab UI: loads interface (evidence: `README.md`)
- Simulation UI → API and page routes: sends requests (evidence: `README.md`)
- Lab UI → API and page routes: sends requests (evidence: `README.md`)
- API and page routes → Results visualization: returns results for (evidence: `README.md`)
- Flask application → API and page routes: registers routes (evidence: `app.py`)
- API and page routes → BB84 simulation engine: dispatches simulation (evidence: `routes.py`)
- API and page routes → Quantum lab simulation: dispatches lab runs (evidence: `routes.py`)
- API and page routes → Device testbed analysis: analyzes measurements (evidence: `routes.py`)
- Device testbed analysis → IBM Quantum: tests connectivity
- API and page routes → Firestore integration: uses persistence (evidence: `routes.py`)
- Firestore integration → Firebase Firestore: reads and writes (evidence: `firebase_config.py`)
- Flask application → SQL database integration: initializes (evidence: `app.py`)
- Flask application → Experiment and session models: creates tables (evidence: `app.py`)
- Experiment and session models → SQL database integration: defines models on (evidence: `models.py`)
