# mb-cyberx/orginx architecture

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

- Interactive diagram: https://gitdiagram.com/mb-cyberx/orginx
- Repository: https://github.com/mb-cyberx/orginx

## Overview

OrginX is a quantum-inspired digital-signature threat detection application. Users submit a payload and scenario in the live-session UI; the backend runs quantum observations and statistical detection, returns a verdict and evidence, and persists session records for later review. Separate UI and API capabilities expose calibration, historical analysis, ledger verification, and settings. Edges are limited to calls, storage actions, and HTTP routes supported by excerpts, the source index, or the README; several unsampled subsystem details are represented at their exact directories.

Main entry points: [`frontend/src/api/client.ts`](https://github.com/mb-cyberx/orginx/blob/main/frontend/src/api/client.ts) (API client), [`backend/app/core/db.py`](https://github.com/mb-cyberx/orginx/blob/main/backend/app/core/db.py) (Database access), [`frontend/src/App.tsx`](https://github.com/mb-cyberx/orginx/blob/main/frontend/src/App.tsx) (Route composition), [`backend/app/main.py`](https://github.com/mb-cyberx/orginx/blob/main/backend/app/main.py) (FastAPI app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["User interface"]
  node_live["Live session"]
  node_evidence["Evidence review<br/>[EvidencePage.tsx]"]
  node_analysisui["Analysis view<br/>[AnalysisPage.tsx]"]
  node_ledgerui["Ledger view<br/>[LedgerPage.tsx]"]
  node_settingsui["Settings view<br/>[SettingsPage.tsx]"]
  node_client["API client<br/>[client.ts]"]
  node_app["Route composition<br/>[App.tsx]"]
end

subgraph group_api["HTTP API"]
  node_sessionapi["Session routes<br/>[routes_sessions.py]"]
  node_analysisapi["Analysis routes<br/>[routes_analysis.py]"]
  node_calibrationapi["Calibration routes"]
  node_ledgerapi["Ledger routes<br/>[routes_ledger.py]"]
  node_settingsapi["Settings routes<br/>[routes_settings.py]"]
  node_server["FastAPI app<br/>[main.py]"]
end

subgraph group_detection["Session detection"]
  node_pipeline["Detection pipeline<br/>[pipeline.py]"]
  node_decision["Verdict decision<br/>[decision.py]"]
end

subgraph group_quantum["Quantum and statistics"]
  node_engines["Quantum engines"]
  node_observations["Session observations<br/>[engine_base.py]"]
  node_stats["Detection statistics"]
  node_calculation["Monte Carlo analysis<br/>[monte_carlo.py]"]
end

subgraph group_state["Configuration and persistence"]
  node_config["Runtime configuration<br/>[config.py]"]
  node_dbaccess["Database access<br/>[db.py]"]
  node_database[("SQLite store")]
end

node_user(("Analyst"))

node_user -->|"submits payload"| node_live
node_live -->|"runs session"| node_client
node_evidence -->|"loads evidence"| node_client
node_analysisui -->|"requests analysis"| node_client
node_ledgerui -->|"requests ledger"| node_client
node_settingsui -->|"updates settings"| node_client
node_app -->|"routes to"| node_live
node_app -->|"routes to"| node_evidence
node_app -->|"routes to"| node_analysisui
node_app -->|"routes to"| node_ledgerui
node_app -->|"routes to"| node_settingsui
node_client -->|"HTTP requests"| node_sessionapi
node_client -->|"HTTP requests"| node_analysisapi
node_client -->|"HTTP requests"| node_ledgerapi
node_client -->|"HTTP requests"| node_calibrationapi
node_client -->|"HTTP requests"| node_settingsapi
node_server -->|"registers routes"| node_sessionapi
node_server -->|"registers routes"| node_analysisapi
node_server -->|"registers routes"| node_calibrationapi
node_server -->|"registers routes"| node_ledgerapi
node_server -->|"registers routes"| node_settingsapi
node_sessionapi -->|"runs pipeline"| node_pipeline
node_sessionapi -->|"reads sessions"| node_dbaccess
node_pipeline -->|"runs simulation"| node_engines
node_engines -->|"returns observations"| node_observations
node_pipeline -->|"computes tests"| node_stats
node_pipeline -->|"evaluates evidence"| node_decision
node_pipeline -->|"writes records"| node_dbaccess
node_engines -->|"reads parameters"| node_config
node_analysisapi -->|"runs analysis"| node_calculation
node_calculation -->|"simulates trials"| node_engines
node_calculation -->|"computes metrics"| node_stats
node_analysisapi -->|"stores job data"| node_dbaccess
node_calibrationapi -->|"runs calibration"| node_stats
node_calibrationapi -->|"stores calibration"| node_dbaccess
node_ledgerapi -->|"reads ledger"| node_dbaccess
node_settingsapi -->|"updates thresholds"| node_config
node_settingsapi -->|"persists settings"| node_dbaccess
node_dbaccess -->|"reads and writes"| node_database

click node_live "https://github.com/mb-cyberx/orginx/blob/main/frontend/src/pages/LiveSessionPage.tsx"
click node_evidence "https://github.com/mb-cyberx/orginx/blob/main/frontend/src/pages/EvidencePage.tsx"
click node_analysisui "https://github.com/mb-cyberx/orginx/blob/main/frontend/src/pages/AnalysisPage.tsx"
click node_ledgerui "https://github.com/mb-cyberx/orginx/blob/main/frontend/src/pages/LedgerPage.tsx"
click node_settingsui "https://github.com/mb-cyberx/orginx/blob/main/frontend/src/pages/SettingsPage.tsx"
click node_client "https://github.com/mb-cyberx/orginx/blob/main/frontend/src/api/client.ts"
click node_app "https://github.com/mb-cyberx/orginx/blob/main/frontend/src/App.tsx"
click node_sessionapi "https://github.com/mb-cyberx/orginx/blob/main/backend/app/api/routes_sessions.py"
click node_analysisapi "https://github.com/mb-cyberx/orginx/blob/main/backend/app/api/routes_analysis.py"
click node_calibrationapi "https://github.com/mb-cyberx/orginx/blob/main/backend/app/api/routes_calibration.py"
click node_ledgerapi "https://github.com/mb-cyberx/orginx/blob/main/backend/app/api/routes_ledger.py"
click node_settingsapi "https://github.com/mb-cyberx/orginx/blob/main/backend/app/api/routes_settings.py"
click node_server "https://github.com/mb-cyberx/orginx/blob/main/backend/app/main.py"
click node_pipeline "https://github.com/mb-cyberx/orginx/blob/main/backend/app/detection/pipeline.py"
click node_decision "https://github.com/mb-cyberx/orginx/blob/main/backend/app/detection/decision.py"
click node_engines "https://github.com/mb-cyberx/orginx/tree/main/backend/app/quantum"
click node_observations "https://github.com/mb-cyberx/orginx/blob/main/backend/app/quantum/engine_base.py"
click node_stats "https://github.com/mb-cyberx/orginx/tree/main/backend/app/stats"
click node_calculation "https://github.com/mb-cyberx/orginx/blob/main/backend/app/analysis/monte_carlo.py"
click node_config "https://github.com/mb-cyberx/orginx/blob/main/backend/app/core/config.py"
click node_dbaccess "https://github.com/mb-cyberx/orginx/blob/main/backend/app/core/db.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_live,node_evidence,node_analysisui,node_ledgerui,node_settingsui,node_client,node_app toneBlue
class node_sessionapi,node_analysisapi,node_calibrationapi,node_ledgerapi,node_settingsapi,node_server toneAmber
class node_pipeline,node_decision toneMint
class node_engines,node_observations,node_stats,node_calculation toneRose
class node_config,node_dbaccess,node_database,node_user toneIndigo
```

## Components

### User interface

- [Live session](https://github.com/mb-cyberx/orginx/blob/main/frontend/src/pages/LiveSessionPage.tsx): `frontend/src/pages/LiveSessionPage.tsx`
- [Evidence review](https://github.com/mb-cyberx/orginx/blob/main/frontend/src/pages/EvidencePage.tsx): `frontend/src/pages/EvidencePage.tsx`
- [Analysis view](https://github.com/mb-cyberx/orginx/blob/main/frontend/src/pages/AnalysisPage.tsx): `frontend/src/pages/AnalysisPage.tsx`
- [Ledger view](https://github.com/mb-cyberx/orginx/blob/main/frontend/src/pages/LedgerPage.tsx): `frontend/src/pages/LedgerPage.tsx`
- [Settings view](https://github.com/mb-cyberx/orginx/blob/main/frontend/src/pages/SettingsPage.tsx): `frontend/src/pages/SettingsPage.tsx`
- [API client](https://github.com/mb-cyberx/orginx/blob/main/frontend/src/api/client.ts): `frontend/src/api/client.ts`
- [Route composition](https://github.com/mb-cyberx/orginx/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`

### HTTP API

- [Session routes](https://github.com/mb-cyberx/orginx/blob/main/backend/app/api/routes_sessions.py): `backend/app/api/routes_sessions.py`
- [Analysis routes](https://github.com/mb-cyberx/orginx/blob/main/backend/app/api/routes_analysis.py): `backend/app/api/routes_analysis.py`
- [Calibration routes](https://github.com/mb-cyberx/orginx/blob/main/backend/app/api/routes_calibration.py): `backend/app/api/routes_calibration.py`
- [Ledger routes](https://github.com/mb-cyberx/orginx/blob/main/backend/app/api/routes_ledger.py): `backend/app/api/routes_ledger.py`
- [Settings routes](https://github.com/mb-cyberx/orginx/blob/main/backend/app/api/routes_settings.py): `backend/app/api/routes_settings.py`
- [FastAPI app](https://github.com/mb-cyberx/orginx/blob/main/backend/app/main.py): `backend/app/main.py`

### Session detection

- [Detection pipeline](https://github.com/mb-cyberx/orginx/blob/main/backend/app/detection/pipeline.py): `backend/app/detection/pipeline.py`
- [Verdict decision](https://github.com/mb-cyberx/orginx/blob/main/backend/app/detection/decision.py): `backend/app/detection/decision.py`

### Quantum and statistics

- [Quantum engines](https://github.com/mb-cyberx/orginx/tree/main/backend/app/quantum): `backend/app/quantum`
- [Session observations](https://github.com/mb-cyberx/orginx/blob/main/backend/app/quantum/engine_base.py): `backend/app/quantum/engine_base.py`
- [Detection statistics](https://github.com/mb-cyberx/orginx/tree/main/backend/app/stats): `backend/app/stats`
- [Monte Carlo analysis](https://github.com/mb-cyberx/orginx/blob/main/backend/app/analysis/monte_carlo.py): `backend/app/analysis/monte_carlo.py`

### Configuration and persistence

- [Runtime configuration](https://github.com/mb-cyberx/orginx/blob/main/backend/app/core/config.py): `backend/app/core/config.py`
- [Database access](https://github.com/mb-cyberx/orginx/blob/main/backend/app/core/db.py): `backend/app/core/db.py`
- **SQLite store**

### Other components

- **Analyst**

## Connections

- Analyst → Live session: submits payload
- Live session → API client: runs session (evidence: `frontend/src/pages/LiveSessionPage.tsx`)
- Evidence review → API client: loads evidence (evidence: `frontend/src/pages/EvidencePage.tsx`)
- Analysis view → API client: requests analysis (evidence: `frontend/src/api/client.ts`)
- Ledger view → API client: requests ledger (evidence: `frontend/src/api/client.ts`)
- Settings view → API client: updates settings (evidence: `frontend/src/api/client.ts`)
- Route composition → Live session: routes to (evidence: `frontend/src/App.tsx`)
- Route composition → Evidence review: routes to (evidence: `frontend/src/App.tsx`)
- Route composition → Analysis view: routes to (evidence: `frontend/src/App.tsx`)
- Route composition → Ledger view: routes to (evidence: `frontend/src/App.tsx`)
- Route composition → Settings view: routes to (evidence: `frontend/src/App.tsx`)
- API client → Session routes: HTTP requests (evidence: `frontend/src/api/client.ts`)
- API client → Analysis routes: HTTP requests (evidence: `frontend/src/api/client.ts`)
- API client → Ledger routes: HTTP requests (evidence: `frontend/src/api/client.ts`)
- API client → Calibration routes: HTTP requests (evidence: `frontend/src/api/client.ts`)
- API client → Settings routes: HTTP requests (evidence: `frontend/src/api/client.ts`)
- FastAPI app → Session routes: registers routes (evidence: `backend/app/main.py`)
- FastAPI app → Analysis routes: registers routes (evidence: `backend/app/main.py`)
- FastAPI app → Calibration routes: registers routes (evidence: `backend/app/main.py`)
- FastAPI app → Ledger routes: registers routes (evidence: `backend/app/main.py`)
- FastAPI app → Settings routes: registers routes (evidence: `backend/app/main.py`)
- Session routes → Detection pipeline: runs pipeline (evidence: `backend/app/api/routes_sessions.py`)
- Session routes → Database access: reads sessions (evidence: `backend/app/api/routes_sessions.py`)
- Detection pipeline → Quantum engines: runs simulation (evidence: `backend/app/detection/pipeline.py`)
- Quantum engines → Session observations: returns observations (evidence: `backend/app/quantum/engine_base.py`)
- Detection pipeline → Detection statistics: computes tests (evidence: `backend/app/detection/pipeline.py`)
- Detection pipeline → Verdict decision: evaluates evidence (evidence: `backend/app/detection/pipeline.py`)
- Detection pipeline → Database access: writes records (evidence: `backend/app/detection/pipeline.py`)
- Quantum engines → Runtime configuration: reads parameters (evidence: `backend/app/quantum/pauli_frame_engine.py`)
- Analysis routes → Monte Carlo analysis: runs analysis (evidence: `backend/app/api/routes_analysis.py`)
- Monte Carlo analysis → Quantum engines: simulates trials (evidence: `backend/app/analysis/monte_carlo.py`)
- Monte Carlo analysis → Detection statistics: computes metrics (evidence: `backend/app/analysis/monte_carlo.py`)
- Analysis routes → Database access: stores job data (evidence: `backend/app/api/routes_analysis.py`)
- Calibration routes → Detection statistics: runs calibration (evidence: `backend/app/api/routes_calibration.py`)
- Calibration routes → Database access: stores calibration (evidence: `backend/app/api/routes_calibration.py`)
- Ledger routes → Database access: reads ledger (evidence: `backend/app/api/routes_ledger.py`)
- Settings routes → Runtime configuration: updates thresholds (evidence: `backend/app/api/routes_settings.py`)
- Settings routes → Database access: persists settings (evidence: `backend/app/api/routes_settings.py`)
- Database access → SQLite store: reads and writes (evidence: `backend/app/core/db.py`)
