# vicky60629/network-intrusion-detection-system architecture

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

- Interactive diagram: https://gitdiagram.com/vicky60629/network-intrusion-detection-system
- Repository: https://github.com/vicky60629/network-intrusion-detection-system

## Overview

This repository is a Flask-based network intrusion detection application backed by a serialized classifier. The principal workflow accepts traffic features, expands categorical inputs, predicts a class, and returns a rendered result or JSON. The README also documents the NSL-KDD analysis and model-training workflow, including EDA outputs and binary/multiclass detection. The notebook and UI assets are present in the tree but were not sampled; their internal behavior and connections are represented only where the README supports them.

Main entry points: [`app.py`](https://github.com/vicky60629/network-intrusion-detection-system/blob/master/app.py) (Flask routes), [`model.pkl`](https://github.com/vicky60629/network-intrusion-detection-system/blob/master/model.pkl) (Traffic classifier), [`NSL_Dataset`](https://github.com/vicky60629/network-intrusion-detection-system/tree/master/NSL_Dataset) (NSL-KDD data), [`Network Intrusion Detection System.ipynb`](https://github.com/vicky60629/network-intrusion-detection-system/blob/master/Network%20Intrusion%20Detection%20System.ipynb) (EDA and features)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_analysis_training["Analysis and training"]
  node_dataset[("NSL-KDD data")]
  node_eda["EDA and features"]
  node_eda_outputs["EDA summaries<br/>[corrm.csv]"]
  node_training["Model training"]
end

subgraph group_inference["Inference"]
  node_classifier["Traffic classifier<br/>[model.pkl]"]
  node_web_app["Flask routes<br/>[app.py]"]
  node_feature_prep["Feature encoding<br/>[app.py]"]
  node_class_mapping["Class mapping<br/>[app.py]"]
end

subgraph group_presentation["Presentation"]
  node_web_view["Result view<br/>[index.html]"]
end

node_operator(("App user"))
node_api_client(("JSON client"))

node_dataset -->|"analyzes"| node_eda
node_eda -->|"produces summaries"| node_eda_outputs
node_dataset -->|"trains on"| node_training
node_training -->|"serializes model"| node_classifier
node_operator -->|"submits features"| node_web_app
node_web_app -->|"encodes input"| node_feature_prep
node_feature_prep -->|"predicts with"| node_classifier
node_classifier -->|"returns prediction"| node_web_app
node_web_app -->|"maps classes"| node_class_mapping
node_web_app -->|"renders result"| node_web_view
node_api_client -.->|"posts JSON"| node_web_app
node_web_app -->|"predicts from JSON"| node_classifier
node_web_app -->|"maps API result"| node_class_mapping

click node_dataset "https://github.com/vicky60629/network-intrusion-detection-system/tree/master/NSL_Dataset"
click node_eda "https://github.com/vicky60629/network-intrusion-detection-system/blob/master/Network%20Intrusion%20Detection%20System.ipynb"
click node_eda_outputs "https://github.com/vicky60629/network-intrusion-detection-system/blob/master/corrm.csv"
click node_training "https://github.com/vicky60629/network-intrusion-detection-system/blob/master/Network%20Intrusion%20Detection%20System.ipynb"
click node_classifier "https://github.com/vicky60629/network-intrusion-detection-system/blob/master/model.pkl"
click node_web_app "https://github.com/vicky60629/network-intrusion-detection-system/blob/master/app.py"
click node_feature_prep "https://github.com/vicky60629/network-intrusion-detection-system/blob/master/app.py"
click node_class_mapping "https://github.com/vicky60629/network-intrusion-detection-system/blob/master/app.py"
click node_web_view "https://github.com/vicky60629/network-intrusion-detection-system/blob/master/templates/index.html"

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_dataset,node_eda,node_eda_outputs,node_training,node_operator,node_api_client toneBlue
class node_classifier,node_web_app,node_feature_prep,node_class_mapping toneAmber
class node_web_view toneMint
```

## Components

### Analysis and training

- [NSL-KDD data](https://github.com/vicky60629/network-intrusion-detection-system/tree/master/NSL_Dataset): `NSL_Dataset`
- [EDA and features](https://github.com/vicky60629/network-intrusion-detection-system/blob/master/Network%20Intrusion%20Detection%20System.ipynb): `Network Intrusion Detection System.ipynb`
- [EDA summaries](https://github.com/vicky60629/network-intrusion-detection-system/blob/master/corrm.csv): `corrm.csv`
- [Model training](https://github.com/vicky60629/network-intrusion-detection-system/blob/master/Network%20Intrusion%20Detection%20System.ipynb): `Network Intrusion Detection System.ipynb`

### Inference

- [Traffic classifier](https://github.com/vicky60629/network-intrusion-detection-system/blob/master/model.pkl): `model.pkl`
- [Flask routes](https://github.com/vicky60629/network-intrusion-detection-system/blob/master/app.py): `app.py`
- [Feature encoding](https://github.com/vicky60629/network-intrusion-detection-system/blob/master/app.py): `app.py`
- [Class mapping](https://github.com/vicky60629/network-intrusion-detection-system/blob/master/app.py): `app.py`

### Presentation

- [Result view](https://github.com/vicky60629/network-intrusion-detection-system/blob/master/templates/index.html): `templates/index.html`

### Other components

- **App user**
- **JSON client**

## Connections

- NSL-KDD data → EDA and features: analyzes (evidence: `README.md`)
- EDA and features → EDA summaries: produces summaries (evidence: `README.md`)
- NSL-KDD data → Model training: trains on (evidence: `README.md`)
- Model training → Traffic classifier: serializes model (evidence: `README.md`)
- App user → Flask routes: submits features (evidence: `README.md`)
- Flask routes → Feature encoding: encodes input (evidence: `app.py`)
- Feature encoding → Traffic classifier: predicts with (evidence: `app.py`)
- Traffic classifier → Flask routes: returns prediction (evidence: `app.py`)
- Flask routes → Class mapping: maps classes (evidence: `app.py`)
- Flask routes → Result view: renders result (evidence: `app.py`)
- JSON client → Flask routes: posts JSON (evidence: `app.py`)
- Flask routes → Traffic classifier: predicts from JSON (evidence: `app.py`)
- Flask routes → Class mapping: maps API result (evidence: `app.py`)
