# prajwalgn-35/phishguard-ai architecture

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

- Interactive diagram: https://gitdiagram.com/prajwalgn-35/phishguard-ai
- Repository: https://github.com/prajwalgn-35/phishguard-ai

## Overview

PhishGuard AI is a URL phishing classifier: a user submits a URL in the Streamlit app, which extracts six features, builds the model input, loads the Random Forest, and displays a Safe or Phishing result and the feature values. The README also documents an offline workflow from labeled data through feature engineering, model training, and evaluation of Decision Tree and Random Forest models. Those offline stages are documented but their implementation source is not present in the supplied excerpts, so directory paths identify the relevant areas. Relationships for those stages rely on the README; runtime calls are supported by app.py and feature_extraction.py.

Main entry points: [`app.py`](https://github.com/prajwalgn-35/phishguard-ai/blob/main/app.py) (Streamlit app), [`feature_extraction.py`](https://github.com/prajwalgn-35/phishguard-ai/blob/main/feature_extraction.py) (Feature extraction), [`models`](https://github.com/prajwalgn-35/phishguard-ai/tree/main/models) (Model training), [`models/random_forest.pkl`](https://github.com/prajwalgn-35/phishguard-ai/blob/main/models/random_forest.pkl) (Random Forest model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Prediction interface"]
  node_app["Streamlit app<br/>[app.py]"]
  node_result["Displayed result<br/>[app.py]"]
end

subgraph group_features["URL features"]
  node_extract["Feature extraction"]
end

subgraph group_dataset["Training data"]
  node_dataset_file[("Labeled URL data")]
  node_prep["Dataset preparation"]
end

subgraph group_training["Training and evaluation"]
  node_split["Train/test split"]
  node_training_process["Model training"]
  node_evaluation["Model evaluation<br/>[MODEL_REPORT.md]"]
end

subgraph group_models["Model artifacts"]
  node_decision_tree[("Decision Tree model<br/>[decision_tree.pkl]")]
  node_random_forest[("Random Forest model<br/>[random_forest.pkl]")]
end

node_user(("URL user"))

node_user -->|"submits URL"| node_app
node_app -->|"extracts features"| node_extract
node_extract -->|"returns features"| node_app
node_app -->|"loads and predicts"| node_random_forest
node_app -->|"displays prediction"| node_result
node_dataset_file -->|"prepares data"| node_prep
node_prep -->|"engineers features"| node_extract
node_extract -->|"supplies features"| node_split
node_split -->|"provides partitions"| node_training_process
node_training_process -->|"trains"| node_decision_tree
node_training_process -->|"trains"| node_random_forest
node_decision_tree -->|"evaluated in"| node_evaluation
node_random_forest -->|"evaluated in"| node_evaluation

click node_app "https://github.com/prajwalgn-35/phishguard-ai/blob/main/app.py"
click node_result "https://github.com/prajwalgn-35/phishguard-ai/blob/main/app.py"
click node_extract "https://github.com/prajwalgn-35/phishguard-ai/blob/main/feature_extraction.py"
click node_dataset_file "https://github.com/prajwalgn-35/phishguard-ai/blob/main/data/phishing_site_urls.csv"
click node_prep "https://github.com/prajwalgn-35/phishguard-ai/tree/main/data"
click node_split "https://github.com/prajwalgn-35/phishguard-ai/tree/main/models"
click node_training_process "https://github.com/prajwalgn-35/phishguard-ai/tree/main/models"
click node_evaluation "https://github.com/prajwalgn-35/phishguard-ai/blob/main/models/MODEL_REPORT.md"
click node_decision_tree "https://github.com/prajwalgn-35/phishguard-ai/blob/main/models/decision_tree.pkl"
click node_random_forest "https://github.com/prajwalgn-35/phishguard-ai/blob/main/models/random_forest.pkl"

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_result,node_user toneBlue
class node_extract toneAmber
class node_dataset_file,node_prep toneMint
class node_split,node_training_process,node_evaluation toneRose
class node_decision_tree,node_random_forest toneIndigo
```

## Components

### Prediction interface

- [Streamlit app](https://github.com/prajwalgn-35/phishguard-ai/blob/main/app.py): `app.py`
- [Displayed result](https://github.com/prajwalgn-35/phishguard-ai/blob/main/app.py): `app.py`

### URL features

- [Feature extraction](https://github.com/prajwalgn-35/phishguard-ai/blob/main/feature_extraction.py): `feature_extraction.py`

### Training data

- [Labeled URL data](https://github.com/prajwalgn-35/phishguard-ai/blob/main/data/phishing_site_urls.csv): `data/phishing_site_urls.csv`
- [Dataset preparation](https://github.com/prajwalgn-35/phishguard-ai/tree/main/data): `data`

### Training and evaluation

- [Train/test split](https://github.com/prajwalgn-35/phishguard-ai/tree/main/models): `models`
- [Model training](https://github.com/prajwalgn-35/phishguard-ai/tree/main/models): `models`
- [Model evaluation](https://github.com/prajwalgn-35/phishguard-ai/blob/main/models/MODEL_REPORT.md): `models/MODEL_REPORT.md`

### Model artifacts

- [Decision Tree model](https://github.com/prajwalgn-35/phishguard-ai/blob/main/models/decision_tree.pkl): `models/decision_tree.pkl`
- [Random Forest model](https://github.com/prajwalgn-35/phishguard-ai/blob/main/models/random_forest.pkl): `models/random_forest.pkl`

### Other components

- **URL user**

## Connections

- URL user → Streamlit app: submits URL (evidence: `README.md`)
- Streamlit app → Feature extraction: extracts features (evidence: `app.py`)
- Feature extraction → Streamlit app: returns features (evidence: `app.py`)
- Streamlit app → Random Forest model: loads and predicts (evidence: `app.py`)
- Streamlit app → Displayed result: displays prediction (evidence: `app.py`)
- Labeled URL data → Dataset preparation: prepares data (evidence: `README.md`)
- Dataset preparation → Feature extraction: engineers features (evidence: `README.md`)
- Feature extraction → Train/test split: supplies features (evidence: `README.md`)
- Train/test split → Model training: provides partitions (evidence: `README.md`)
- Model training → Decision Tree model: trains (evidence: `README.md`)
- Model training → Random Forest model: trains (evidence: `README.md`)
- Decision Tree model → Model evaluation: evaluated in (evidence: `README.md`)
- Random Forest model → Model evaluation: evaluated in (evidence: `README.md`)
