# alfiashk/adaptive-phising-url-detector architecture

> Architecture diagram of the GitHub repository alfiashk/adaptive-phising-url-detector, 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/alfiashk/adaptive-phising-url-detector
- Repository: https://github.com/alfiashk/adaptive-phising-url-detector

## Overview

This is an adaptive phishing-URL detector with a React interface and FastAPI backend. Users submit a URL for feature-based model scoring plus bounded website inspection, then see a label, confidence, risk signals, and inspection checks. An admin can submit a verified label; the backend records it, retrains on the dataset plus feedback, and reloads the model. The API routes and backend calls are visible in the excerpts; the scan request from the UI is only partially shown, so that edge is marked unverified.

Main entry points: [`backend/predict.py`](https://github.com/alfiashk/adaptive-phising-url-detector/blob/main/backend/predict.py) (Prediction orchestration), [`backend/train.py`](https://github.com/alfiashk/adaptive-phising-url-detector/blob/main/backend/train.py) (Model training), [`backend/feedback.py`](https://github.com/alfiashk/adaptive-phising-url-detector/blob/main/backend/feedback.py) (Feedback recording), [`frontend/src/App.jsx`](https://github.com/alfiashk/adaptive-phising-url-detector/blob/main/frontend/src/App.jsx) (Scanner and feedback UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["User interface"]
  node_app["Scanner and feedback UI<br/>[App.jsx]"]
  node_bootstrap["React entry<br/>[main.jsx]"]
end

subgraph group_api["API orchestration"]
  node_service["FastAPI routes<br/>[main.py]"]
end

subgraph group_analysis["URL analysis"]
  node_predict["Prediction orchestration<br/>[predict.py]"]
  node_features["URL feature extraction"]
  node_inspection["Website inspection<br/>[web_inspector.py]"]
  node_constants["Model schema and labels<br/>[constants.py]"]
end

subgraph group_learning["Model learning"]
  node_model[("Trained classifier<br/>[phishing_model.pkl]")]
  node_feedback_csv[("Verified feedback records")]
  node_feedback["Feedback recording<br/>[feedback.py]"]
  node_trainer["Model training<br/>[train.py]"]
  node_dataset[("Phishing URL dataset")]
end

node_user(("URL submitter"))

node_user -->|"submits URL"| node_app
node_bootstrap -->|"renders"| node_app
node_app -.->|"requests scan"| node_service
node_app -->|"posts feedback"| node_service
node_service -->|"routes prediction"| node_predict
node_service -->|"routes feedback"| node_feedback
node_predict -->|"extracts features"| node_features
node_predict -->|"inspects URL"| node_inspection
node_predict -->|"uses schema"| node_constants
node_predict -->|"loads and scores"| node_model
node_predict -->|"reads labels"| node_feedback_csv
node_feedback -->|"appends labels"| node_feedback_csv
node_feedback -->|"triggers training"| node_trainer
node_feedback -->|"reloads model"| node_predict
node_trainer -->|"reads training data"| node_dataset
node_trainer -->|"reads feedback"| node_feedback_csv
node_trainer -->|"extracts features"| node_features
node_trainer -->|"uses schema"| node_constants
node_trainer -->|"writes classifier"| node_model

click node_app "https://github.com/alfiashk/adaptive-phising-url-detector/blob/main/frontend/src/App.jsx"
click node_bootstrap "https://github.com/alfiashk/adaptive-phising-url-detector/blob/main/frontend/src/main.jsx"
click node_service "https://github.com/alfiashk/adaptive-phising-url-detector/blob/main/backend/main.py"
click node_predict "https://github.com/alfiashk/adaptive-phising-url-detector/blob/main/backend/predict.py"
click node_features "https://github.com/alfiashk/adaptive-phising-url-detector/blob/main/backend/feature_extractor.py"
click node_inspection "https://github.com/alfiashk/adaptive-phising-url-detector/blob/main/backend/web_inspector.py"
click node_constants "https://github.com/alfiashk/adaptive-phising-url-detector/blob/main/backend/constants.py"
click node_model "https://github.com/alfiashk/adaptive-phising-url-detector/blob/main/model/phishing_model.pkl"
click node_feedback_csv "https://github.com/alfiashk/adaptive-phising-url-detector/tree/main/model"
click node_feedback "https://github.com/alfiashk/adaptive-phising-url-detector/blob/main/backend/feedback.py"
click node_trainer "https://github.com/alfiashk/adaptive-phising-url-detector/blob/main/backend/train.py"
click node_dataset "https://github.com/alfiashk/adaptive-phising-url-detector/blob/main/dataset/PhiUSIIL_Phishing_URL_Dataset.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_app,node_bootstrap toneBlue
class node_service toneAmber
class node_predict,node_features,node_inspection,node_constants toneMint
class node_model,node_feedback_csv,node_feedback,node_trainer,node_dataset toneRose
class node_user toneIndigo
```

## Components

### User interface

- [Scanner and feedback UI](https://github.com/alfiashk/adaptive-phising-url-detector/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [React entry](https://github.com/alfiashk/adaptive-phising-url-detector/blob/main/frontend/src/main.jsx): `frontend/src/main.jsx`

### API orchestration

- [FastAPI routes](https://github.com/alfiashk/adaptive-phising-url-detector/blob/main/backend/main.py): `backend/main.py`

### URL analysis

- [Prediction orchestration](https://github.com/alfiashk/adaptive-phising-url-detector/blob/main/backend/predict.py): `backend/predict.py`
- [URL feature extraction](https://github.com/alfiashk/adaptive-phising-url-detector/blob/main/backend/feature_extractor.py): `backend/feature_extractor.py`
- [Website inspection](https://github.com/alfiashk/adaptive-phising-url-detector/blob/main/backend/web_inspector.py): `backend/web_inspector.py`
- [Model schema and labels](https://github.com/alfiashk/adaptive-phising-url-detector/blob/main/backend/constants.py): `backend/constants.py`

### Model learning

- [Trained classifier](https://github.com/alfiashk/adaptive-phising-url-detector/blob/main/model/phishing_model.pkl): `model/phishing_model.pkl`
- [Verified feedback records](https://github.com/alfiashk/adaptive-phising-url-detector/tree/main/model): `model`
- [Feedback recording](https://github.com/alfiashk/adaptive-phising-url-detector/blob/main/backend/feedback.py): `backend/feedback.py`
- [Model training](https://github.com/alfiashk/adaptive-phising-url-detector/blob/main/backend/train.py): `backend/train.py`
- [Phishing URL dataset](https://github.com/alfiashk/adaptive-phising-url-detector/blob/main/dataset/PhiUSIIL_Phishing_URL_Dataset.csv): `dataset/PhiUSIIL_Phishing_URL_Dataset.csv`

### Other components

- **URL submitter**

## Connections

- URL submitter → Scanner and feedback UI: submits URL (evidence: `frontend/src/App.jsx`)
- React entry → Scanner and feedback UI: renders (evidence: `frontend/src/main.jsx`)
- Scanner and feedback UI → FastAPI routes: requests scan
- Scanner and feedback UI → FastAPI routes: posts feedback (evidence: `frontend/src/App.jsx`)
- FastAPI routes → Prediction orchestration: routes prediction (evidence: `backend/main.py`)
- FastAPI routes → Feedback recording: routes feedback (evidence: `backend/main.py`)
- Prediction orchestration → URL feature extraction: extracts features (evidence: `backend/predict.py`)
- Prediction orchestration → Website inspection: inspects URL (evidence: `backend/predict.py`)
- Prediction orchestration → Model schema and labels: uses schema (evidence: `backend/predict.py`)
- Prediction orchestration → Trained classifier: loads and scores (evidence: `backend/predict.py`)
- Prediction orchestration → Verified feedback records: reads labels (evidence: `backend/predict.py`)
- Feedback recording → Verified feedback records: appends labels (evidence: `backend/feedback.py`)
- Feedback recording → Model training: triggers training (evidence: `backend/feedback.py`)
- Feedback recording → Prediction orchestration: reloads model (evidence: `backend/feedback.py`)
- Model training → Phishing URL dataset: reads training data (evidence: `backend/train.py`)
- Model training → Verified feedback records: reads feedback (evidence: `backend/train.py`)
- Model training → URL feature extraction: extracts features (evidence: `backend/train.py`)
- Model training → Model schema and labels: uses schema (evidence: `backend/train.py`)
- Model training → Trained classifier: writes classifier (evidence: `backend/train.py`)
