# 0xjc65eth/cypher65-war-room architecture

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

- Interactive diagram: https://gitdiagram.com/0xjc65eth/cypher65-war-room
- Repository: https://github.com/0xjc65eth/cypher65-war-room

## Overview

CYPHER65 War Room is a self-hosted Bitcoin-mining command center. Operators use the web dashboard or mobile companion to view live fleet and pool telemetry, analyze block probability and economic scenarios, manage rentals, and control ASICs. Flask routes expose these capabilities; background polling and service-layer models feed snapshots, while tenant/authentication and safety checks govern access and actions. The README documents the major product branches; unsampled implementation details are represented only at the documented subsystem level.

Main entry points: [`static/app.js`](https://github.com/0xjc65eth/cypher65-war-room/blob/master/static/app.js) (Web dashboard), [`routes/dashboard_routes.py`](https://github.com/0xjc65eth/cypher65-war-room/blob/master/routes/dashboard_routes.py) (Dashboard API), [`services/user_polling.py`](https://github.com/0xjc65eth/cypher65-war-room/blob/master/services/user_polling.py) (Background polling), [`app.py`](https://github.com/0xjc65eth/cypher65-war-room/blob/master/app.py) (Flask application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Operator clients"]
  node_web["Web dashboard<br/>[app.js]"]
  node_mobile["Mobile companion<br/>[App.tsx]"]
end

subgraph group_api["API and access"]
  node_app["Flask application<br/>[app.py]"]
  node_dashboard_api["Dashboard API"]
  node_auth["Authentication<br/>[auth.py]"]
  node_tenant["Tenant isolation<br/>[tenant.py]"]
  node_database[("SQLite persistence<br/>[bootstrap.py]")]
end

subgraph group_telemetry["Telemetry and analytics"]
  node_polling["Background polling<br/>[user_polling.py]"]
  node_snapshots["Snapshot assembly"]
  node_probability["Block probability"]
end

subgraph group_operations["Fleet operations"]
  node_fleet_api["Fleet API<br/>[routes.py]"]
  node_fleet_registry["ASIC registry<br/>[registry.py]"]
  node_safety["Safety engine<br/>[safety_engine.py]"]
  node_automation["Alerts and automation"]
end

subgraph group_domain["Mining services"]
  node_market["Hashrate market<br/>[hashrate_market.py]"]
  node_rentals["Rental analytics"]
  node_ai["AI operator<br/>[ai_operator.py]"]
end

node_operator(("Operator"))
node_pool{{"Mining pool APIs"}}
node_network{{"Bitcoin network data"}}

node_operator -->|"uses"| node_web
node_operator -->|"uses"| node_mobile
node_web -->|"requests data"| node_app
node_mobile -->|"calls API"| node_app
node_app -->|"registers routes"| node_dashboard_api
node_app -->|"runs workers"| node_polling
node_dashboard_api -->|"serves snapshots"| node_snapshots
node_polling -->|"polls telemetry"| node_pool
node_polling -->|"polls network data"| node_network
node_polling -.->|"updates state"| node_snapshots
node_dashboard_api -->|"serves estimates"| node_probability
node_web -->|"shows offers"| node_market
node_web -->|"shows performance"| node_rentals
node_fleet_api -->|"manages devices"| node_fleet_registry
node_fleet_api -->|"validates commands"| node_safety
node_automation -->|"checks actions"| node_safety
node_web -->|"controls fleet"| node_fleet_api
node_dashboard_api -->|"reads history"| node_database
node_auth -->|"supplies identity"| node_tenant
node_ai -->|"streams assistance"| node_web

click node_web "https://github.com/0xjc65eth/cypher65-war-room/blob/master/static/app.js"
click node_mobile "https://github.com/0xjc65eth/cypher65-war-room/blob/master/mobile/App.tsx"
click node_app "https://github.com/0xjc65eth/cypher65-war-room/blob/master/app.py"
click node_dashboard_api "https://github.com/0xjc65eth/cypher65-war-room/blob/master/routes/dashboard_routes.py"
click node_auth "https://github.com/0xjc65eth/cypher65-war-room/blob/master/services/auth.py"
click node_tenant "https://github.com/0xjc65eth/cypher65-war-room/blob/master/services/tenant.py"
click node_database "https://github.com/0xjc65eth/cypher65-war-room/blob/master/services/bootstrap.py"
click node_polling "https://github.com/0xjc65eth/cypher65-war-room/blob/master/services/user_polling.py"
click node_snapshots "https://github.com/0xjc65eth/cypher65-war-room/blob/master/services/snapshot_assembly.py"
click node_probability "https://github.com/0xjc65eth/cypher65-war-room/blob/master/services/probability_engine.py"
click node_market "https://github.com/0xjc65eth/cypher65-war-room/blob/master/services/hashrate_market.py"
click node_rentals "https://github.com/0xjc65eth/cypher65-war-room/blob/master/services/rental_performance.py"
click node_fleet_api "https://github.com/0xjc65eth/cypher65-war-room/blob/master/axe_fleet/routes.py"
click node_fleet_registry "https://github.com/0xjc65eth/cypher65-war-room/blob/master/axe_fleet/registry.py"
click node_safety "https://github.com/0xjc65eth/cypher65-war-room/blob/master/core/safety/safety_engine.py"
click node_automation "https://github.com/0xjc65eth/cypher65-war-room/blob/master/core/alerts/automation_engine.py"
click node_ai "https://github.com/0xjc65eth/cypher65-war-room/blob/master/services/ai_operator.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_web,node_mobile toneBlue
class node_app,node_dashboard_api,node_auth,node_tenant,node_database toneAmber
class node_polling,node_snapshots,node_probability,node_pool toneMint
class node_fleet_api,node_fleet_registry,node_safety,node_automation toneRose
class node_market,node_rentals,node_ai,node_operator,node_network toneIndigo
```

## Components

### Operator clients

- [Web dashboard](https://github.com/0xjc65eth/cypher65-war-room/blob/master/static/app.js): `static/app.js`
- [Mobile companion](https://github.com/0xjc65eth/cypher65-war-room/blob/master/mobile/App.tsx): `mobile/App.tsx`

### API and access

- [Flask application](https://github.com/0xjc65eth/cypher65-war-room/blob/master/app.py): `app.py`
- [Dashboard API](https://github.com/0xjc65eth/cypher65-war-room/blob/master/routes/dashboard_routes.py): `routes/dashboard_routes.py`
- [Authentication](https://github.com/0xjc65eth/cypher65-war-room/blob/master/services/auth.py): `services/auth.py`
- [Tenant isolation](https://github.com/0xjc65eth/cypher65-war-room/blob/master/services/tenant.py): `services/tenant.py`
- [SQLite persistence](https://github.com/0xjc65eth/cypher65-war-room/blob/master/services/bootstrap.py): `services/bootstrap.py`

### Telemetry and analytics

- [Background polling](https://github.com/0xjc65eth/cypher65-war-room/blob/master/services/user_polling.py): `services/user_polling.py`
- [Snapshot assembly](https://github.com/0xjc65eth/cypher65-war-room/blob/master/services/snapshot_assembly.py): `services/snapshot_assembly.py`
- [Block probability](https://github.com/0xjc65eth/cypher65-war-room/blob/master/services/probability_engine.py): `services/probability_engine.py`

### Fleet operations

- [Fleet API](https://github.com/0xjc65eth/cypher65-war-room/blob/master/axe_fleet/routes.py): `axe_fleet/routes.py`
- [ASIC registry](https://github.com/0xjc65eth/cypher65-war-room/blob/master/axe_fleet/registry.py): `axe_fleet/registry.py`
- [Safety engine](https://github.com/0xjc65eth/cypher65-war-room/blob/master/core/safety/safety_engine.py): `core/safety/safety_engine.py`
- [Alerts and automation](https://github.com/0xjc65eth/cypher65-war-room/blob/master/core/alerts/automation_engine.py): `core/alerts/automation_engine.py`

### Mining services

- [Hashrate market](https://github.com/0xjc65eth/cypher65-war-room/blob/master/services/hashrate_market.py): `services/hashrate_market.py`
- [Rental analytics](https://github.com/0xjc65eth/cypher65-war-room/blob/master/services/rental_performance.py): `services/rental_performance.py`
- [AI operator](https://github.com/0xjc65eth/cypher65-war-room/blob/master/services/ai_operator.py): `services/ai_operator.py`

### Other components

- **Operator**
- **Mining pool APIs**
- **Bitcoin network data**

## Connections

- Operator → Web dashboard: uses
- Operator → Mobile companion: uses
- Web dashboard → Flask application: requests data
- Mobile companion → Flask application: calls API
- Flask application → Dashboard API: registers routes (evidence: `app.py`)
- Flask application → Background polling: runs workers (evidence: `app.py`)
- Dashboard API → Snapshot assembly: serves snapshots
- Background polling → Mining pool APIs: polls telemetry
- Background polling → Bitcoin network data: polls network data
- Background polling → Snapshot assembly: updates state
- Dashboard API → Block probability: serves estimates
- Web dashboard → Hashrate market: shows offers
- Web dashboard → Rental analytics: shows performance
- Fleet API → ASIC registry: manages devices (evidence: `axe_fleet/routes.py`)
- Fleet API → Safety engine: validates commands (evidence: `axe_fleet/routes.py`)
- Alerts and automation → Safety engine: checks actions (evidence: `core/alerts/automation_engine.py`)
- Web dashboard → Fleet API: controls fleet
- Dashboard API → SQLite persistence: reads history (evidence: `routes/dashboard_routes.py`)
- Authentication → Tenant isolation: supplies identity (evidence: `services/tenant.py`)
- AI operator → Web dashboard: streams assistance
