# pzambare3/netmoniai architecture

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

- Interactive diagram: https://gitdiagram.com/pzambare3/netmoniai
- Repository: https://github.com/pzambare3/netmoniai

## Overview

NetMoniAI combines node-local monitoring and PCAP-based threat analysis with a central controller that accepts reports, correlates node status, and serves dashboards and live updates. The main runtime path is metrics and anomaly detection, capture, security classification, report generation, then central presentation; offline PCAP analysis is a second documented entry path. The source excerpts show key queue handoffs and UI/API calls, while broader central correlation and some WebSocket behavior are documented only in the README, so those links are cited there.

Main entry points: [`backend/app.py`](https://github.com/pzambare3/netmoniai/blob/main/backend/app.py) (FastAPI Runtime), [`backend/nw_agents/PerformanceMonitoringAgent.py`](https://github.com/pzambare3/netmoniai/blob/main/backend/nw_agents/PerformanceMonitoringAgent.py) (Performance Monitor), [`backend/nw_agents/SecurityAnalysisAgent.py`](https://github.com/pzambare3/netmoniai/blob/main/backend/nw_agents/SecurityAnalysisAgent.py) (Security Analysis), [`frontend/src/components/GlobalControllerDashboard.js`](https://github.com/pzambare3/netmoniai/blob/main/frontend/src/components/GlobalControllerDashboard.js) (Global Dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_local["Node Monitoring"]
  node_config["Queues and Config<br/>[config.py]"]
  node_monitor["Performance Monitor"]
  node_tuning["Parameter Tuning"]
end

subgraph group_analysis["Threat Analysis"]
  node_schemas["Domain Models<br/>[common_classes.py]"]
  node_security["Security Analysis"]
  node_attack_detect["PCAP Attack Detection"]
  node_reporting["Report Generation<br/>[ReportingAgent.py]"]
  node_pcap_analyzer["PCAP Summary<br/>[pcap_analyzer.py]"]
  node_offline["Offline PCAP Analysis<br/>[analyze_nodes.py]"]
end

subgraph group_central["Central Controller"]
  node_app["FastAPI Runtime<br/>[app.py]"]
  node_websocket["WebSocket Server<br/>[appWebsocket.py]"]
  node_chat_agent["Chat Agent<br/>[ChatAgent.py]"]
end

subgraph group_frontend["Dashboard UI"]
  node_local_ui["Local Dashboard"]
  node_local_chat["Local Chat UI<br/>[chatbot.js]"]
  node_global_ui["Global Dashboard"]
  node_network_view["Network Visualizer"]
  node_global_chat["Global Chat UI<br/>[GlobalChatbot.js]"]
  node_api_client["Status API Client<br/>[apiService.js]"]
  node_app_ui["UI Router<br/>[App.js]"]
end

node_operator(("Operator"))
node_actor_network(("Monitored Network"))
node_llm{{"LLM Service"}}
node_tshark{{"tshark"}}

node_operator -->|"uses"| node_app_ui
node_app_ui -->|"routes to"| node_local_ui
node_app_ui -->|"routes to"| node_global_ui
node_local_ui -->|"renders"| node_local_chat
node_global_ui -->|"renders"| node_network_view
node_global_ui -->|"renders"| node_global_chat
node_global_ui -->|"fetches statuses"| node_api_client
node_api_client -->|"GET statuses"| node_app
node_operator -.->|"monitors"| node_actor_network
node_app -->|"starts"| node_monitor
node_app -->|"starts"| node_tuning
node_app -->|"starts"| node_security
node_app -->|"starts"| node_reporting
node_app -->|"registers endpoint"| node_websocket
node_config -->|"provides queues"| node_monitor
node_monitor -->|"sends metrics"| node_tuning
node_monitor -->|"sends capture path"| node_security
node_monitor -.->|"collects metrics"| node_actor_network
node_monitor -.->|"captures traffic"| node_tshark
node_security -->|"analyzes PCAP"| node_attack_detect
node_attack_detect -->|"converts PCAP"| node_tshark
node_attack_detect -->|"requests classification"| node_llm
node_security -->|"queues findings"| node_reporting
node_reporting -->|"summarizes capture"| node_pcap_analyzer
node_offline -->|"analyzes node PCAPs"| node_security
node_offline -->|"posts reports"| node_app
node_app -->|"broadcasts updates"| node_websocket
node_websocket -->|"streams metrics"| node_local_ui
node_websocket -->|"streams alerts"| node_global_ui
node_app -.->|"exposes chat"| node_chat_agent
node_security -->|"uses result models"| node_schemas
node_reporting -->|"builds report model"| node_schemas
node_tuning -->|"uses parameter model"| node_schemas

click node_local_ui "https://github.com/pzambare3/netmoniai/blob/main/frontend/src/components/LocalControllerDashboard.js"
click node_local_chat "https://github.com/pzambare3/netmoniai/blob/main/frontend/src/components/chatbot.js"
click node_global_ui "https://github.com/pzambare3/netmoniai/blob/main/frontend/src/components/GlobalControllerDashboard.js"
click node_network_view "https://github.com/pzambare3/netmoniai/blob/main/frontend/src/components/NetworkVisualizer.js"
click node_global_chat "https://github.com/pzambare3/netmoniai/blob/main/frontend/src/components/GlobalChatbot.js"
click node_api_client "https://github.com/pzambare3/netmoniai/blob/main/frontend/src/apiService.js"
click node_app_ui "https://github.com/pzambare3/netmoniai/blob/main/frontend/src/App.js"
click node_app "https://github.com/pzambare3/netmoniai/blob/main/backend/app.py"
click node_websocket "https://github.com/pzambare3/netmoniai/blob/main/backend/appWebsocket.py"
click node_config "https://github.com/pzambare3/netmoniai/blob/main/backend/config.py"
click node_schemas "https://github.com/pzambare3/netmoniai/blob/main/backend/common_classes.py"
click node_monitor "https://github.com/pzambare3/netmoniai/blob/main/backend/nw_agents/PerformanceMonitoringAgent.py"
click node_tuning "https://github.com/pzambare3/netmoniai/blob/main/backend/nw_agents/ParameterTuningAgent.py"
click node_security "https://github.com/pzambare3/netmoniai/blob/main/backend/nw_agents/SecurityAnalysisAgent.py"
click node_attack_detect "https://github.com/pzambare3/netmoniai/blob/main/backend/tools/attack_detection3.py"
click node_reporting "https://github.com/pzambare3/netmoniai/blob/main/backend/nw_agents/ReportingAgent.py"
click node_pcap_analyzer "https://github.com/pzambare3/netmoniai/blob/main/backend/tools/pcap_analyzer.py"
click node_offline "https://github.com/pzambare3/netmoniai/blob/main/backend/analyze_nodes.py"
click node_chat_agent "https://github.com/pzambare3/netmoniai/blob/main/backend/nw_agents/ChatAgent.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_config,node_monitor,node_tuning toneBlue
class node_schemas,node_security,node_attack_detect,node_reporting,node_pcap_analyzer,node_offline toneAmber
class node_app,node_websocket,node_chat_agent toneMint
class node_local_ui,node_local_chat,node_global_ui,node_network_view,node_global_chat,node_api_client,node_app_ui toneRose
class node_operator,node_actor_network,node_llm,node_tshark toneIndigo
```

## Components

### Node Monitoring

- [Queues and Config](https://github.com/pzambare3/netmoniai/blob/main/backend/config.py): `backend/config.py`
- [Performance Monitor](https://github.com/pzambare3/netmoniai/blob/main/backend/nw_agents/PerformanceMonitoringAgent.py): `backend/nw_agents/PerformanceMonitoringAgent.py`
- [Parameter Tuning](https://github.com/pzambare3/netmoniai/blob/main/backend/nw_agents/ParameterTuningAgent.py): `backend/nw_agents/ParameterTuningAgent.py`

### Threat Analysis

- [Domain Models](https://github.com/pzambare3/netmoniai/blob/main/backend/common_classes.py): `backend/common_classes.py`
- [Security Analysis](https://github.com/pzambare3/netmoniai/blob/main/backend/nw_agents/SecurityAnalysisAgent.py): `backend/nw_agents/SecurityAnalysisAgent.py`
- [PCAP Attack Detection](https://github.com/pzambare3/netmoniai/blob/main/backend/tools/attack_detection3.py): `backend/tools/attack_detection3.py`
- [Report Generation](https://github.com/pzambare3/netmoniai/blob/main/backend/nw_agents/ReportingAgent.py): `backend/nw_agents/ReportingAgent.py`
- [PCAP Summary](https://github.com/pzambare3/netmoniai/blob/main/backend/tools/pcap_analyzer.py): `backend/tools/pcap_analyzer.py`
- [Offline PCAP Analysis](https://github.com/pzambare3/netmoniai/blob/main/backend/analyze_nodes.py): `backend/analyze_nodes.py`

### Central Controller

- [FastAPI Runtime](https://github.com/pzambare3/netmoniai/blob/main/backend/app.py): `backend/app.py`
- [WebSocket Server](https://github.com/pzambare3/netmoniai/blob/main/backend/appWebsocket.py): `backend/appWebsocket.py`
- [Chat Agent](https://github.com/pzambare3/netmoniai/blob/main/backend/nw_agents/ChatAgent.py): `backend/nw_agents/ChatAgent.py`

### Dashboard UI

- [Local Dashboard](https://github.com/pzambare3/netmoniai/blob/main/frontend/src/components/LocalControllerDashboard.js): `frontend/src/components/LocalControllerDashboard.js`
- [Local Chat UI](https://github.com/pzambare3/netmoniai/blob/main/frontend/src/components/chatbot.js): `frontend/src/components/chatbot.js`
- [Global Dashboard](https://github.com/pzambare3/netmoniai/blob/main/frontend/src/components/GlobalControllerDashboard.js): `frontend/src/components/GlobalControllerDashboard.js`
- [Network Visualizer](https://github.com/pzambare3/netmoniai/blob/main/frontend/src/components/NetworkVisualizer.js): `frontend/src/components/NetworkVisualizer.js`
- [Global Chat UI](https://github.com/pzambare3/netmoniai/blob/main/frontend/src/components/GlobalChatbot.js): `frontend/src/components/GlobalChatbot.js`
- [Status API Client](https://github.com/pzambare3/netmoniai/blob/main/frontend/src/apiService.js): `frontend/src/apiService.js`
- [UI Router](https://github.com/pzambare3/netmoniai/blob/main/frontend/src/App.js): `frontend/src/App.js`

### Other components

- **Operator**
- **Monitored Network**
- **LLM Service**
- **tshark**

## Connections

- Operator → UI Router: uses (evidence: `frontend/src/App.js`)
- UI Router → Local Dashboard: routes to (evidence: `frontend/src/App.js`)
- UI Router → Global Dashboard: routes to (evidence: `frontend/src/App.js`)
- Local Dashboard → Local Chat UI: renders (evidence: `frontend/src/components/LocalControllerDashboard.js`)
- Global Dashboard → Network Visualizer: renders (evidence: `frontend/src/components/GlobalControllerDashboard.js`)
- Global Dashboard → Global Chat UI: renders (evidence: `frontend/src/components/GlobalControllerDashboard.js`)
- Global Dashboard → Status API Client: fetches statuses (evidence: `frontend/src/components/GlobalControllerDashboard.js`)
- Status API Client → FastAPI Runtime: GET statuses (evidence: `frontend/src/apiService.js`)
- Operator → Monitored Network: monitors
- FastAPI Runtime → Performance Monitor: starts (evidence: `backend/app.py`)
- FastAPI Runtime → Parameter Tuning: starts (evidence: `backend/app.py`)
- FastAPI Runtime → Security Analysis: starts (evidence: `backend/app.py`)
- FastAPI Runtime → Report Generation: starts (evidence: `backend/app.py`)
- FastAPI Runtime → WebSocket Server: registers endpoint (evidence: `backend/app.py`)
- Queues and Config → Performance Monitor: provides queues (evidence: `backend/app.py`)
- Performance Monitor → Parameter Tuning: sends metrics (evidence: `backend/app.py`)
- Performance Monitor → Security Analysis: sends capture path (evidence: `backend/app.py`)
- Performance Monitor → Monitored Network: collects metrics
- Performance Monitor → tshark: captures traffic (evidence: `README.md`)
- Security Analysis → PCAP Attack Detection: analyzes PCAP (evidence: `backend/nw_agents/SecurityAnalysisAgent.py`)
- PCAP Attack Detection → tshark: converts PCAP (evidence: `backend/tools/attack_detection3.py`)
- PCAP Attack Detection → LLM Service: requests classification (evidence: `backend/tools/attack_detection3.py`)
- Security Analysis → Report Generation: queues findings (evidence: `backend/nw_agents/SecurityAnalysisAgent.py`)
- Report Generation → PCAP Summary: summarizes capture (evidence: `backend/nw_agents/ReportingAgent.py`)
- Offline PCAP Analysis → Security Analysis: analyzes node PCAPs (evidence: `backend/analyze_nodes.py`)
- Offline PCAP Analysis → FastAPI Runtime: posts reports (evidence: `README.md`)
- FastAPI Runtime → WebSocket Server: broadcasts updates (evidence: `README.md`)
- WebSocket Server → Local Dashboard: streams metrics (evidence: `README.md`)
- WebSocket Server → Global Dashboard: streams alerts (evidence: `README.md`)
- FastAPI Runtime → Chat Agent: exposes chat (evidence: `backend/app.py`)
- Security Analysis → Domain Models: uses result models (evidence: `backend/nw_agents/SecurityAnalysisAgent.py`)
- Report Generation → Domain Models: builds report model (evidence: `backend/nw_agents/ReportingAgent.py`)
- Parameter Tuning → Domain Models: uses parameter model (evidence: `backend/nw_agents/ParameterTuningAgent.py`)
