# sangeethhk/netclone architecture

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

- Interactive diagram: https://gitdiagram.com/sangeethhk/netclone
- Repository: https://github.com/sangeethhk/netclone

## Overview

NetClone is an IoT cyber-twin security framework: physical devices stream telemetry into a synchronized twin, where simulated and observed traffic is analyzed, investigated, and mitigated. The React command center exposes fleet/topology, traffic, attack, detection, XAI, attack-graph, MLSA, breach-benchmark, defense, and log views. The graph includes the documented capabilities whose implementation was not sampled, but leaves uncertain internal links out; API and UI composition edges are supported by indexed imports or excerpts.

Main entry points: [`frontend/src/App.jsx`](https://github.com/sangeethhk/netclone/blob/main/frontend/src/App.jsx) (React Command Center), [`frontend/src/services/api.js`](https://github.com/sangeethhk/netclone/blob/main/frontend/src/services/api.js) (REST Client), [`backend/app/main.py`](https://github.com/sangeethhk/netclone/blob/main/backend/app/main.py) (FastAPI Application), [`backend/app/core/cyber_twin.py`](https://github.com/sangeethhk/netclone/blob/main/backend/app/core/cyber_twin.py) (Cyber Twin)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingestion["Fleet &amp; Telemetry"]
  node_agent["Telemetry Agent"]
  node_twin_api["Twin API<br/>[twin_routes.py]"]
  node_twin["Cyber Twin<br/>[cyber_twin.py]"]
  node_scanner["LAN Discovery<br/>[network_scanner.py]"]
end

subgraph group_analysis["Traffic &amp; Detection"]
  node_traffic["Traffic &amp; Features"]
  node_attack_api["Attack API<br/>[attack_routes.py]"]
  node_attacks["Attack Simulator"]
  node_detection_api["Detection API"]
  node_autoencoder["Autoencoder<br/>[autoencoder.py]"]
  node_isolation["Isolation Forest Ensemble"]
end

subgraph group_security["Investigation &amp; Defense"]
  node_xai["XAI Forensics<br/>[xai_engine.py]"]
  node_attack_graph["Attack Graph<br/>[attack_graph.py]"]
  node_defense_api["Defense API<br/>[defense_routes.py]"]
  node_defense["Dynamic Defense<br/>[defense_engine.py]"]
  node_breach["Breach Benchmark"]
end

subgraph group_auth["Identity &amp; MLSA"]
  node_mlsa_api["MLSA API<br/>[mlsa_routes.py]"]
  node_mlsa["MLSA Authentication<br/>[mlsa_auth.py]"]
  node_db[("SQLite State<br/>[database.py]")]
end

subgraph group_interface["Command Center"]
  node_backend["FastAPI Application<br/>[main.py]"]
  node_api_client["REST Client<br/>[api.js]"]
  node_dashboard["React Command Center<br/>[App.jsx]"]
  node_fleet_ui["Fleet Manager"]
  node_topology_ui["Twin Topology"]
  node_traffic_ui["Traffic Monitor<br/>[TrafficMonitor.jsx]"]
  node_detection_ui["AI Detection Panel"]
  node_attack_ui["Attack Simulator UI"]
  node_xai_ui["XAI Inspector<br/>[XAIPanel.jsx]"]
  node_graph_ui["Attack Graph Viewer"]
  node_defense_ui["Defense Panel"]
  node_mlsa_ui["MLSA Panel<br/>[MLSAPanel.jsx]"]
  node_breach_ui["Breach Bench UI"]
  node_logs_ui["Security Logs<br/>[SecurityLogs.jsx]"]
end

node_hardware(("IoT Devices"))

node_hardware -->|"streams telemetry"| node_agent
node_agent -->|"posts telemetry"| node_twin_api
node_twin_api -->|"ingests devices"| node_twin
node_twin_api -->|"requests discovery"| node_scanner
node_twin -->|"records packets"| node_traffic
node_attacks -->|"updates twin"| node_twin
node_attack_api -->|"controls simulation"| node_attacks
node_traffic -.->|"provides features"| node_autoencoder
node_detection_api -->|"evaluates vectors"| node_autoencoder
node_detection_api -->|"evaluates vectors"| node_isolation
node_backend -->|"registers routes"| node_detection_api
node_backend -->|"registers routes"| node_twin_api
node_backend -->|"registers routes"| node_attack_api
node_backend -->|"registers routes"| node_mlsa_api
node_backend -->|"registers routes"| node_defense_api
node_attack_graph -->|"reads topology"| node_twin
node_attack_graph -->|"reads mitigations"| node_defense
node_defense_api -->|"controls defense"| node_defense
node_defense_api -->|"checks devices"| node_twin
node_defense -->|"writes alerts"| node_db
node_mlsa_api -->|"handles authentication"| node_mlsa
node_mlsa_api -->|"uses persistence"| node_db
node_mlsa -->|"persists credentials"| node_db
node_backend -->|"initializes store"| node_db
node_dashboard -->|"renders"| node_fleet_ui
node_dashboard -->|"renders"| node_topology_ui
node_dashboard -->|"renders"| node_traffic_ui
node_dashboard -->|"renders"| node_detection_ui
node_dashboard -->|"renders"| node_attack_ui
node_dashboard -->|"renders"| node_xai_ui
node_dashboard -->|"renders"| node_graph_ui
node_dashboard -->|"renders"| node_defense_ui
node_dashboard -->|"renders"| node_mlsa_ui
node_dashboard -->|"renders"| node_breach_ui
node_dashboard -->|"renders"| node_logs_ui
node_fleet_ui -->|"calls"| node_api_client
node_detection_ui -->|"calls"| node_api_client
node_graph_ui -->|"calls"| node_api_client
node_defense_ui -->|"calls"| node_api_client
node_mlsa_ui -->|"calls"| node_api_client
node_breach_ui -->|"calls"| node_api_client
node_logs_ui -->|"calls"| node_api_client
node_api_client -->|"HTTP requests"| node_backend
node_api_client -->|"requests graph"| node_attack_graph
node_api_client -->|"requests attribution"| node_xai
node_api_client -->|"requests benchmark"| node_breach

click node_agent "https://github.com/sangeethhk/netclone/blob/main/agent/netclone_iot_agent.py"
click node_twin_api "https://github.com/sangeethhk/netclone/blob/main/backend/app/api/twin_routes.py"
click node_twin "https://github.com/sangeethhk/netclone/blob/main/backend/app/core/cyber_twin.py"
click node_scanner "https://github.com/sangeethhk/netclone/blob/main/backend/app/core/network_scanner.py"
click node_traffic "https://github.com/sangeethhk/netclone/blob/main/backend/app/core/traffic_generator.py"
click node_attack_api "https://github.com/sangeethhk/netclone/blob/main/backend/app/api/attack_routes.py"
click node_attacks "https://github.com/sangeethhk/netclone/blob/main/backend/app/core/attack_simulator.py"
click node_detection_api "https://github.com/sangeethhk/netclone/blob/main/backend/app/api/detection_routes.py"
click node_autoencoder "https://github.com/sangeethhk/netclone/blob/main/backend/app/models/autoencoder.py"
click node_isolation "https://github.com/sangeethhk/netclone/blob/main/backend/app/models/isolation_forest.py"
click node_xai "https://github.com/sangeethhk/netclone/blob/main/backend/app/models/xai_engine.py"
click node_attack_graph "https://github.com/sangeethhk/netclone/blob/main/backend/app/core/attack_graph.py"
click node_defense_api "https://github.com/sangeethhk/netclone/blob/main/backend/app/api/defense_routes.py"
click node_defense "https://github.com/sangeethhk/netclone/blob/main/backend/app/core/defense_engine.py"
click node_breach "https://github.com/sangeethhk/netclone/blob/main/backend/app/core/breach_simulator.py"
click node_mlsa_api "https://github.com/sangeethhk/netclone/blob/main/backend/app/api/mlsa_routes.py"
click node_mlsa "https://github.com/sangeethhk/netclone/blob/main/backend/app/core/mlsa_auth.py"
click node_db "https://github.com/sangeethhk/netclone/blob/main/backend/app/core/database.py"
click node_backend "https://github.com/sangeethhk/netclone/blob/main/backend/app/main.py"
click node_api_client "https://github.com/sangeethhk/netclone/blob/main/frontend/src/services/api.js"
click node_dashboard "https://github.com/sangeethhk/netclone/blob/main/frontend/src/App.jsx"
click node_fleet_ui "https://github.com/sangeethhk/netclone/blob/main/frontend/src/components/DeviceFleetManager.jsx"
click node_topology_ui "https://github.com/sangeethhk/netclone/blob/main/frontend/src/components/CyberTwinTopology.jsx"
click node_traffic_ui "https://github.com/sangeethhk/netclone/blob/main/frontend/src/components/TrafficMonitor.jsx"
click node_detection_ui "https://github.com/sangeethhk/netclone/blob/main/frontend/src/components/AIDetectionPanel.jsx"
click node_attack_ui "https://github.com/sangeethhk/netclone/blob/main/frontend/src/components/AttackSimulator.jsx"
click node_xai_ui "https://github.com/sangeethhk/netclone/blob/main/frontend/src/components/XAIPanel.jsx"
click node_graph_ui "https://github.com/sangeethhk/netclone/blob/main/frontend/src/components/AttackGraphViewer.jsx"
click node_defense_ui "https://github.com/sangeethhk/netclone/blob/main/frontend/src/components/AutomatedDefense.jsx"
click node_mlsa_ui "https://github.com/sangeethhk/netclone/blob/main/frontend/src/components/MLSAPanel.jsx"
click node_breach_ui "https://github.com/sangeethhk/netclone/blob/main/frontend/src/components/MLSABreachBench.jsx"
click node_logs_ui "https://github.com/sangeethhk/netclone/blob/main/frontend/src/components/SecurityLogs.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_agent,node_twin_api,node_twin,node_scanner toneBlue
class node_traffic,node_attack_api,node_attacks,node_detection_api,node_autoencoder,node_isolation toneAmber
class node_xai,node_attack_graph,node_defense_api,node_defense,node_breach toneMint
class node_mlsa_api,node_mlsa,node_db toneRose
class node_backend,node_api_client,node_dashboard,node_fleet_ui,node_topology_ui,node_traffic_ui,node_detection_ui,node_attack_ui,node_xai_ui,node_graph_ui,node_defense_ui,node_mlsa_ui,node_breach_ui,node_logs_ui,node_hardware toneIndigo
```

## Components

### Fleet & Telemetry

- [Telemetry Agent](https://github.com/sangeethhk/netclone/blob/main/agent/netclone_iot_agent.py): `agent/netclone_iot_agent.py`
- [Twin API](https://github.com/sangeethhk/netclone/blob/main/backend/app/api/twin_routes.py): `backend/app/api/twin_routes.py`
- [Cyber Twin](https://github.com/sangeethhk/netclone/blob/main/backend/app/core/cyber_twin.py): `backend/app/core/cyber_twin.py`
- [LAN Discovery](https://github.com/sangeethhk/netclone/blob/main/backend/app/core/network_scanner.py): `backend/app/core/network_scanner.py`

### Traffic & Detection

- [Traffic & Features](https://github.com/sangeethhk/netclone/blob/main/backend/app/core/traffic_generator.py): `backend/app/core/traffic_generator.py`
- [Attack API](https://github.com/sangeethhk/netclone/blob/main/backend/app/api/attack_routes.py): `backend/app/api/attack_routes.py`
- [Attack Simulator](https://github.com/sangeethhk/netclone/blob/main/backend/app/core/attack_simulator.py): `backend/app/core/attack_simulator.py`
- [Detection API](https://github.com/sangeethhk/netclone/blob/main/backend/app/api/detection_routes.py): `backend/app/api/detection_routes.py`
- [Autoencoder](https://github.com/sangeethhk/netclone/blob/main/backend/app/models/autoencoder.py): `backend/app/models/autoencoder.py`
- [Isolation Forest Ensemble](https://github.com/sangeethhk/netclone/blob/main/backend/app/models/isolation_forest.py): `backend/app/models/isolation_forest.py`

### Investigation & Defense

- [XAI Forensics](https://github.com/sangeethhk/netclone/blob/main/backend/app/models/xai_engine.py): `backend/app/models/xai_engine.py`
- [Attack Graph](https://github.com/sangeethhk/netclone/blob/main/backend/app/core/attack_graph.py): `backend/app/core/attack_graph.py`
- [Defense API](https://github.com/sangeethhk/netclone/blob/main/backend/app/api/defense_routes.py): `backend/app/api/defense_routes.py`
- [Dynamic Defense](https://github.com/sangeethhk/netclone/blob/main/backend/app/core/defense_engine.py): `backend/app/core/defense_engine.py`
- [Breach Benchmark](https://github.com/sangeethhk/netclone/blob/main/backend/app/core/breach_simulator.py): `backend/app/core/breach_simulator.py`

### Identity & MLSA

- [MLSA API](https://github.com/sangeethhk/netclone/blob/main/backend/app/api/mlsa_routes.py): `backend/app/api/mlsa_routes.py`
- [MLSA Authentication](https://github.com/sangeethhk/netclone/blob/main/backend/app/core/mlsa_auth.py): `backend/app/core/mlsa_auth.py`
- [SQLite State](https://github.com/sangeethhk/netclone/blob/main/backend/app/core/database.py): `backend/app/core/database.py`

### Command Center

- [FastAPI Application](https://github.com/sangeethhk/netclone/blob/main/backend/app/main.py): `backend/app/main.py`
- [REST Client](https://github.com/sangeethhk/netclone/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`
- [React Command Center](https://github.com/sangeethhk/netclone/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Fleet Manager](https://github.com/sangeethhk/netclone/blob/main/frontend/src/components/DeviceFleetManager.jsx): `frontend/src/components/DeviceFleetManager.jsx`
- [Twin Topology](https://github.com/sangeethhk/netclone/blob/main/frontend/src/components/CyberTwinTopology.jsx): `frontend/src/components/CyberTwinTopology.jsx`
- [Traffic Monitor](https://github.com/sangeethhk/netclone/blob/main/frontend/src/components/TrafficMonitor.jsx): `frontend/src/components/TrafficMonitor.jsx`
- [AI Detection Panel](https://github.com/sangeethhk/netclone/blob/main/frontend/src/components/AIDetectionPanel.jsx): `frontend/src/components/AIDetectionPanel.jsx`
- [Attack Simulator UI](https://github.com/sangeethhk/netclone/blob/main/frontend/src/components/AttackSimulator.jsx): `frontend/src/components/AttackSimulator.jsx`
- [XAI Inspector](https://github.com/sangeethhk/netclone/blob/main/frontend/src/components/XAIPanel.jsx): `frontend/src/components/XAIPanel.jsx`
- [Attack Graph Viewer](https://github.com/sangeethhk/netclone/blob/main/frontend/src/components/AttackGraphViewer.jsx): `frontend/src/components/AttackGraphViewer.jsx`
- [Defense Panel](https://github.com/sangeethhk/netclone/blob/main/frontend/src/components/AutomatedDefense.jsx): `frontend/src/components/AutomatedDefense.jsx`
- [MLSA Panel](https://github.com/sangeethhk/netclone/blob/main/frontend/src/components/MLSAPanel.jsx): `frontend/src/components/MLSAPanel.jsx`
- [Breach Bench UI](https://github.com/sangeethhk/netclone/blob/main/frontend/src/components/MLSABreachBench.jsx): `frontend/src/components/MLSABreachBench.jsx`
- [Security Logs](https://github.com/sangeethhk/netclone/blob/main/frontend/src/components/SecurityLogs.jsx): `frontend/src/components/SecurityLogs.jsx`

### Other components

- **IoT Devices**

## Connections

- IoT Devices → Telemetry Agent: streams telemetry (evidence: `README.md`)
- Telemetry Agent → Twin API: posts telemetry (evidence: `README.md`)
- Twin API → Cyber Twin: ingests devices (evidence: `backend/app/api/twin_routes.py`)
- Twin API → LAN Discovery: requests discovery (evidence: `backend/app/api/twin_routes.py`)
- Cyber Twin → Traffic & Features: records packets (evidence: `backend/app/core/cyber_twin.py`)
- Attack Simulator → Cyber Twin: updates twin (evidence: `backend/app/core/attack_simulator.py`)
- Attack API → Attack Simulator: controls simulation (evidence: `backend/app/api/attack_routes.py`)
- Traffic & Features → Autoencoder: provides features
- Detection API → Autoencoder: evaluates vectors (evidence: `backend/app/api/detection_routes.py`)
- Detection API → Isolation Forest Ensemble: evaluates vectors (evidence: `backend/app/api/detection_routes.py`)
- FastAPI Application → Detection API: registers routes (evidence: `backend/app/main.py`)
- FastAPI Application → Twin API: registers routes (evidence: `backend/app/main.py`)
- FastAPI Application → Attack API: registers routes (evidence: `backend/app/main.py`)
- FastAPI Application → MLSA API: registers routes (evidence: `backend/app/main.py`)
- FastAPI Application → Defense API: registers routes (evidence: `backend/app/main.py`)
- Attack Graph → Cyber Twin: reads topology (evidence: `backend/app/core/attack_graph.py`)
- Attack Graph → Dynamic Defense: reads mitigations (evidence: `backend/app/core/attack_graph.py`)
- Defense API → Dynamic Defense: controls defense (evidence: `backend/app/api/defense_routes.py`)
- Defense API → Cyber Twin: checks devices (evidence: `backend/app/api/defense_routes.py`)
- Dynamic Defense → SQLite State: writes alerts (evidence: `backend/app/core/defense_engine.py`)
- MLSA API → MLSA Authentication: handles authentication (evidence: `backend/app/api/mlsa_routes.py`)
- MLSA API → SQLite State: uses persistence (evidence: `backend/app/api/mlsa_routes.py`)
- MLSA Authentication → SQLite State: persists credentials (evidence: `backend/app/core/mlsa_auth.py`)
- FastAPI Application → SQLite State: initializes store (evidence: `backend/app/main.py`)
- React Command Center → Fleet Manager: renders (evidence: `frontend/src/App.jsx`)
- React Command Center → Twin Topology: renders (evidence: `frontend/src/App.jsx`)
- React Command Center → Traffic Monitor: renders (evidence: `frontend/src/App.jsx`)
- React Command Center → AI Detection Panel: renders (evidence: `frontend/src/App.jsx`)
- React Command Center → Attack Simulator UI: renders (evidence: `frontend/src/App.jsx`)
- React Command Center → XAI Inspector: renders (evidence: `frontend/src/App.jsx`)
- React Command Center → Attack Graph Viewer: renders (evidence: `frontend/src/App.jsx`)
- React Command Center → Defense Panel: renders (evidence: `frontend/src/App.jsx`)
- React Command Center → MLSA Panel: renders (evidence: `frontend/src/App.jsx`)
- React Command Center → Breach Bench UI: renders (evidence: `frontend/src/App.jsx`)
- React Command Center → Security Logs: renders (evidence: `frontend/src/App.jsx`)
- Fleet Manager → REST Client: calls (evidence: `frontend/src/components/DeviceFleetManager.jsx`)
- AI Detection Panel → REST Client: calls (evidence: `frontend/src/components/AIDetectionPanel.jsx`)
- Attack Graph Viewer → REST Client: calls (evidence: `frontend/src/components/AttackGraphViewer.jsx`)
- Defense Panel → REST Client: calls (evidence: `frontend/src/components/AutomatedDefense.jsx`)
- MLSA Panel → REST Client: calls (evidence: `frontend/src/components/MLSAPanel.jsx`)
- Breach Bench UI → REST Client: calls (evidence: `frontend/src/components/MLSABreachBench.jsx`)
- Security Logs → REST Client: calls (evidence: `frontend/src/components/SecurityLogs.jsx`)
- REST Client → FastAPI Application: HTTP requests (evidence: `frontend/src/services/api.js`)
- REST Client → Attack Graph: requests graph (evidence: `frontend/src/services/api.js`)
- REST Client → XAI Forensics: requests attribution (evidence: `frontend/src/services/api.js`)
- REST Client → Breach Benchmark: requests benchmark (evidence: `frontend/src/services/api.js`)
