# tannyzazanaja/netmonitor architecture

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

- Interactive diagram: https://gitdiagram.com/tannyzazanaja/netmonitor
- Repository: https://github.com/tannyzazanaja/netmonitor

## Overview

NetMonitor is a web-based network monitoring dashboard. Operators authenticate, configure sites and devices or discover them, then review live status, traffic, services, alerts, analytics, and topology. The backend exposes the API, coordinates monitoring and alerting, and stores configuration in JSON; Prometheus provides historical metrics. The graph follows documented product flow and sampled imports/calls. Some topology, analytics, and server internals were not excerpted, so their detailed links are omitted or marked unverified.

Main entry points: [`src/App.jsx`](https://github.com/tannyzazanaja/netmonitor/blob/main/src/App.jsx) (App routing), [`server/server.js`](https://github.com/tannyzazanaja/netmonitor/blob/main/server/server.js) (Backend API), [`src/context/DeviceContext.jsx`](https://github.com/tannyzazanaja/netmonitor/blob/main/src/context/DeviceContext.jsx) (Device state), [`src/services/storageService.js`](https://github.com/tannyzazanaja/netmonitor/blob/main/src/services/storageService.js) (Storage API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Web application"]
  node_app["App routing<br/>[App.jsx]"]
  node_dashboard["Dashboard<br/>[DashboardView.jsx]"]
  node_devices_view["Device manager"]
  node_discovery["Device discovery<br/>[ScannerModal.jsx]"]
  node_traffic["Traffic view<br/>[TrafficView.jsx]"]
  node_services_view["Services view<br/>[ServicesView.jsx]"]
  node_alerts_view["Alerts view<br/>[AlertsView.jsx]"]
  node_settings_view["Settings and sites<br/>[SettingsView.jsx]"]
  node_analytics["Analytics<br/>[AnalyticsView.jsx]"]
  node_topology_view["Topology map<br/>[TopologyView.jsx]"]
end

subgraph group_state["Client state and services"]
  node_auth["Authentication state<br/>[AuthContext.jsx]"]
  node_device_state["Device state<br/>[DeviceContext.jsx]"]
  node_settings_state["Settings and Prometheus client"]
  node_alert_state["Alert state and stream<br/>[AlertContext.jsx]"]
  node_topology_state["Topology discovery state"]
  node_storage_client["Storage API client<br/>[storageService.js]"]
  node_prom_client["Prometheus client"]
  node_topology_engine["Topology engine<br/>[topologyEngine.js]"]
  node_alert_storage["Alert storage client<br/>[alertStorage.js]"]
  node_auth_service["Auth API client<br/>[authService.js]"]
  node_toast["Toast notifications<br/>[ToastContext.jsx]"]
end

subgraph group_api["Backend operations"]
  node_api_server["Backend API<br/>[server.js]"]
  node_scanner["Network scanner<br/>[scanner.js]"]
  node_snmp_mapper["SNMP mapping<br/>[snmpMapper.js]"]
  node_backup["Backup and restore<br/>[backup.js]"]
  node_prom_setup["Prometheus SNMP setup"]
end

subgraph group_monitoring["Monitoring services"]
  node_prometheus[("Prometheus")]
  node_exporters["Blackbox / SNMP exporters"]
end

subgraph group_persistence["Persistence"]
  node_json_store[("JSON configuration store")]
end

node_operator(("IT operator"))
node_browser(("Browser"))
node_network{{"Network devices"}}
node_external_alerts["LINE / webhook"]

node_operator -->|"uses"| node_browser
node_browser -->|"opens"| node_app
node_app -->|"provides context"| node_auth
node_app -->|"provides context"| node_settings_state
node_app -->|"provides context"| node_device_state
node_app -->|"provides context"| node_topology_state
node_app -->|"provides context"| node_alert_state
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_devices_view
node_app -->|"routes to"| node_traffic
node_app -->|"routes to"| node_services_view
node_app -->|"routes to"| node_alerts_view
node_app -->|"routes to"| node_settings_view
node_app -->|"routes to"| node_analytics
node_app -->|"routes to"| node_topology_view
node_devices_view -->|"opens scanner"| node_discovery
node_auth -->|"calls"| node_auth_service
node_device_state -->|"loads and saves"| node_storage_client
node_device_state -->|"reads settings"| node_settings_state
node_settings_state -->|"syncs settings"| node_storage_client
node_settings_state -->|"checks connection"| node_prom_client
node_alert_state -->|"loads and saves alerts"| node_alert_storage
node_topology_state -->|"runs discovery and layouts"| node_topology_engine
node_topology_state -->|"persists positions"| node_storage_client
node_dashboard -->|"reads status"| node_device_state
node_dashboard -->|"reads alerts"| node_alert_state
node_traffic -->|"queries metrics"| node_prom_client
node_traffic -->|"reads devices"| node_device_state
node_services_view -->|"reads devices"| node_device_state
node_alerts_view -->|"reads alerts"| node_alert_state
node_settings_view -->|"uses settings storage"| node_storage_client
node_discovery -.->|"requests scan"| node_api_server
node_api_server -->|"uses scanner"| node_scanner
node_scanner -->|"uses mapping"| node_snmp_mapper
node_api_server -->|"uses mapping"| node_snmp_mapper
node_api_server -->|"uses backup"| node_backup
node_api_server -->|"reads and writes"| node_json_store
node_api_server -->|"queries metrics"| node_prometheus
node_api_server -->|"updates targets"| node_prometheus
node_exporters -->|"collects probes"| node_network
node_exporters -->|"exports metrics"| node_prometheus
node_api_server -->|"streams SSE"| node_browser
node_api_server -.->|"sends alerts"| node_external_alerts
node_prom_setup -.->|"configures SNMP"| node_prometheus
node_alert_storage -->|"requests alert API"| node_api_server
node_storage_client -->|"requests storage API"| node_api_server

click node_app "https://github.com/tannyzazanaja/netmonitor/blob/main/src/App.jsx"
click node_dashboard "https://github.com/tannyzazanaja/netmonitor/blob/main/src/components/dashboard/DashboardView.jsx"
click node_devices_view "https://github.com/tannyzazanaja/netmonitor/blob/main/src/components/devices/DeviceManagerView.jsx"
click node_discovery "https://github.com/tannyzazanaja/netmonitor/blob/main/src/components/discovery/ScannerModal.jsx"
click node_traffic "https://github.com/tannyzazanaja/netmonitor/blob/main/src/components/traffic/TrafficView.jsx"
click node_services_view "https://github.com/tannyzazanaja/netmonitor/blob/main/src/components/services/ServicesView.jsx"
click node_alerts_view "https://github.com/tannyzazanaja/netmonitor/blob/main/src/components/alerts/AlertsView.jsx"
click node_settings_view "https://github.com/tannyzazanaja/netmonitor/blob/main/src/components/settings/SettingsView.jsx"
click node_analytics "https://github.com/tannyzazanaja/netmonitor/blob/main/src/components/analytics/AnalyticsView.jsx"
click node_topology_view "https://github.com/tannyzazanaja/netmonitor/blob/main/src/components/topology/TopologyView.jsx"
click node_auth "https://github.com/tannyzazanaja/netmonitor/blob/main/src/context/AuthContext.jsx"
click node_device_state "https://github.com/tannyzazanaja/netmonitor/blob/main/src/context/DeviceContext.jsx"
click node_settings_state "https://github.com/tannyzazanaja/netmonitor/blob/main/src/context/SettingsContext.jsx"
click node_alert_state "https://github.com/tannyzazanaja/netmonitor/blob/main/src/context/AlertContext.jsx"
click node_topology_state "https://github.com/tannyzazanaja/netmonitor/blob/main/src/context/TopologyContext.jsx"
click node_storage_client "https://github.com/tannyzazanaja/netmonitor/blob/main/src/services/storageService.js"
click node_prom_client "https://github.com/tannyzazanaja/netmonitor/blob/main/src/services/prometheusService.js"
click node_topology_engine "https://github.com/tannyzazanaja/netmonitor/blob/main/src/services/topologyEngine.js"
click node_alert_storage "https://github.com/tannyzazanaja/netmonitor/blob/main/src/services/alertStorage.js"
click node_auth_service "https://github.com/tannyzazanaja/netmonitor/blob/main/src/services/authService.js"
click node_api_server "https://github.com/tannyzazanaja/netmonitor/blob/main/server/server.js"
click node_scanner "https://github.com/tannyzazanaja/netmonitor/blob/main/server/scanner.js"
click node_snmp_mapper "https://github.com/tannyzazanaja/netmonitor/blob/main/server/snmpMapper.js"
click node_backup "https://github.com/tannyzazanaja/netmonitor/blob/main/server/services/backup.js"
click node_prom_setup "https://github.com/tannyzazanaja/netmonitor/blob/main/server/setupPrometheusSnmp.js"
click node_toast "https://github.com/tannyzazanaja/netmonitor/blob/main/src/context/ToastContext.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_app,node_dashboard,node_devices_view,node_discovery,node_traffic,node_services_view,node_alerts_view,node_settings_view,node_analytics,node_topology_view,node_browser toneBlue
class node_auth,node_device_state,node_settings_state,node_alert_state,node_topology_state,node_storage_client,node_prom_client,node_topology_engine,node_alert_storage,node_auth_service,node_toast toneAmber
class node_api_server,node_scanner,node_snmp_mapper,node_backup,node_prom_setup,node_external_alerts toneMint
class node_prometheus,node_exporters toneRose
class node_json_store,node_operator,node_network toneIndigo
```

## Components

### Web application

- [App routing](https://github.com/tannyzazanaja/netmonitor/blob/main/src/App.jsx): `src/App.jsx`
- [Dashboard](https://github.com/tannyzazanaja/netmonitor/blob/main/src/components/dashboard/DashboardView.jsx): `src/components/dashboard/DashboardView.jsx`
- [Device manager](https://github.com/tannyzazanaja/netmonitor/blob/main/src/components/devices/DeviceManagerView.jsx): `src/components/devices/DeviceManagerView.jsx`
- [Device discovery](https://github.com/tannyzazanaja/netmonitor/blob/main/src/components/discovery/ScannerModal.jsx): `src/components/discovery/ScannerModal.jsx`
- [Traffic view](https://github.com/tannyzazanaja/netmonitor/blob/main/src/components/traffic/TrafficView.jsx): `src/components/traffic/TrafficView.jsx`
- [Services view](https://github.com/tannyzazanaja/netmonitor/blob/main/src/components/services/ServicesView.jsx): `src/components/services/ServicesView.jsx`
- [Alerts view](https://github.com/tannyzazanaja/netmonitor/blob/main/src/components/alerts/AlertsView.jsx): `src/components/alerts/AlertsView.jsx`
- [Settings and sites](https://github.com/tannyzazanaja/netmonitor/blob/main/src/components/settings/SettingsView.jsx): `src/components/settings/SettingsView.jsx`
- [Analytics](https://github.com/tannyzazanaja/netmonitor/blob/main/src/components/analytics/AnalyticsView.jsx): `src/components/analytics/AnalyticsView.jsx`
- [Topology map](https://github.com/tannyzazanaja/netmonitor/blob/main/src/components/topology/TopologyView.jsx): `src/components/topology/TopologyView.jsx`

### Client state and services

- [Authentication state](https://github.com/tannyzazanaja/netmonitor/blob/main/src/context/AuthContext.jsx): `src/context/AuthContext.jsx`
- [Device state](https://github.com/tannyzazanaja/netmonitor/blob/main/src/context/DeviceContext.jsx): `src/context/DeviceContext.jsx`
- [Settings and Prometheus client](https://github.com/tannyzazanaja/netmonitor/blob/main/src/context/SettingsContext.jsx): `src/context/SettingsContext.jsx`
- [Alert state and stream](https://github.com/tannyzazanaja/netmonitor/blob/main/src/context/AlertContext.jsx): `src/context/AlertContext.jsx`
- [Topology discovery state](https://github.com/tannyzazanaja/netmonitor/blob/main/src/context/TopologyContext.jsx): `src/context/TopologyContext.jsx`
- [Storage API client](https://github.com/tannyzazanaja/netmonitor/blob/main/src/services/storageService.js): `src/services/storageService.js`
- [Prometheus client](https://github.com/tannyzazanaja/netmonitor/blob/main/src/services/prometheusService.js): `src/services/prometheusService.js`
- [Topology engine](https://github.com/tannyzazanaja/netmonitor/blob/main/src/services/topologyEngine.js): `src/services/topologyEngine.js`
- [Alert storage client](https://github.com/tannyzazanaja/netmonitor/blob/main/src/services/alertStorage.js): `src/services/alertStorage.js`
- [Auth API client](https://github.com/tannyzazanaja/netmonitor/blob/main/src/services/authService.js): `src/services/authService.js`
- [Toast notifications](https://github.com/tannyzazanaja/netmonitor/blob/main/src/context/ToastContext.jsx): `src/context/ToastContext.jsx`

### Backend operations

- [Backend API](https://github.com/tannyzazanaja/netmonitor/blob/main/server/server.js): `server/server.js`
- [Network scanner](https://github.com/tannyzazanaja/netmonitor/blob/main/server/scanner.js): `server/scanner.js`
- [SNMP mapping](https://github.com/tannyzazanaja/netmonitor/blob/main/server/snmpMapper.js): `server/snmpMapper.js`
- [Backup and restore](https://github.com/tannyzazanaja/netmonitor/blob/main/server/services/backup.js): `server/services/backup.js`
- [Prometheus SNMP setup](https://github.com/tannyzazanaja/netmonitor/blob/main/server/setupPrometheusSnmp.js): `server/setupPrometheusSnmp.js`

### Monitoring services

- **Prometheus**
- **Blackbox / SNMP exporters**

### Persistence

- **JSON configuration store**

### Other components

- **IT operator**
- **Browser**
- **Network devices**
- **LINE / webhook**

## Connections

- IT operator → Browser: uses (evidence: `README.md`)
- Browser → App routing: opens (evidence: `README.md`)
- App routing → Authentication state: provides context (evidence: `src/App.jsx`)
- App routing → Settings and Prometheus client: provides context (evidence: `src/App.jsx`)
- App routing → Device state: provides context (evidence: `src/App.jsx`)
- App routing → Topology discovery state: provides context (evidence: `src/App.jsx`)
- App routing → Alert state and stream: provides context (evidence: `src/App.jsx`)
- App routing → Dashboard: routes to (evidence: `src/App.jsx`)
- App routing → Device manager: routes to (evidence: `src/App.jsx`)
- App routing → Traffic view: routes to (evidence: `src/App.jsx`)
- App routing → Services view: routes to (evidence: `src/App.jsx`)
- App routing → Alerts view: routes to (evidence: `src/App.jsx`)
- App routing → Settings and sites: routes to (evidence: `src/App.jsx`)
- App routing → Analytics: routes to (evidence: `src/App.jsx`)
- App routing → Topology map: routes to (evidence: `src/App.jsx`)
- Device manager → Device discovery: opens scanner (evidence: `src/components/devices/DeviceManagerView.jsx`)
- Authentication state → Auth API client: calls (evidence: `src/context/AuthContext.jsx`)
- Device state → Storage API client: loads and saves (evidence: `src/context/DeviceContext.jsx`)
- Device state → Settings and Prometheus client: reads settings (evidence: `src/context/DeviceContext.jsx`)
- Settings and Prometheus client → Storage API client: syncs settings (evidence: `src/context/SettingsContext.jsx`)
- Settings and Prometheus client → Prometheus client: checks connection (evidence: `src/context/SettingsContext.jsx`)
- Alert state and stream → Alert storage client: loads and saves alerts (evidence: `src/context/AlertContext.jsx`)
- Topology discovery state → Topology engine: runs discovery and layouts (evidence: `src/context/TopologyContext.jsx`)
- Topology discovery state → Storage API client: persists positions (evidence: `src/context/TopologyContext.jsx`)
- Dashboard → Device state: reads status (evidence: `src/components/dashboard/DashboardView.jsx`)
- Dashboard → Alert state and stream: reads alerts (evidence: `src/components/dashboard/DashboardView.jsx`)
- Traffic view → Prometheus client: queries metrics (evidence: `src/services/prometheusService.js`)
- Traffic view → Device state: reads devices (evidence: `src/components/traffic/TrafficView.jsx`)
- Services view → Device state: reads devices (evidence: `src/components/services/ServicesView.jsx`)
- Alerts view → Alert state and stream: reads alerts (evidence: `src/components/alerts/AlertsView.jsx`)
- Settings and sites → Storage API client: uses settings storage (evidence: `src/components/settings/SettingsView.jsx`)
- Device discovery → Backend API: requests scan
- Backend API → Network scanner: uses scanner (evidence: `server/server.js`)
- Network scanner → SNMP mapping: uses mapping (evidence: `server/scanner.js`)
- Backend API → SNMP mapping: uses mapping (evidence: `server/server.js`)
- Backend API → Backup and restore: uses backup (evidence: `server/server.js`)
- Backend API → JSON configuration store: reads and writes (evidence: `README.md`)
- Backend API → Prometheus: queries metrics (evidence: `README.md`)
- Backend API → Prometheus: updates targets (evidence: `README.md`)
- Blackbox / SNMP exporters → Network devices: collects probes (evidence: `README.md`)
- Blackbox / SNMP exporters → Prometheus: exports metrics (evidence: `README.md`)
- Backend API → Browser: streams SSE (evidence: `README.md`)
- Backend API → LINE / webhook: sends alerts (evidence: `README.md`)
- Prometheus SNMP setup → Prometheus: configures SNMP
- Alert storage client → Backend API: requests alert API (evidence: `src/services/alertStorage.js`)
- Storage API client → Backend API: requests storage API (evidence: `src/services/storageService.js`)
