# nnaveennpm-design/naveen-mini-project_ids architecture

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

- Interactive diagram: https://gitdiagram.com/nnaveennpm-design/naveen-mini-project_ids
- Repository: https://github.com/nnaveennpm-design/naveen-mini-project_ids

## Overview

NIDS is a network intrusion detection and traffic-analysis application with a static Vanilla JS interface and a Flask backend. The principal documented backend workflow captures live traffic, extracts NSL-KDD flow features, applies a real model when available, prioritizes attack predictions, and persists alerts for review. The interface includes monitoring, alert analysis, reporting, administration, and authentication capabilities. Backend call relationships below are limited to those shown in excerpts; frontend-to-backend wiring and several unsampled subsystem details are not established by the available evidence.

Main entry points: [`frontend/js/data-service.js`](https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/frontend/js/data-service.js) (Data service), [`backend/db.py`](https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/backend/db.py) (SQLite persistence), [`backend/monitor_service.py`](https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/backend/monitor_service.py) (Capture service), [`backend/app.py`](https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/backend/app.py) (Flask application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Web interface"]
  node_web["NIDS interface<br/>[main.js]"]
  node_api_client["API client<br/>[api.js]"]
  node_data_service["Data service<br/>[data-service.js]"]
  node_monitor_pages["Monitoring views<br/>[live-monitoring.js]"]
  node_alert_pages["Alert views<br/>[alerts.js]"]
  node_analysis_page["File analysis<br/>[analyse-file.js]"]
  node_overview["Overview dashboard<br/>[overview.js]"]
  node_reports["Reports<br/>[reports.js]"]
  node_admin_pages["Administration<br/>[admin.js]"]
  node_auth_ui["Sign-in interface<br/>[auth.js]"]
end

subgraph group_api["API and identity"]
  node_flask["Flask application<br/>[app.py]"]
  node_auth_routes["Authentication routes<br/>[auth_routes.py]"]
  node_auth_core["Session and RBAC<br/>[auth.py]"]
  node_system_routes["System and analysis routes<br/>[system_routes.py]"]
end

subgraph group_monitor["Live monitoring"]
  node_monitor_routes["Monitoring routes<br/>[monitor_routes.py]"]
  node_monitor_service["Capture service<br/>[monitor_service.py]"]
  node_capture_check["Capture check<br/>[check_capture.py]"]
end

subgraph group_analysis["Detection and alerts"]
  node_features["Flow feature extraction<br/>[features.py]"]
  node_detector["Model detector<br/>[detector.py]"]
  node_detection_engine["Detection engine"]
  node_priority["Alert prioritization<br/>[priority.py]"]
  node_alerts_routes["Alert routes<br/>[alerts_routes.py]"]
  node_database[("SQLite persistence<br/>[db.py]")]
end

node_analyst(("Analyst or admin"))
node_browser(("Browser"))

node_analyst -->|"uses"| node_browser
node_browser -->|"loads"| node_web
node_web -.->|"uses"| node_api_client
node_api_client -.->|"supplies data"| node_data_service
node_data_service -.->|"feeds"| node_monitor_pages
node_data_service -.->|"feeds"| node_alert_pages
node_data_service -.->|"feeds"| node_analysis_page
node_data_service -.->|"feeds"| node_overview
node_data_service -.->|"feeds"| node_reports
node_data_service -.->|"feeds"| node_admin_pages
node_auth_ui -.->|"requests"| node_api_client
node_flask -->|"registers"| node_auth_routes
node_flask -->|"registers"| node_monitor_routes
node_flask -->|"registers"| node_alerts_routes
node_flask -->|"registers"| node_system_routes
node_auth_routes -->|"verifies tokens"| node_auth_core
node_auth_routes -->|"reads and writes"| node_database
node_auth_core -->|"checks sessions"| node_database
node_monitor_routes -->|"controls and queries"| node_monitor_service
node_monitor_routes -->|"reads settings"| node_database
node_monitor_service -->|"extracts features"| node_features
node_monitor_service -->|"predicts flows"| node_detector
node_monitor_service -->|"creates alerts"| node_priority
node_monitor_service -->|"persists alerts"| node_database
node_system_routes -->|"analyzes CSV"| node_detector
node_system_routes -->|"reads and writes"| node_database
node_alerts_routes -->|"queries and updates"| node_database
node_capture_check -->|"checks capture"| node_monitor_service
node_capture_check -->|"checks persistence"| node_database
node_detection_engine -->|"uses storage"| node_database

click node_web "https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/frontend/js/main.js"
click node_api_client "https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/frontend/js/api.js"
click node_data_service "https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/frontend/js/data-service.js"
click node_monitor_pages "https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/frontend/js/pages/live-monitoring.js"
click node_alert_pages "https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/frontend/js/pages/alerts.js"
click node_analysis_page "https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/frontend/js/pages/analyse-file.js"
click node_overview "https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/frontend/js/pages/overview.js"
click node_reports "https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/frontend/js/pages/reports.js"
click node_admin_pages "https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/frontend/js/pages/admin.js"
click node_auth_ui "https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/frontend/js/auth.js"
click node_flask "https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/backend/app.py"
click node_auth_routes "https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/backend/routes/auth_routes.py"
click node_auth_core "https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/backend/auth.py"
click node_system_routes "https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/backend/routes/system_routes.py"
click node_monitor_routes "https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/backend/routes/monitor_routes.py"
click node_monitor_service "https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/backend/monitor_service.py"
click node_capture_check "https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/backend/check_capture.py"
click node_features "https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/backend/features.py"
click node_detector "https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/backend/detector.py"
click node_detection_engine "https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/backend/detection_engine.py"
click node_priority "https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/backend/priority.py"
click node_alerts_routes "https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/backend/routes/alerts_routes.py"
click node_database "https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/backend/db.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_api_client,node_data_service,node_monitor_pages,node_alert_pages,node_analysis_page,node_overview,node_reports,node_admin_pages,node_auth_ui,node_browser toneBlue
class node_flask,node_auth_routes,node_auth_core,node_system_routes toneAmber
class node_monitor_routes,node_monitor_service,node_capture_check toneMint
class node_features,node_detector,node_detection_engine,node_priority,node_alerts_routes,node_database toneRose
class node_analyst toneIndigo
```

## Components

### Web interface

- [NIDS interface](https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/frontend/js/main.js): `frontend/js/main.js`
- [API client](https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/frontend/js/api.js): `frontend/js/api.js`
- [Data service](https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/frontend/js/data-service.js): `frontend/js/data-service.js`
- [Monitoring views](https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/frontend/js/pages/live-monitoring.js): `frontend/js/pages/live-monitoring.js`
- [Alert views](https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/frontend/js/pages/alerts.js): `frontend/js/pages/alerts.js`
- [File analysis](https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/frontend/js/pages/analyse-file.js): `frontend/js/pages/analyse-file.js`
- [Overview dashboard](https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/frontend/js/pages/overview.js): `frontend/js/pages/overview.js`
- [Reports](https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/frontend/js/pages/reports.js): `frontend/js/pages/reports.js`
- [Administration](https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/frontend/js/pages/admin.js): `frontend/js/pages/admin.js`
- [Sign-in interface](https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/frontend/js/auth.js): `frontend/js/auth.js`

### API and identity

- [Flask application](https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/backend/app.py): `backend/app.py`
- [Authentication routes](https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/backend/routes/auth_routes.py): `backend/routes/auth_routes.py`
- [Session and RBAC](https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/backend/auth.py): `backend/auth.py`
- [System and analysis routes](https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/backend/routes/system_routes.py): `backend/routes/system_routes.py`

### Live monitoring

- [Monitoring routes](https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/backend/routes/monitor_routes.py): `backend/routes/monitor_routes.py`
- [Capture service](https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/backend/monitor_service.py): `backend/monitor_service.py`
- [Capture check](https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/backend/check_capture.py): `backend/check_capture.py`

### Detection and alerts

- [Flow feature extraction](https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/backend/features.py): `backend/features.py`
- [Model detector](https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/backend/detector.py): `backend/detector.py`
- [Detection engine](https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/backend/detection_engine.py): `backend/detection_engine.py`
- [Alert prioritization](https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/backend/priority.py): `backend/priority.py`
- [Alert routes](https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/backend/routes/alerts_routes.py): `backend/routes/alerts_routes.py`
- [SQLite persistence](https://github.com/nnaveennpm-design/naveen-mini-project_ids/blob/frontend/backend/db.py): `backend/db.py`

### Other components

- **Analyst or admin**
- **Browser**

## Connections

- Analyst or admin → Browser: uses (evidence: `README.md`)
- Browser → NIDS interface: loads (evidence: `README.md`)
- NIDS interface → API client: uses
- API client → Data service: supplies data
- Data service → Monitoring views: feeds
- Data service → Alert views: feeds
- Data service → File analysis: feeds
- Data service → Overview dashboard: feeds
- Data service → Reports: feeds
- Data service → Administration: feeds
- Sign-in interface → API client: requests
- Flask application → Authentication routes: registers (evidence: `backend/app.py`)
- Flask application → Monitoring routes: registers (evidence: `backend/app.py`)
- Flask application → Alert routes: registers (evidence: `backend/app.py`)
- Flask application → System and analysis routes: registers (evidence: `backend/app.py`)
- Authentication routes → Session and RBAC: verifies tokens (evidence: `backend/routes/auth_routes.py`)
- Authentication routes → SQLite persistence: reads and writes (evidence: `backend/routes/auth_routes.py`)
- Session and RBAC → SQLite persistence: checks sessions (evidence: `backend/auth.py`)
- Monitoring routes → Capture service: controls and queries (evidence: `backend/routes/monitor_routes.py`)
- Monitoring routes → SQLite persistence: reads settings (evidence: `backend/routes/monitor_routes.py`)
- Capture service → Flow feature extraction: extracts features (evidence: `backend/monitor_service.py`)
- Capture service → Model detector: predicts flows (evidence: `backend/monitor_service.py`)
- Capture service → Alert prioritization: creates alerts (evidence: `backend/monitor_service.py`)
- Capture service → SQLite persistence: persists alerts (evidence: `backend/monitor_service.py`)
- System and analysis routes → Model detector: analyzes CSV (evidence: `backend/routes/system_routes.py`)
- System and analysis routes → SQLite persistence: reads and writes (evidence: `backend/routes/system_routes.py`)
- Alert routes → SQLite persistence: queries and updates (evidence: `backend/routes/alerts_routes.py`)
- Capture check → Capture service: checks capture (evidence: `backend/check_capture.py`)
- Capture check → SQLite persistence: checks persistence (evidence: `backend/check_capture.py`)
- Detection engine → SQLite persistence: uses storage (evidence: `backend/detection_engine.py`)
