# pouyarer/stormqa architecture

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

- Interactive diagram: https://gitdiagram.com/pouyarer/stormqa
- Repository: https://github.com/pouyarer/stormqa

## Overview

#### Purpose and Entry Points
StormQA is a Python load/chaos-testing package with a React dashboard. Its CLI supports GUI launch, HTTP load tests, WebSocket stress tests, network simulation, database endpoint testing, and report generation. The primary Python entry point is `src/stormqa/main.py`; the GUI server is `src/stormqa/ui/app.py`.

#### CLI Orchestration
`src/stormqa/main.py` is the control boundary for interactive and headless modes. It routes commands to test engines and reporting, making CLI execution suitable for CI/CD while `open` launches the local UI service.

#### HTTP Load and Scenario Engine
`src/stormqa/core/loader.py` is the core HTTP load-test stage. It is responsible for concurrent request execution and is the likely integration point for scenario inputs such as user count, data-driven substitutions, chaos settings, extraction/assertion logic, and live metrics.

#### Chaos and Network Simulation
`src/stormqa/core/network_sim.py` models adverse network behavior, including latency and intentional connection failure profiles. It forms a distinct fault-injection boundary that can be applied to HTTP execution rather than requiring changes to target systems.

#### WebSocket Stress Testing
`src/stormqa/core/ws_engine.py` provides the protocol-specific runtime for concurrent WebSocket connections, message exchange, and RTT-oriented measurements. It is invoked independently from HTTP loading through the CLI and represented separately in the UI.

#### Database Testing
`src/stormqa/core/db_sim.py` supports database-oriented discovery/flooding workflows exposed by the `db` command. This is a separate test mode from direct HTTP and WebSocket traffic, with its own target-discovery and execution concerns.

#### Persistence, Reporting, and Analysis
`src/stormqa/core/history_manager.py` persists run history, described as local SQLite-backed historical metrics. `src/stormqa/reporters/main_reporter.py` consumes the most recent or stored results to create the report/AI-analysis output. This separates execution-time metric collection from post-run interpretation and document generation.

#### Local React Dashboard
`src/stormqa/ui/app.py` bridges the Python package to the frontend. The React/Vite client begins at `src/stormqa/ui/src/main.jsx` and `src/stormqa/ui/src/app.jsx`; operational views are split by mode in `src/stormqa/ui/src/components/Dashboard.jsx`, `LoadTest.jsx`, `WebSocketTest.jsx`, `NetworkTest.jsx`, and `DbTest.jsx`. The UI is a local control and visualization layer over Python-managed test execution and persisted history, not a separate hosted application.

Main entry points: [`src/stormqa/ui/app.py`](https://github.com/pouyarer/stormqa/blob/main/src/stormqa/ui/app.py) (UI service), [`src/stormqa/ui/src/app.jsx`](https://github.com/pouyarer/stormqa/blob/main/src/stormqa/ui/src/app.jsx) (Dashboard application), [`src/stormqa/main.py`](https://github.com/pouyarer/stormqa/blob/main/src/stormqa/main.py) (StormQA CLI), [`src/stormqa/core/history_manager.py`](https://github.com/pouyarer/stormqa/blob/main/src/stormqa/core/history_manager.py) (Run history)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI &amp; orchestration"]
  node_main{{"StormQA CLI<br/>Python entry point<br/>[main.py]"}}
end

subgraph group_engines["Test runtimes"]
  node_loader["HTTP load engine<br/>concurrent HTTP runtime<br/>[loader.py]"]
  node_network["Network simulator<br/>fault injection<br/>[network_sim.py]"]
  node_ws["WebSocket engine<br/>WebSocket runtime<br/>[ws_engine.py]"]
  node_db["Database simulator<br/>database test runtime<br/>[db_sim.py]"]
end

subgraph group_reporting["History &amp; reporting"]
  node_history[("Run history<br/>SQLite metrics store<br/>[history_manager.py]")]
  node_reporter["Report &amp; analysis<br/>report generator<br/>[main_reporter.py]"]
end

subgraph group_ui["Local dashboard"]
  node_ui_server["UI service<br/>Python GUI server<br/>[app.py]"]
  node_react_main["React bootstrap<br/>Vite client entry<br/>[main.jsx]"]
  node_react_app["Dashboard application<br/>React app shell<br/>[app.jsx]"]
  node_dashboard["History dashboard<br/>React view<br/>[Dashboard.jsx]"]
  node_load_view["Load-test view<br/>React view<br/>[LoadTest.jsx]"]
  node_ws_view["WebSocket view<br/>React view<br/>[WebSocketTest.jsx]"]
  node_network_view["Network-test view<br/>React view<br/>[NetworkTest.jsx]"]
  node_db_view["Database-test view<br/>React view<br/>[DbTest.jsx]"]
end

node_main -->|"load command"| node_loader
node_main -->|"WebSocket command"| node_ws
node_main -->|"db command"| node_db
node_main -->|"report command"| node_reporter
node_main -->|"open command"| node_ui_server
node_loader -->|"injects network faults"| node_network
node_loader -->|"stores run metrics"| node_history
node_ws -->|"stores measurements"| node_history
node_db -->|"stores run metrics"| node_history
node_history -->|"stored results"| node_reporter
node_react_main -->|"mounts"| node_react_app
node_react_app -->|"renders"| node_dashboard
node_react_app -->|"renders"| node_load_view
node_react_app -->|"renders"| node_ws_view
node_react_app -->|"renders"| node_network_view
node_react_app -->|"renders"| node_db_view
node_ui_server -->|"serves local client"| node_react_main
node_dashboard -->|"reads history"| node_ui_server
node_load_view -->|"controls HTTP runs"| node_ui_server
node_ws_view -->|"controls WebSocket runs"| node_ui_server
node_network_view -->|"configures fault tests"| node_ui_server
node_db_view -->|"controls database runs"| node_ui_server

click node_main "https://github.com/pouyarer/stormqa/blob/main/src/stormqa/main.py"
click node_loader "https://github.com/pouyarer/stormqa/blob/main/src/stormqa/core/loader.py"
click node_network "https://github.com/pouyarer/stormqa/blob/main/src/stormqa/core/network_sim.py"
click node_ws "https://github.com/pouyarer/stormqa/blob/main/src/stormqa/core/ws_engine.py"
click node_db "https://github.com/pouyarer/stormqa/blob/main/src/stormqa/core/db_sim.py"
click node_history "https://github.com/pouyarer/stormqa/blob/main/src/stormqa/core/history_manager.py"
click node_reporter "https://github.com/pouyarer/stormqa/blob/main/src/stormqa/reporters/main_reporter.py"
click node_ui_server "https://github.com/pouyarer/stormqa/blob/main/src/stormqa/ui/app.py"
click node_react_main "https://github.com/pouyarer/stormqa/blob/main/src/stormqa/ui/src/main.jsx"
click node_react_app "https://github.com/pouyarer/stormqa/blob/main/src/stormqa/ui/src/app.jsx"
click node_dashboard "https://github.com/pouyarer/stormqa/blob/main/src/stormqa/ui/src/components/Dashboard.jsx"
click node_load_view "https://github.com/pouyarer/stormqa/blob/main/src/stormqa/ui/src/components/LoadTest.jsx"
click node_ws_view "https://github.com/pouyarer/stormqa/blob/main/src/stormqa/ui/src/components/WebSocketTest.jsx"
click node_network_view "https://github.com/pouyarer/stormqa/blob/main/src/stormqa/ui/src/components/NetworkTest.jsx"
click node_db_view "https://github.com/pouyarer/stormqa/blob/main/src/stormqa/ui/src/components/DbTest.jsx"

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_main toneBlue
class node_loader,node_network,node_ws,node_db toneAmber
class node_history,node_reporter toneMint
class node_ui_server,node_react_main,node_react_app,node_dashboard,node_load_view,node_ws_view,node_network_view,node_db_view toneRose
```

## Components

### CLI & orchestration

- [StormQA CLI](https://github.com/pouyarer/stormqa/blob/main/src/stormqa/main.py): Python entry point · Routes interactive and headless commands. · `src/stormqa/main.py`

### Test runtimes

- [HTTP load engine](https://github.com/pouyarer/stormqa/blob/main/src/stormqa/core/loader.py): concurrent HTTP runtime · Executes requests and integrates scenario and metric behavior. · `src/stormqa/core/loader.py`
- [Network simulator](https://github.com/pouyarer/stormqa/blob/main/src/stormqa/core/network_sim.py): fault injection · Applies latency and connection-failure profiles. · `src/stormqa/core/network_sim.py`
- [WebSocket engine](https://github.com/pouyarer/stormqa/blob/main/src/stormqa/core/ws_engine.py): WebSocket runtime · Runs concurrent connections, messaging, and RTT measurements. · `src/stormqa/core/ws_engine.py`
- [Database simulator](https://github.com/pouyarer/stormqa/blob/main/src/stormqa/core/db_sim.py): database test runtime · Handles database discovery and flooding workflows. · `src/stormqa/core/db_sim.py`

### History & reporting

- [Run history](https://github.com/pouyarer/stormqa/blob/main/src/stormqa/core/history_manager.py): SQLite metrics store · Persists historical run metrics locally. · `src/stormqa/core/history_manager.py`
- [Report & analysis](https://github.com/pouyarer/stormqa/blob/main/src/stormqa/reporters/main_reporter.py): report generator · Creates reports and AI-analysis output from results. · `src/stormqa/reporters/main_reporter.py`

### Local dashboard

- [UI service](https://github.com/pouyarer/stormqa/blob/main/src/stormqa/ui/app.py): Python GUI server · Bridges the local dashboard to package-managed execution and history. · `src/stormqa/ui/app.py`
- [React bootstrap](https://github.com/pouyarer/stormqa/blob/main/src/stormqa/ui/src/main.jsx): Vite client entry · `src/stormqa/ui/src/main.jsx`
- [Dashboard application](https://github.com/pouyarer/stormqa/blob/main/src/stormqa/ui/src/app.jsx): React app shell · `src/stormqa/ui/src/app.jsx`
- [History dashboard](https://github.com/pouyarer/stormqa/blob/main/src/stormqa/ui/src/components/Dashboard.jsx): React view · `src/stormqa/ui/src/components/Dashboard.jsx`
- [Load-test view](https://github.com/pouyarer/stormqa/blob/main/src/stormqa/ui/src/components/LoadTest.jsx): React view · `src/stormqa/ui/src/components/LoadTest.jsx`
- [WebSocket view](https://github.com/pouyarer/stormqa/blob/main/src/stormqa/ui/src/components/WebSocketTest.jsx): React view · `src/stormqa/ui/src/components/WebSocketTest.jsx`
- [Network-test view](https://github.com/pouyarer/stormqa/blob/main/src/stormqa/ui/src/components/NetworkTest.jsx): React view · `src/stormqa/ui/src/components/NetworkTest.jsx`
- [Database-test view](https://github.com/pouyarer/stormqa/blob/main/src/stormqa/ui/src/components/DbTest.jsx): React view · `src/stormqa/ui/src/components/DbTest.jsx`

## Connections

- StormQA CLI → HTTP load engine: load command
- StormQA CLI → WebSocket engine: WebSocket command
- StormQA CLI → Database simulator: db command
- StormQA CLI → Report & analysis: report command
- StormQA CLI → UI service: open command
- HTTP load engine → Network simulator: injects network faults
- HTTP load engine → Run history: stores run metrics
- WebSocket engine → Run history: stores measurements
- Database simulator → Run history: stores run metrics
- Run history → Report & analysis: stored results
- React bootstrap → Dashboard application: mounts
- Dashboard application → History dashboard: renders
- Dashboard application → Load-test view: renders
- Dashboard application → WebSocket view: renders
- Dashboard application → Network-test view: renders
- Dashboard application → Database-test view: renders
- UI service → React bootstrap: serves local client
- History dashboard → UI service: reads history
- Load-test view → UI service: controls HTTP runs
- WebSocket view → UI service: controls WebSocket runs
- Network-test view → UI service: configures fault tests
- Database-test view → UI service: controls database runs
