# ammufeezzz/securelink architecture

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

- Interactive diagram: https://gitdiagram.com/ammufeezzz/securelink
- Repository: https://github.com/ammufeezzz/securelink

## Overview

SecureLink’s user workflow is authenticate, submit a URL for phishing analysis, then either receive an explanation for a blocked link or a short code for a safe link. Redirects use a cache-first lookup and record click analytics asynchronously. Separately, a training pipeline ingests and validates data, transforms features, and trains the model used by inference. The README documents frontend capabilities and integrations not fully shown in the sampled source; those links are cited to the README rather than treated as inspected implementation details.

Main entry points: [`app/main.py`](https://github.com/ammufeezzz/securelink/blob/main/app/main.py) (FastAPI endpoints), [`networksecurity/components/model_trainer.py`](https://github.com/ammufeezzz/securelink/blob/main/networksecurity/components/model_trainer.py) (Model trainer), [`networksecurity/pipeline/training_pipeline.py`](https://github.com/ammufeezzz/securelink/blob/main/networksecurity/pipeline/training_pipeline.py) (Training orchestrator), [`frontend/src/App.jsx`](https://github.com/ammufeezzz/securelink/blob/main/frontend/src/App.jsx) (React app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_spa["React app<br/>[App.jsx]"]
  node_login["Login page<br/>[LoginPage.jsx]"]
  node_dashboard["Link dashboard<br/>[Dashboard.jsx]"]
  node_frontend_api["API client<br/>[api.js]"]
end

subgraph group_serving["API serving"]
  node_api["FastAPI endpoints<br/>[main.py]"]
  node_auth["JWT auth<br/>[main.py]"]
  node_link_storage[("Link and user storage<br/>[db.py]")]
  node_cache[("Redis cache and limits<br/>[cache.py]")]
  node_helpers["Encoding and security helpers<br/>[utils.py]"]
end

subgraph group_inference["Phishing detection"]
  node_extractor["URL feature extractor"]
  node_model_loader["Model loading utilities<br/>[utils.py]"]
end

subgraph group_training["Model training"]
  node_trainer_entry["Training entry point<br/>[main.py]"]
  node_pipeline["Training orchestrator"]
  node_ingestion["Data ingestion<br/>[data_ingestion.py]"]
  node_validation["Data validation<br/>[data_validation.py]"]
  node_transformation["Data transformation"]
  node_trainer["Model trainer<br/>[model_trainer.py]"]
  node_metrics["Classification metrics"]
  node_estimator["Model bundle<br/>[estimator.py]"]
end

node_browser(("User / browser"))
node_dataset_db[("Training MongoDB")]
node_tracking["MLflow / DagsHub"]

node_browser -->|"uses"| node_spa
node_spa -->|"routes to"| node_login
node_spa -->|"routes to"| node_dashboard
node_login -->|"requests auth"| node_frontend_api
node_dashboard -->|"requests links"| node_frontend_api
node_frontend_api -->|"calls API"| node_api
node_browser -->|"follows short link"| node_api
node_api -->|"checks identity"| node_auth
node_auth -->|"reads users"| node_link_storage
node_auth -->|"checks limits"| node_cache
node_api -->|"extracts features"| node_extractor
node_api -->|"loads model"| node_model_loader
node_api -->|"encodes and explains"| node_helpers
node_api -->|"reads and writes links"| node_link_storage
node_api -->|"reads and fills cache"| node_cache
node_api -->|"records click counts"| node_link_storage
node_trainer_entry -->|"runs pipeline"| node_pipeline
node_pipeline -->|"starts ingestion"| node_ingestion
node_pipeline -->|"starts validation"| node_validation
node_pipeline -->|"starts transformation"| node_transformation
node_pipeline -->|"starts training"| node_trainer
node_ingestion -->|"reads dataset"| node_dataset_db
node_validation -->|"validates artifacts"| node_ingestion
node_transformation -->|"transforms artifacts"| node_validation
node_trainer -->|"trains from artifacts"| node_transformation
node_trainer -->|"scores classifier"| node_metrics
node_trainer -->|"packages model"| node_estimator
node_trainer -->|"logs experiments"| node_tracking
node_trainer -->|"saves model"| node_model_loader

click node_spa "https://github.com/ammufeezzz/securelink/blob/main/frontend/src/App.jsx"
click node_login "https://github.com/ammufeezzz/securelink/blob/main/frontend/src/pages/LoginPage.jsx"
click node_dashboard "https://github.com/ammufeezzz/securelink/blob/main/frontend/src/pages/Dashboard.jsx"
click node_frontend_api "https://github.com/ammufeezzz/securelink/blob/main/frontend/src/api.js"
click node_api "https://github.com/ammufeezzz/securelink/blob/main/app/main.py"
click node_auth "https://github.com/ammufeezzz/securelink/blob/main/app/main.py"
click node_link_storage "https://github.com/ammufeezzz/securelink/blob/main/app/db.py"
click node_cache "https://github.com/ammufeezzz/securelink/blob/main/app/cache.py"
click node_helpers "https://github.com/ammufeezzz/securelink/blob/main/app/utils.py"
click node_extractor "https://github.com/ammufeezzz/securelink/blob/main/networksecurity/utils/ml_utils/model/feature_extractor.py"
click node_model_loader "https://github.com/ammufeezzz/securelink/blob/main/networksecurity/utils/main_utils/utils.py"
click node_trainer_entry "https://github.com/ammufeezzz/securelink/blob/main/main.py"
click node_pipeline "https://github.com/ammufeezzz/securelink/blob/main/networksecurity/pipeline/training_pipeline.py"
click node_ingestion "https://github.com/ammufeezzz/securelink/blob/main/networksecurity/components/data_ingestion.py"
click node_validation "https://github.com/ammufeezzz/securelink/blob/main/networksecurity/components/data_validation.py"
click node_transformation "https://github.com/ammufeezzz/securelink/blob/main/networksecurity/components/data_transformation.py"
click node_trainer "https://github.com/ammufeezzz/securelink/blob/main/networksecurity/components/model_trainer.py"
click node_metrics "https://github.com/ammufeezzz/securelink/blob/main/networksecurity/utils/ml_utils/metric/classification_metric.py"
click node_estimator "https://github.com/ammufeezzz/securelink/blob/main/networksecurity/utils/ml_utils/model/estimator.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_spa,node_login,node_dashboard,node_frontend_api,node_browser toneBlue
class node_api,node_auth,node_link_storage,node_cache,node_helpers,node_dataset_db toneAmber
class node_extractor,node_model_loader toneMint
class node_trainer_entry,node_pipeline,node_ingestion,node_validation,node_transformation,node_trainer,node_metrics,node_estimator toneRose
class node_tracking toneIndigo
```

## Components

### Web client

- [React app](https://github.com/ammufeezzz/securelink/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Login page](https://github.com/ammufeezzz/securelink/blob/main/frontend/src/pages/LoginPage.jsx): `frontend/src/pages/LoginPage.jsx`
- [Link dashboard](https://github.com/ammufeezzz/securelink/blob/main/frontend/src/pages/Dashboard.jsx): `frontend/src/pages/Dashboard.jsx`
- [API client](https://github.com/ammufeezzz/securelink/blob/main/frontend/src/api.js): `frontend/src/api.js`

### API serving

- [FastAPI endpoints](https://github.com/ammufeezzz/securelink/blob/main/app/main.py): `app/main.py`
- [JWT auth](https://github.com/ammufeezzz/securelink/blob/main/app/main.py): `app/main.py`
- [Link and user storage](https://github.com/ammufeezzz/securelink/blob/main/app/db.py): `app/db.py`
- [Redis cache and limits](https://github.com/ammufeezzz/securelink/blob/main/app/cache.py): `app/cache.py`
- [Encoding and security helpers](https://github.com/ammufeezzz/securelink/blob/main/app/utils.py): `app/utils.py`

### Phishing detection

- [URL feature extractor](https://github.com/ammufeezzz/securelink/blob/main/networksecurity/utils/ml_utils/model/feature_extractor.py): `networksecurity/utils/ml_utils/model/feature_extractor.py`
- [Model loading utilities](https://github.com/ammufeezzz/securelink/blob/main/networksecurity/utils/main_utils/utils.py): `networksecurity/utils/main_utils/utils.py`

### Model training

- [Training entry point](https://github.com/ammufeezzz/securelink/blob/main/main.py): `main.py`
- [Training orchestrator](https://github.com/ammufeezzz/securelink/blob/main/networksecurity/pipeline/training_pipeline.py): `networksecurity/pipeline/training_pipeline.py`
- [Data ingestion](https://github.com/ammufeezzz/securelink/blob/main/networksecurity/components/data_ingestion.py): `networksecurity/components/data_ingestion.py`
- [Data validation](https://github.com/ammufeezzz/securelink/blob/main/networksecurity/components/data_validation.py): `networksecurity/components/data_validation.py`
- [Data transformation](https://github.com/ammufeezzz/securelink/blob/main/networksecurity/components/data_transformation.py): `networksecurity/components/data_transformation.py`
- [Model trainer](https://github.com/ammufeezzz/securelink/blob/main/networksecurity/components/model_trainer.py): `networksecurity/components/model_trainer.py`
- [Classification metrics](https://github.com/ammufeezzz/securelink/blob/main/networksecurity/utils/ml_utils/metric/classification_metric.py): `networksecurity/utils/ml_utils/metric/classification_metric.py`
- [Model bundle](https://github.com/ammufeezzz/securelink/blob/main/networksecurity/utils/ml_utils/model/estimator.py): `networksecurity/utils/ml_utils/model/estimator.py`

### Other components

- **User / browser**
- **Training MongoDB**
- **MLflow / DagsHub**

## Connections

- User / browser → React app: uses
- React app → Login page: routes to (evidence: `frontend/src/App.jsx`)
- React app → Link dashboard: routes to (evidence: `frontend/src/App.jsx`)
- Login page → API client: requests auth (evidence: `frontend/src/pages/LoginPage.jsx`)
- Link dashboard → API client: requests links (evidence: `frontend/src/pages/Dashboard.jsx`)
- API client → FastAPI endpoints: calls API
- User / browser → FastAPI endpoints: follows short link
- FastAPI endpoints → JWT auth: checks identity (evidence: `app/main.py`)
- JWT auth → Link and user storage: reads users (evidence: `app/main.py`)
- JWT auth → Redis cache and limits: checks limits (evidence: `app/main.py`)
- FastAPI endpoints → URL feature extractor: extracts features (evidence: `app/main.py`)
- FastAPI endpoints → Model loading utilities: loads model (evidence: `app/main.py`)
- FastAPI endpoints → Encoding and security helpers: encodes and explains (evidence: `app/main.py`)
- FastAPI endpoints → Link and user storage: reads and writes links (evidence: `app/main.py`)
- FastAPI endpoints → Redis cache and limits: reads and fills cache (evidence: `app/main.py`)
- FastAPI endpoints → Link and user storage: records click counts (evidence: `app/main.py`)
- Training entry point → Training orchestrator: runs pipeline (evidence: `main.py`)
- Training orchestrator → Data ingestion: starts ingestion (evidence: `networksecurity/pipeline/training_pipeline.py`)
- Training orchestrator → Data validation: starts validation (evidence: `networksecurity/pipeline/training_pipeline.py`)
- Training orchestrator → Data transformation: starts transformation (evidence: `networksecurity/pipeline/training_pipeline.py`)
- Training orchestrator → Model trainer: starts training (evidence: `networksecurity/pipeline/training_pipeline.py`)
- Data ingestion → Training MongoDB: reads dataset (evidence: `networksecurity/components/data_ingestion.py`)
- Data validation → Data ingestion: validates artifacts
- Data transformation → Data validation: transforms artifacts
- Model trainer → Data transformation: trains from artifacts
- Model trainer → Classification metrics: scores classifier (evidence: `networksecurity/components/model_trainer.py`)
- Model trainer → Model bundle: packages model (evidence: `networksecurity/components/model_trainer.py`)
- Model trainer → MLflow / DagsHub: logs experiments (evidence: `networksecurity/components/model_trainer.py`)
- Model trainer → Model loading utilities: saves model (evidence: `networksecurity/components/model_trainer.py`)
