# nathesh6/develop-an-ai-system-to-identify-and-block-phishing-emails architecture

> Architecture diagram of the GitHub repository nathesh6/develop-an-ai-system-to-identify-and-block-phishing-emails, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nathesh6/develop-an-ai-system-to-identify-and-block-phishing-emails
- Repository: https://github.com/nathesh6/develop-an-ai-system-to-identify-and-block-phishing-emails

## Overview

This is a Flask phishing-email classifier. The user opens the home page, submits email text at the scanner, and receives a phishing-or-safe result. Separately, the training script reads spam.csv, creates TF-IDF features, trains XGBoost, and saves a model/vectorizer bundle; app.py loads that bundle for inference. The README describes additional algorithms, metadata features, evaluation, and email-system deployment, but the supplied source does not show their implementation, so they are not represented as runtime components. The model bundle is referenced by code but is absent from the file tree.

Main entry points: [`app.py`](https://github.com/nathesh6/develop-an-ai-system-to-identify-and-block-phishing-emails/blob/main/app.py) (Flask routes), [`train_model.py`](https://github.com/nathesh6/develop-an-ai-system-to-identify-and-block-phishing-emails/blob/main/train_model.py) (Model training), [`templates/home.html`](https://github.com/nathesh6/develop-an-ai-system-to-identify-and-block-phishing-emails/blob/main/templates/home.html) (Home page), [`templates/index.html`](https://github.com/nathesh6/develop-an-ai-system-to-identify-and-block-phishing-emails/blob/main/templates/index.html) (Scanner page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web scanning"]
  node_flask["Flask routes<br/>[app.py]"]
  node_home["Home page<br/>[home.html]"]
  node_scanner["Scanner page<br/>[index.html]"]
  node_inference["Email classification<br/>[app.py]"]
end

subgraph group_model["Model training"]
  node_training["Model training<br/>[train_model.py]"]
  node_dataset[("Training dataset<br/>[spam.csv]")]
end

node_user(("Email user"))

node_user -->|"submits email"| node_flask
node_flask -->|"renders"| node_home
node_flask -->|"renders"| node_scanner
node_flask -->|"routes scan"| node_inference
node_inference -->|"returns result"| node_user
node_training -->|"reads"| node_dataset

click node_flask "https://github.com/nathesh6/develop-an-ai-system-to-identify-and-block-phishing-emails/blob/main/app.py"
click node_home "https://github.com/nathesh6/develop-an-ai-system-to-identify-and-block-phishing-emails/blob/main/templates/home.html"
click node_scanner "https://github.com/nathesh6/develop-an-ai-system-to-identify-and-block-phishing-emails/blob/main/templates/index.html"
click node_inference "https://github.com/nathesh6/develop-an-ai-system-to-identify-and-block-phishing-emails/blob/main/app.py"
click node_training "https://github.com/nathesh6/develop-an-ai-system-to-identify-and-block-phishing-emails/blob/main/train_model.py"
click node_dataset "https://github.com/nathesh6/develop-an-ai-system-to-identify-and-block-phishing-emails/blob/main/spam.csv"

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_home,node_scanner,node_inference,node_user toneBlue
class node_training,node_dataset toneAmber
```

## Components

### Web scanning

- [Flask routes](https://github.com/nathesh6/develop-an-ai-system-to-identify-and-block-phishing-emails/blob/main/app.py): `app.py`
- [Home page](https://github.com/nathesh6/develop-an-ai-system-to-identify-and-block-phishing-emails/blob/main/templates/home.html): `templates/home.html`
- [Scanner page](https://github.com/nathesh6/develop-an-ai-system-to-identify-and-block-phishing-emails/blob/main/templates/index.html): `templates/index.html`
- [Email classification](https://github.com/nathesh6/develop-an-ai-system-to-identify-and-block-phishing-emails/blob/main/app.py): `app.py`

### Model training

- [Model training](https://github.com/nathesh6/develop-an-ai-system-to-identify-and-block-phishing-emails/blob/main/train_model.py): `train_model.py`
- [Training dataset](https://github.com/nathesh6/develop-an-ai-system-to-identify-and-block-phishing-emails/blob/main/spam.csv): `spam.csv`

### Other components

- **Email user**

## Connections

- Email user → Flask routes: submits email (evidence: `README.md`)
- Flask routes → Home page: renders (evidence: `app.py`)
- Flask routes → Scanner page: renders (evidence: `app.py`)
- Flask routes → Email classification: routes scan (evidence: `app.py`)
- Email classification → Email user: returns result (evidence: `app.py`)
- Model training → Training dataset: reads (evidence: `train_model.py`)
