# ankush07261/intelligent-intrusion-detection-system architecture

> Architecture diagram of the GitHub repository ankush07261/intelligent-intrusion-detection-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ankush07261/intelligent-intrusion-detection-system
- Repository: https://github.com/ankush07261/intelligent-intrusion-detection-system

## Overview

This is a real-time intrusion-detection platform: it captures network packets, classifies traffic, stores prediction logs, and presents them in a web dashboard. The primary runtime path is backend packet capture to prediction and persistence, then API retrieval and dashboard visualization. Users can also log in, register users, and request model retraining. README and sampled source support the main workflow; some backend modules were not sampled, so their internal calls are not expanded.

Main entry points: [`Dashboard/backend/main.py`](https://github.com/ankush07261/intelligent-intrusion-detection-system/blob/main/Dashboard/backend/main.py) (FastAPI application), [`Dashboard/frontend/src/api.js`](https://github.com/ankush07261/intelligent-intrusion-detection-system/blob/main/Dashboard/frontend/src/api.js) (API client), [`Dashboard/frontend/src/App.js`](https://github.com/ankush07261/intelligent-intrusion-detection-system/blob/main/Dashboard/frontend/src/App.js) (React routes), [`Dashboard/frontend/src/pages/Dashboard.js`](https://github.com/ankush07261/intelligent-intrusion-detection-system/blob/main/Dashboard/frontend/src/pages/Dashboard.js) (Threat dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Traffic Capture"]
  node_extract["Background capture<br/>[extract.py]"]
  node_capture_csv["Captured packets<br/>[capture_data.csv]"]
end

subgraph group_detection["Detection and Training"]
  node_train["Classifier training"]
  node_model["Trained model"]
  node_predictor["Realtime prediction"]
  node_retrain["Model retraining<br/>[model_retrain.py]"]
end

subgraph group_backend["Backend Services"]
  node_api["FastAPI application<br/>[main.py]"]
  node_convert["Prediction retrieval<br/>[convert.py]"]
  node_auth_login["Login endpoint<br/>[login.py]"]
  node_auth_register["Registration endpoint<br/>[registration.py]"]
  node_db_utils["Database utilities<br/>[db_utils.py]"]
end

subgraph group_frontend["Web Dashboard"]
  node_app["React routes<br/>[App.js]"]
  node_login_page["Login screen<br/>[Login.js]"]
  node_dashboard["Threat dashboard<br/>[Dashboard.js]"]
  node_api_client["API client<br/>[api.js]"]
  node_user_modal["User management<br/>[AddUserModal.js]"]
end

node_network(("Network traffic"))
node_mysql[("MySQL")]
node_user(("Dashboard user"))

node_network -->|"provides packets"| node_extract
node_api -->|"starts capture"| node_extract
node_extract -->|"writes packets"| node_capture_csv
node_capture_csv -->|"reads packets"| node_predictor
node_train -->|"saves model"| node_model
node_model -->|"loads model"| node_predictor
node_predictor -->|"stores predictions"| node_mysql
node_api -->|"mounts router"| node_auth_login
node_api -->|"mounts router"| node_auth_register
node_auth_login -->|"authenticates"| node_mysql
node_auth_register -->|"stores users"| node_mysql
node_api -->|"requests predictions"| node_convert
node_convert -->|"reads predictions"| node_mysql
node_api -->|"dispatches retraining"| node_retrain
node_retrain -->|"rebuilds model"| node_train
node_user -->|"opens dashboard"| node_app
node_app -->|"routes login"| node_login_page
node_app -->|"routes dashboard"| node_dashboard
node_login_page -->|"submits credentials"| node_api_client
node_dashboard -->|"requests predictions"| node_api_client
node_dashboard -->|"requests retraining"| node_api_client
node_user_modal -->|"registers user"| node_api_client
node_api_client -->|"calls endpoints"| node_api

click node_extract "https://github.com/ankush07261/intelligent-intrusion-detection-system/blob/main/Dashboard/backend/extract.py"
click node_capture_csv "https://github.com/ankush07261/intelligent-intrusion-detection-system/blob/main/Dashboard/backend/capture_data.csv"
click node_train "https://github.com/ankush07261/intelligent-intrusion-detection-system/tree/main/Detection-Models/Models"
click node_model "https://github.com/ankush07261/intelligent-intrusion-detection-system/blob/main/Dashboard/backend/attack_detector_model.pkl"
click node_predictor "https://github.com/ankush07261/intelligent-intrusion-detection-system/blob/main/Dashboard/backend/realtime_predict.py"
click node_retrain "https://github.com/ankush07261/intelligent-intrusion-detection-system/blob/main/Dashboard/backend/model_retrain.py"
click node_api "https://github.com/ankush07261/intelligent-intrusion-detection-system/blob/main/Dashboard/backend/main.py"
click node_convert "https://github.com/ankush07261/intelligent-intrusion-detection-system/blob/main/Dashboard/backend/convert.py"
click node_auth_login "https://github.com/ankush07261/intelligent-intrusion-detection-system/blob/main/Dashboard/backend/login.py"
click node_auth_register "https://github.com/ankush07261/intelligent-intrusion-detection-system/blob/main/Dashboard/backend/registration.py"
click node_db_utils "https://github.com/ankush07261/intelligent-intrusion-detection-system/blob/main/Dashboard/backend/db_utils.py"
click node_app "https://github.com/ankush07261/intelligent-intrusion-detection-system/blob/main/Dashboard/frontend/src/App.js"
click node_login_page "https://github.com/ankush07261/intelligent-intrusion-detection-system/blob/main/Dashboard/frontend/src/pages/Login.js"
click node_dashboard "https://github.com/ankush07261/intelligent-intrusion-detection-system/blob/main/Dashboard/frontend/src/pages/Dashboard.js"
click node_api_client "https://github.com/ankush07261/intelligent-intrusion-detection-system/blob/main/Dashboard/frontend/src/api.js"
click node_user_modal "https://github.com/ankush07261/intelligent-intrusion-detection-system/blob/main/Dashboard/frontend/src/components/AddUserModal.js"

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_extract,node_capture_csv,node_user toneBlue
class node_train,node_model,node_predictor,node_retrain,node_mysql toneAmber
class node_api,node_convert,node_auth_login,node_auth_register,node_db_utils toneMint
class node_app,node_login_page,node_dashboard,node_api_client,node_user_modal toneRose
class node_network toneIndigo
```

## Components

### Traffic Capture

- [Background capture](https://github.com/ankush07261/intelligent-intrusion-detection-system/blob/main/Dashboard/backend/extract.py): `Dashboard/backend/extract.py`
- [Captured packets](https://github.com/ankush07261/intelligent-intrusion-detection-system/blob/main/Dashboard/backend/capture_data.csv): `Dashboard/backend/capture_data.csv`

### Detection and Training

- [Classifier training](https://github.com/ankush07261/intelligent-intrusion-detection-system/tree/main/Detection-Models/Models): `Detection-Models/Models`
- [Trained model](https://github.com/ankush07261/intelligent-intrusion-detection-system/blob/main/Dashboard/backend/attack_detector_model.pkl): `Dashboard/backend/attack_detector_model.pkl`
- [Realtime prediction](https://github.com/ankush07261/intelligent-intrusion-detection-system/blob/main/Dashboard/backend/realtime_predict.py): `Dashboard/backend/realtime_predict.py`
- [Model retraining](https://github.com/ankush07261/intelligent-intrusion-detection-system/blob/main/Dashboard/backend/model_retrain.py): `Dashboard/backend/model_retrain.py`

### Backend Services

- [FastAPI application](https://github.com/ankush07261/intelligent-intrusion-detection-system/blob/main/Dashboard/backend/main.py): `Dashboard/backend/main.py`
- [Prediction retrieval](https://github.com/ankush07261/intelligent-intrusion-detection-system/blob/main/Dashboard/backend/convert.py): `Dashboard/backend/convert.py`
- [Login endpoint](https://github.com/ankush07261/intelligent-intrusion-detection-system/blob/main/Dashboard/backend/login.py): `Dashboard/backend/login.py`
- [Registration endpoint](https://github.com/ankush07261/intelligent-intrusion-detection-system/blob/main/Dashboard/backend/registration.py): `Dashboard/backend/registration.py`
- [Database utilities](https://github.com/ankush07261/intelligent-intrusion-detection-system/blob/main/Dashboard/backend/db_utils.py): `Dashboard/backend/db_utils.py`

### Web Dashboard

- [React routes](https://github.com/ankush07261/intelligent-intrusion-detection-system/blob/main/Dashboard/frontend/src/App.js): `Dashboard/frontend/src/App.js`
- [Login screen](https://github.com/ankush07261/intelligent-intrusion-detection-system/blob/main/Dashboard/frontend/src/pages/Login.js): `Dashboard/frontend/src/pages/Login.js`
- [Threat dashboard](https://github.com/ankush07261/intelligent-intrusion-detection-system/blob/main/Dashboard/frontend/src/pages/Dashboard.js): `Dashboard/frontend/src/pages/Dashboard.js`
- [API client](https://github.com/ankush07261/intelligent-intrusion-detection-system/blob/main/Dashboard/frontend/src/api.js): `Dashboard/frontend/src/api.js`
- [User management](https://github.com/ankush07261/intelligent-intrusion-detection-system/blob/main/Dashboard/frontend/src/components/AddUserModal.js): `Dashboard/frontend/src/components/AddUserModal.js`

### Other components

- **Network traffic**
- **MySQL**
- **Dashboard user**

## Connections

- Network traffic → Background capture: provides packets
- FastAPI application → Background capture: starts capture
- Background capture → Captured packets: writes packets
- Captured packets → Realtime prediction: reads packets
- Classifier training → Trained model: saves model
- Trained model → Realtime prediction: loads model
- Realtime prediction → MySQL: stores predictions
- FastAPI application → Login endpoint: mounts router
- FastAPI application → Registration endpoint: mounts router
- Login endpoint → MySQL: authenticates
- Registration endpoint → MySQL: stores users
- FastAPI application → Prediction retrieval: requests predictions
- Prediction retrieval → MySQL: reads predictions
- FastAPI application → Model retraining: dispatches retraining
- Model retraining → Classifier training: rebuilds model
- Dashboard user → React routes: opens dashboard
- React routes → Login screen: routes login
- React routes → Threat dashboard: routes dashboard
- Login screen → API client: submits credentials
- Threat dashboard → API client: requests predictions
- Threat dashboard → API client: requests retraining
- User management → API client: registers user
- API client → FastAPI application: calls endpoints
