# danny777-glitch/phishing-email-detection architecture

> Architecture diagram of the GitHub repository danny777-glitch/phishing-email-detection, 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/danny777-glitch/phishing-email-detection
- Repository: https://github.com/danny777-glitch/phishing-email-detection

## Overview

PhishGuard AI is a Streamlit phishing-email detection app backed by a scikit-learn model. Users can scan one email or upload datasets for batch predictions and CSV export; a separate training script builds and serializes the model. The app excerpt shows model loading, feature preparation, and evaluation-matrix code, while batch processing and some scan-result details are documented but partly unsampled.

Main entry points: [`app.py`](https://github.com/danny777-glitch/phishing-email-detection/blob/main/app.py) (Streamlit workspace), [`phishing_detector.pkl`](https://github.com/danny777-glitch/phishing-email-detection/blob/main/phishing_detector.pkl) (Serialized detector), [`train.py`](https://github.com/danny777-glitch/phishing-email-detection/blob/main/train.py) (Training script), [`phishing_dataset.xlsx`](https://github.com/danny777-glitch/phishing-email-detection/blob/main/phishing_dataset.xlsx) (Email dataset)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_product["Detection App"]
  node_app["Streamlit workspace<br/>[app.py]"]
  node_single["Email scanner<br/>[app.py]"]
  node_batch["Batch processor<br/>[app.py]"]
  node_evaluation["Confusion matrix<br/>[app.py]"]
end

subgraph group_ml["Model Lifecycle"]
  node_training["Training script<br/>[train.py]"]
  node_features["Feature pipeline<br/>[train.py]"]
  node_classifier["Naive Bayes model<br/>[train.py]"]
  node_artifact["Serialized detector"]
end

subgraph group_data["Inputs and Reports"]
  node_dataset["Email dataset"]
  node_report["CSV audit report"]
end

node_user(("Email analyst"))

node_user -->|"uses"| node_app
node_app -->|"opens scanner"| node_single
node_app -->|"opens batch"| node_batch
node_app -->|"shows evaluation"| node_evaluation
node_training -->|"reads"| node_dataset
node_training -->|"configures"| node_features
node_features -->|"feeds features"| node_classifier
node_training -->|"serializes"| node_artifact
node_app -->|"loads"| node_artifact
node_single -->|"predicts with"| node_artifact
node_batch -->|"predicts with"| node_artifact
node_batch -->|"exports"| node_report
node_evaluation -->|"evaluates labels"| node_dataset

click node_app "https://github.com/danny777-glitch/phishing-email-detection/blob/main/app.py"
click node_single "https://github.com/danny777-glitch/phishing-email-detection/blob/main/app.py"
click node_batch "https://github.com/danny777-glitch/phishing-email-detection/blob/main/app.py"
click node_evaluation "https://github.com/danny777-glitch/phishing-email-detection/blob/main/app.py"
click node_training "https://github.com/danny777-glitch/phishing-email-detection/blob/main/train.py"
click node_features "https://github.com/danny777-glitch/phishing-email-detection/blob/main/train.py"
click node_classifier "https://github.com/danny777-glitch/phishing-email-detection/blob/main/train.py"
click node_artifact "https://github.com/danny777-glitch/phishing-email-detection/blob/main/phishing_detector.pkl"
click node_dataset "https://github.com/danny777-glitch/phishing-email-detection/blob/main/phishing_dataset.xlsx"

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_app,node_single,node_batch,node_evaluation toneBlue
class node_training,node_features,node_classifier,node_artifact toneAmber
class node_dataset,node_report toneMint
class node_user toneIndigo
```

## Components

### Detection App

- [Streamlit workspace](https://github.com/danny777-glitch/phishing-email-detection/blob/main/app.py): `app.py`
- [Email scanner](https://github.com/danny777-glitch/phishing-email-detection/blob/main/app.py): `app.py`
- [Batch processor](https://github.com/danny777-glitch/phishing-email-detection/blob/main/app.py): `app.py`
- [Confusion matrix](https://github.com/danny777-glitch/phishing-email-detection/blob/main/app.py): `app.py`

### Model Lifecycle

- [Training script](https://github.com/danny777-glitch/phishing-email-detection/blob/main/train.py): `train.py`
- [Feature pipeline](https://github.com/danny777-glitch/phishing-email-detection/blob/main/train.py): `train.py`
- [Naive Bayes model](https://github.com/danny777-glitch/phishing-email-detection/blob/main/train.py): `train.py`
- [Serialized detector](https://github.com/danny777-glitch/phishing-email-detection/blob/main/phishing_detector.pkl): `phishing_detector.pkl`

### Inputs and Reports

- [Email dataset](https://github.com/danny777-glitch/phishing-email-detection/blob/main/phishing_dataset.xlsx): `phishing_dataset.xlsx`
- **CSV audit report**

### Other components

- **Email analyst**

## Connections

- Email analyst → Streamlit workspace: uses (evidence: `README.md`)
- Streamlit workspace → Email scanner: opens scanner (evidence: `README.md`)
- Streamlit workspace → Batch processor: opens batch (evidence: `README.md`)
- Streamlit workspace → Confusion matrix: shows evaluation (evidence: `app.py`)
- Training script → Email dataset: reads (evidence: `train.py`)
- Training script → Feature pipeline: configures (evidence: `train.py`)
- Feature pipeline → Naive Bayes model: feeds features (evidence: `train.py`)
- Training script → Serialized detector: serializes (evidence: `train.py`)
- Streamlit workspace → Serialized detector: loads (evidence: `app.py`)
- Email scanner → Serialized detector: predicts with (evidence: `README.md`)
- Batch processor → Serialized detector: predicts with (evidence: `README.md`)
- Batch processor → CSV audit report: exports (evidence: `README.md`)
- Confusion matrix → Email dataset: evaluates labels (evidence: `app.py`)
