# vignesheilik/ddos_project architecture

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

- Interactive diagram: https://gitdiagram.com/vignesheilik/ddos_project
- Repository: https://github.com/vignesheilik/ddos_project

## Overview

This is a small Flask application for classifying uploaded network-traffic CSVs as DDoS or benign. At startup it trains a Gaussian Naive Bayes model from the bundled dataset only when the model artifact is absent. Users open the upload page, submit a CSV, and receive a rendered prediction. The graph reflects the single sampled implementation; the README provides no additional capability details, and template internals were not sampled.

Main entry points: [`app.py`](https://github.com/vignesheilik/ddos_project/blob/main/app.py) (Flask app), [`ddos_model.pkl`](https://github.com/vignesheilik/ddos_project/blob/main/ddos_model.pkl) (Saved model), [`templates/index.html`](https://github.com/vignesheilik/ddos_project/blob/main/templates/index.html) (Upload page), [`templates/result.html`](https://github.com/vignesheilik/ddos_project/blob/main/templates/result.html) (Prediction page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web workflow"]
  node_flask["Flask app<br/>[app.py]"]
  node_upload["CSV upload handler<br/>[app.py]"]
  node_home["Upload page<br/>[index.html]"]
  node_result["Prediction page<br/>[result.html]"]
end

subgraph group_ml["Classification"]
  node_training["Model training<br/>[app.py]"]
  node_dataset["Training dataset<br/>[test3.csv]"]
  node_model["Saved model<br/>[ddos_model.pkl]"]
  node_inference["Prediction logic<br/>[app.py]"]
end

node_user(("User"))

node_user -->|"opens page"| node_flask
node_flask -->|"renders"| node_home
node_user -->|"uploads CSV"| node_upload
node_upload -->|"processes file"| node_inference
node_inference -->|"renders prediction"| node_result
node_flask -->|"trains if absent"| node_training
node_training -->|"reads"| node_dataset
node_training -->|"saves"| node_model
node_inference -->|"loads and predicts"| node_model

click node_flask "https://github.com/vignesheilik/ddos_project/blob/main/app.py"
click node_upload "https://github.com/vignesheilik/ddos_project/blob/main/app.py"
click node_home "https://github.com/vignesheilik/ddos_project/blob/main/templates/index.html"
click node_result "https://github.com/vignesheilik/ddos_project/blob/main/templates/result.html"
click node_training "https://github.com/vignesheilik/ddos_project/blob/main/app.py"
click node_dataset "https://github.com/vignesheilik/ddos_project/blob/main/test3.csv"
click node_model "https://github.com/vignesheilik/ddos_project/blob/main/ddos_model.pkl"
click node_inference "https://github.com/vignesheilik/ddos_project/blob/main/app.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_flask,node_upload,node_home,node_result,node_user toneBlue
class node_training,node_dataset,node_model,node_inference toneAmber
```

## Components

### Web workflow

- [Flask app](https://github.com/vignesheilik/ddos_project/blob/main/app.py): `app.py`
- [CSV upload handler](https://github.com/vignesheilik/ddos_project/blob/main/app.py): `app.py`
- [Upload page](https://github.com/vignesheilik/ddos_project/blob/main/templates/index.html): `templates/index.html`
- [Prediction page](https://github.com/vignesheilik/ddos_project/blob/main/templates/result.html): `templates/result.html`

### Classification

- [Model training](https://github.com/vignesheilik/ddos_project/blob/main/app.py): `app.py`
- [Training dataset](https://github.com/vignesheilik/ddos_project/blob/main/test3.csv): `test3.csv`
- [Saved model](https://github.com/vignesheilik/ddos_project/blob/main/ddos_model.pkl): `ddos_model.pkl`
- [Prediction logic](https://github.com/vignesheilik/ddos_project/blob/main/app.py): `app.py`

### Other components

- **User**

## Connections

- User → Flask app: opens page (evidence: `app.py`)
- Flask app → Upload page: renders (evidence: `app.py`)
- User → CSV upload handler: uploads CSV (evidence: `app.py`)
- CSV upload handler → Prediction logic: processes file (evidence: `app.py`)
- Prediction logic → Prediction page: renders prediction (evidence: `app.py`)
- Flask app → Model training: trains if absent (evidence: `app.py`)
- Model training → Training dataset: reads (evidence: `app.py`)
- Model training → Saved model: saves (evidence: `app.py`)
- Prediction logic → Saved model: loads and predicts (evidence: `app.py`)
