# lextesorero/phishingdetector architecture

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

- Interactive diagram: https://gitdiagram.com/lextesorero/phishingdetector
- Repository: https://github.com/lextesorero/phishingdetector

## Overview

This is a full-stack phishing URL detector. The primary workflow is a user submitting a URL in the React interface; the API delegates prediction to the backend-selected model, which extracts URL and domain features and returns a phishing probability for display. A separate Streamlit dashboard uses the same backend model logic. The README documents dataset-snapshot lookup behavior, but its implementation is absent from the supplied tree. Edges reflect shown calls or README-documented API behavior; unsampled integrations are not inferred.

Main entry points: [`backend/model.py`](https://github.com/lextesorero/phishingdetector/blob/main/backend/model.py) (Stacked ensemble), [`backend/features.py`](https://github.com/lextesorero/phishingdetector/blob/main/backend/features.py) (Feature extraction), [`frontend/src/App.jsx`](https://github.com/lextesorero/phishingdetector/blob/main/frontend/src/App.jsx) (App workflow), [`frontend/src/components/UrlForm.jsx`](https://github.com/lextesorero/phishingdetector/blob/main/frontend/src/components/UrlForm.jsx) (URL form)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["React interface"]
  node_url_form["URL form<br/>[UrlForm.jsx]"]
  node_app["App workflow<br/>[App.jsx]"]
  node_api_client["API client<br/>[api.js]"]
  node_result_card["Result display<br/>[ResultCard.jsx]"]
end

subgraph group_api["API and dashboard"]
  node_fastapi["FastAPI routes<br/>[main.py]"]
  node_streamlit["Streamlit dashboard<br/>[streamlit_app.py]"]
end

subgraph group_prediction["Prediction pipeline"]
  node_model["Model selection<br/>[model.py]"]
  node_baseline["Baseline model<br/>[model.py]"]
  node_ensemble["Stacked ensemble<br/>[model.py]"]
  node_xgb["XGBoost learner<br/>[model.py]"]
  node_random_forest["Random Forest learner<br/>[model.py]"]
  node_char_lr["Character TF-IDF LR<br/>[model.py]"]
  node_char_cnn["Character CNN<br/>[model.py]"]
  node_meta_learner["Meta learner<br/>[model.py]"]
  node_compat["XGBoost compatibility<br/>[xgb_compat.py]"]
end

subgraph group_signals["Feature signals"]
  node_feature_extractor["Feature extraction<br/>[features.py]"]
  node_dns["DNS resolver"]
  node_whois["WHOIS lookup"]
  node_rdap["RDAP fallback"]
end

node_user(("User"))

node_user -->|"enters URL"| node_url_form
node_url_form -->|"submits URL"| node_app
node_app -->|"checks URL"| node_api_client
node_api_client -->|"posts URL"| node_fastapi
node_fastapi -->|"loads and predicts"| node_model
node_model -->|"extracts features"| node_feature_extractor
node_feature_extractor -->|"queries records"| node_dns
node_feature_extractor -->|"requests domain age"| node_whois
node_feature_extractor -->|"falls back"| node_rdap
node_model -->|"predicts with"| node_baseline
node_model -->|"predicts with"| node_ensemble
node_ensemble -->|"scores features"| node_xgb
node_ensemble -->|"scores features"| node_random_forest
node_ensemble -->|"scores URL text"| node_char_lr
node_ensemble -->|"scores encoded text"| node_char_cnn
node_ensemble -->|"combines scores"| node_meta_learner
node_model -->|"installs shim"| node_compat
node_streamlit -->|"uses predictions"| node_model
node_app -->|"renders result"| node_result_card

click node_url_form "https://github.com/lextesorero/phishingdetector/blob/main/frontend/src/components/UrlForm.jsx"
click node_app "https://github.com/lextesorero/phishingdetector/blob/main/frontend/src/App.jsx"
click node_api_client "https://github.com/lextesorero/phishingdetector/blob/main/frontend/src/api.js"
click node_result_card "https://github.com/lextesorero/phishingdetector/blob/main/frontend/src/components/ResultCard.jsx"
click node_fastapi "https://github.com/lextesorero/phishingdetector/blob/main/backend/main.py"
click node_streamlit "https://github.com/lextesorero/phishingdetector/blob/main/backend/streamlit_app.py"
click node_model "https://github.com/lextesorero/phishingdetector/blob/main/backend/model.py"
click node_feature_extractor "https://github.com/lextesorero/phishingdetector/blob/main/backend/features.py"
click node_baseline "https://github.com/lextesorero/phishingdetector/blob/main/backend/model.py"
click node_ensemble "https://github.com/lextesorero/phishingdetector/blob/main/backend/model.py"
click node_xgb "https://github.com/lextesorero/phishingdetector/blob/main/backend/model.py"
click node_random_forest "https://github.com/lextesorero/phishingdetector/blob/main/backend/model.py"
click node_char_lr "https://github.com/lextesorero/phishingdetector/blob/main/backend/model.py"
click node_char_cnn "https://github.com/lextesorero/phishingdetector/blob/main/backend/model.py"
click node_meta_learner "https://github.com/lextesorero/phishingdetector/blob/main/backend/model.py"
click node_compat "https://github.com/lextesorero/phishingdetector/blob/main/backend/xgb_compat.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_url_form,node_app,node_api_client,node_result_card,node_user toneBlue
class node_fastapi,node_streamlit toneAmber
class node_model,node_baseline,node_ensemble,node_xgb,node_random_forest,node_char_lr,node_char_cnn,node_meta_learner,node_compat toneMint
class node_feature_extractor,node_dns,node_whois,node_rdap toneRose
```

## Components

### React interface

- [URL form](https://github.com/lextesorero/phishingdetector/blob/main/frontend/src/components/UrlForm.jsx): `frontend/src/components/UrlForm.jsx`
- [App workflow](https://github.com/lextesorero/phishingdetector/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [API client](https://github.com/lextesorero/phishingdetector/blob/main/frontend/src/api.js): `frontend/src/api.js`
- [Result display](https://github.com/lextesorero/phishingdetector/blob/main/frontend/src/components/ResultCard.jsx): `frontend/src/components/ResultCard.jsx`

### API and dashboard

- [FastAPI routes](https://github.com/lextesorero/phishingdetector/blob/main/backend/main.py): `backend/main.py`
- [Streamlit dashboard](https://github.com/lextesorero/phishingdetector/blob/main/backend/streamlit_app.py): `backend/streamlit_app.py`

### Prediction pipeline

- [Model selection](https://github.com/lextesorero/phishingdetector/blob/main/backend/model.py): `backend/model.py`
- [Baseline model](https://github.com/lextesorero/phishingdetector/blob/main/backend/model.py): `backend/model.py`
- [Stacked ensemble](https://github.com/lextesorero/phishingdetector/blob/main/backend/model.py): `backend/model.py`
- [XGBoost learner](https://github.com/lextesorero/phishingdetector/blob/main/backend/model.py): `backend/model.py`
- [Random Forest learner](https://github.com/lextesorero/phishingdetector/blob/main/backend/model.py): `backend/model.py`
- [Character TF-IDF LR](https://github.com/lextesorero/phishingdetector/blob/main/backend/model.py): `backend/model.py`
- [Character CNN](https://github.com/lextesorero/phishingdetector/blob/main/backend/model.py): `backend/model.py`
- [Meta learner](https://github.com/lextesorero/phishingdetector/blob/main/backend/model.py): `backend/model.py`
- [XGBoost compatibility](https://github.com/lextesorero/phishingdetector/blob/main/backend/xgb_compat.py): `backend/xgb_compat.py`

### Feature signals

- [Feature extraction](https://github.com/lextesorero/phishingdetector/blob/main/backend/features.py): `backend/features.py`
- **DNS resolver**
- **WHOIS lookup**
- **RDAP fallback**

### Other components

- **User**

## Connections

- User → URL form: enters URL (evidence: `frontend/src/components/UrlForm.jsx`)
- URL form → App workflow: submits URL (evidence: `frontend/src/App.jsx`)
- App workflow → API client: checks URL (evidence: `frontend/src/App.jsx`)
- API client → FastAPI routes: posts URL (evidence: `README.md`)
- FastAPI routes → Model selection: loads and predicts (evidence: `backend/main.py`)
- Model selection → Feature extraction: extracts features (evidence: `backend/model.py`)
- Feature extraction → DNS resolver: queries records (evidence: `backend/features.py`)
- Feature extraction → WHOIS lookup: requests domain age (evidence: `backend/features.py`)
- Feature extraction → RDAP fallback: falls back (evidence: `backend/features.py`)
- Model selection → Baseline model: predicts with (evidence: `backend/model.py`)
- Model selection → Stacked ensemble: predicts with (evidence: `backend/model.py`)
- Stacked ensemble → XGBoost learner: scores features (evidence: `backend/model.py`)
- Stacked ensemble → Random Forest learner: scores features (evidence: `backend/model.py`)
- Stacked ensemble → Character TF-IDF LR: scores URL text (evidence: `backend/model.py`)
- Stacked ensemble → Character CNN: scores encoded text (evidence: `backend/model.py`)
- Stacked ensemble → Meta learner: combines scores (evidence: `backend/model.py`)
- Model selection → XGBoost compatibility: installs shim (evidence: `backend/model.py`)
- Streamlit dashboard → Model selection: uses predictions (evidence: `README.md`)
- App workflow → Result display: renders result (evidence: `frontend/src/App.jsx`)
