# makwana23-harshil/final-cyber-sentinel architecture

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

- Interactive diagram: https://gitdiagram.com/makwana23-harshil/final-cyber-sentinel
- Repository: https://github.com/makwana23-harshil/final-cyber-sentinel

## Overview

CyberSentinel Pro is a web cybersecurity scanner with user and administrator workflows. Users register or log in, submit SMS, email-address, email-body, or URL scans, and review saved results and history; administrators manage users and platform-wide scan analytics. The Flask app registers the API blueprints, while detection routes dispatch to specialized analyzers and persist scan records. The README documents deeper link checks and optional external threat/AI services. Some frontend-to-backend wiring and unsampled route details are not visible in the excerpts, so those relationships are limited to documented behavior.

Main entry points: [`frontend/js/api.js`](https://github.com/makwana23-harshil/final-cyber-sentinel/blob/main/frontend/js/api.js) (Frontend API Client), [`backend/api/detection_routes.py`](https://github.com/makwana23-harshil/final-cyber-sentinel/blob/main/backend/api/detection_routes.py) (Detection API), [`backend/auth/middleware.py`](https://github.com/makwana23-harshil/final-cyber-sentinel/blob/main/backend/auth/middleware.py) (Token Middleware), [`backend/database.py`](https://github.com/makwana23-harshil/final-cyber-sentinel/blob/main/backend/database.py) (MongoDB)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web Client"]
  node_scan_ui["Scan Interface<br/>[scan.js]"]
  node_auth_ui["Authentication UI<br/>[auth.js]"]
  node_api_client["Frontend API Client<br/>[api.js]"]
  node_dashboard_ui["User Dashboard<br/>[dashboard.js]"]
  node_history_ui["Scan History<br/>[history.js]"]
  node_admin_ui["Admin Dashboard<br/>[admin.js]"]
end

subgraph group_runtime["API Runtime"]
  node_app["Flask Application<br/>[app.py]"]
  node_detection_api["Detection API"]
  node_database[("MongoDB<br/>[database.py]")]
end

subgraph group_identity["Identity &amp; Accounts"]
  node_auth_routes["Authentication Routes<br/>[routes.py]"]
  node_auth_middleware["Token Middleware<br/>[middleware.py]"]
end

subgraph group_detection["Threat Detection"]
  node_sms_detector["SMS Analysis<br/>[sms_detector.py]"]
  node_email_detector["Email Analysis<br/>[email_detector.py]"]
  node_url_detector["URL Analysis<br/>[url_detector.py]"]
  node_url_features["URL Feature Extraction<br/>[features.py]"]
  node_link_inspector["Deep Link Inspection<br/>[link_inspector.py]"]
  node_llm_inspector["AI Link Analysis<br/>[llm_inspector.py]"]
end

subgraph group_insights["History &amp; Administration"]
  node_user_api["User Data API<br/>[user_routes.py]"]
  node_admin_api["Admin API<br/>[admin_routes.py]"]
end

node_user(("User"))
node_admin(("Administrator"))

node_user -->|"registers or logs in"| node_auth_ui
node_user -->|"submits scans"| node_scan_ui
node_admin -->|"manages platform"| node_admin_ui
node_scan_ui -.->|"uses API"| node_api_client
node_api_client -.->|"sends scan requests"| node_detection_api
node_auth_ui -.->|"uses API"| node_api_client
node_api_client -->|"sends auth requests"| node_auth_routes
node_app -->|"registers"| node_auth_routes
node_app -->|"registers"| node_detection_api
node_app -->|"registers"| node_user_api
node_app -->|"registers"| node_admin_api
node_auth_routes -->|"uses token functions"| node_auth_middleware
node_auth_routes -->|"reads and writes accounts"| node_database
node_auth_middleware -->|"loads users"| node_database
node_detection_api -->|"requires user token"| node_auth_middleware
node_detection_api -->|"dispatches SMS scans"| node_sms_detector
node_detection_api -->|"dispatches email scans"| node_email_detector
node_detection_api -->|"dispatches URL scans"| node_url_detector
node_detection_api -->|"analyzes email address"| node_llm_inspector
node_detection_api -->|"saves scan results"| node_database
node_sms_detector -->|"inspects extracted links"| node_link_inspector
node_email_detector -->|"inspects email links"| node_link_inspector
node_email_detector -->|"requests AI analysis"| node_llm_inspector
node_url_detector -->|"deep-inspects URL"| node_link_inspector
node_url_detector -->|"extracts features"| node_url_features
node_link_inspector -->|"uses AI findings"| node_llm_inspector
node_dashboard_ui -.->|"loads dashboard data"| node_api_client
node_history_ui -.->|"loads scan history"| node_api_client
node_admin_ui -.->|"loads admin data"| node_api_client
node_api_client -.->|"requests user history"| node_user_api
node_api_client -.->|"requests admin data"| node_admin_api
node_user_api -->|"requires user token"| node_auth_middleware
node_user_api -->|"queries scan history"| node_database
node_admin_api -->|"requires admin token"| node_auth_middleware
node_admin_api -->|"manages users and scans"| node_database

click node_scan_ui "https://github.com/makwana23-harshil/final-cyber-sentinel/blob/main/frontend/js/scan.js"
click node_auth_ui "https://github.com/makwana23-harshil/final-cyber-sentinel/blob/main/frontend/js/auth.js"
click node_api_client "https://github.com/makwana23-harshil/final-cyber-sentinel/blob/main/frontend/js/api.js"
click node_dashboard_ui "https://github.com/makwana23-harshil/final-cyber-sentinel/blob/main/frontend/js/dashboard.js"
click node_history_ui "https://github.com/makwana23-harshil/final-cyber-sentinel/blob/main/frontend/js/history.js"
click node_admin_ui "https://github.com/makwana23-harshil/final-cyber-sentinel/blob/main/frontend/js/admin.js"
click node_app "https://github.com/makwana23-harshil/final-cyber-sentinel/blob/main/backend/app.py"
click node_auth_routes "https://github.com/makwana23-harshil/final-cyber-sentinel/blob/main/backend/auth/routes.py"
click node_auth_middleware "https://github.com/makwana23-harshil/final-cyber-sentinel/blob/main/backend/auth/middleware.py"
click node_detection_api "https://github.com/makwana23-harshil/final-cyber-sentinel/blob/main/backend/api/detection_routes.py"
click node_sms_detector "https://github.com/makwana23-harshil/final-cyber-sentinel/blob/main/backend/detection/sms/sms_detector.py"
click node_email_detector "https://github.com/makwana23-harshil/final-cyber-sentinel/blob/main/backend/detection/email/email_detector.py"
click node_url_detector "https://github.com/makwana23-harshil/final-cyber-sentinel/blob/main/backend/detection/url/url_detector.py"
click node_url_features "https://github.com/makwana23-harshil/final-cyber-sentinel/blob/main/backend/detection/url/features.py"
click node_link_inspector "https://github.com/makwana23-harshil/final-cyber-sentinel/blob/main/backend/detection/link/link_inspector.py"
click node_llm_inspector "https://github.com/makwana23-harshil/final-cyber-sentinel/blob/main/backend/detection/link/llm_inspector.py"
click node_user_api "https://github.com/makwana23-harshil/final-cyber-sentinel/blob/main/backend/api/user_routes.py"
click node_admin_api "https://github.com/makwana23-harshil/final-cyber-sentinel/blob/main/backend/api/admin_routes.py"
click node_database "https://github.com/makwana23-harshil/final-cyber-sentinel/blob/main/backend/database.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_scan_ui,node_auth_ui,node_api_client,node_dashboard_ui,node_history_ui,node_admin_ui,node_user toneBlue
class node_app,node_detection_api,node_database toneAmber
class node_auth_routes,node_auth_middleware toneMint
class node_sms_detector,node_email_detector,node_url_detector,node_url_features,node_link_inspector,node_llm_inspector toneRose
class node_user_api,node_admin_api,node_admin toneIndigo
```

## Components

### Web Client

- [Scan Interface](https://github.com/makwana23-harshil/final-cyber-sentinel/blob/main/frontend/js/scan.js): `frontend/js/scan.js`
- [Authentication UI](https://github.com/makwana23-harshil/final-cyber-sentinel/blob/main/frontend/js/auth.js): `frontend/js/auth.js`
- [Frontend API Client](https://github.com/makwana23-harshil/final-cyber-sentinel/blob/main/frontend/js/api.js): `frontend/js/api.js`
- [User Dashboard](https://github.com/makwana23-harshil/final-cyber-sentinel/blob/main/frontend/js/dashboard.js): `frontend/js/dashboard.js`
- [Scan History](https://github.com/makwana23-harshil/final-cyber-sentinel/blob/main/frontend/js/history.js): `frontend/js/history.js`
- [Admin Dashboard](https://github.com/makwana23-harshil/final-cyber-sentinel/blob/main/frontend/js/admin.js): `frontend/js/admin.js`

### API Runtime

- [Flask Application](https://github.com/makwana23-harshil/final-cyber-sentinel/blob/main/backend/app.py): `backend/app.py`
- [Detection API](https://github.com/makwana23-harshil/final-cyber-sentinel/blob/main/backend/api/detection_routes.py): `backend/api/detection_routes.py`
- [MongoDB](https://github.com/makwana23-harshil/final-cyber-sentinel/blob/main/backend/database.py): `backend/database.py`

### Identity & Accounts

- [Authentication Routes](https://github.com/makwana23-harshil/final-cyber-sentinel/blob/main/backend/auth/routes.py): `backend/auth/routes.py`
- [Token Middleware](https://github.com/makwana23-harshil/final-cyber-sentinel/blob/main/backend/auth/middleware.py): `backend/auth/middleware.py`

### Threat Detection

- [SMS Analysis](https://github.com/makwana23-harshil/final-cyber-sentinel/blob/main/backend/detection/sms/sms_detector.py): `backend/detection/sms/sms_detector.py`
- [Email Analysis](https://github.com/makwana23-harshil/final-cyber-sentinel/blob/main/backend/detection/email/email_detector.py): `backend/detection/email/email_detector.py`
- [URL Analysis](https://github.com/makwana23-harshil/final-cyber-sentinel/blob/main/backend/detection/url/url_detector.py): `backend/detection/url/url_detector.py`
- [URL Feature Extraction](https://github.com/makwana23-harshil/final-cyber-sentinel/blob/main/backend/detection/url/features.py): `backend/detection/url/features.py`
- [Deep Link Inspection](https://github.com/makwana23-harshil/final-cyber-sentinel/blob/main/backend/detection/link/link_inspector.py): `backend/detection/link/link_inspector.py`
- [AI Link Analysis](https://github.com/makwana23-harshil/final-cyber-sentinel/blob/main/backend/detection/link/llm_inspector.py): `backend/detection/link/llm_inspector.py`

### History & Administration

- [User Data API](https://github.com/makwana23-harshil/final-cyber-sentinel/blob/main/backend/api/user_routes.py): `backend/api/user_routes.py`
- [Admin API](https://github.com/makwana23-harshil/final-cyber-sentinel/blob/main/backend/api/admin_routes.py): `backend/api/admin_routes.py`

### Other components

- **User**
- **Administrator**

## Connections

- User → Authentication UI: registers or logs in
- User → Scan Interface: submits scans
- Administrator → Admin Dashboard: manages platform
- Scan Interface → Frontend API Client: uses API
- Frontend API Client → Detection API: sends scan requests
- Authentication UI → Frontend API Client: uses API
- Frontend API Client → Authentication Routes: sends auth requests
- Flask Application → Authentication Routes: registers (evidence: `backend/app.py`)
- Flask Application → Detection API: registers (evidence: `backend/app.py`)
- Flask Application → User Data API: registers (evidence: `backend/app.py`)
- Flask Application → Admin API: registers (evidence: `backend/app.py`)
- Authentication Routes → Token Middleware: uses token functions (evidence: `backend/auth/routes.py`)
- Authentication Routes → MongoDB: reads and writes accounts (evidence: `backend/auth/routes.py`)
- Token Middleware → MongoDB: loads users (evidence: `backend/auth/middleware.py`)
- Detection API → Token Middleware: requires user token (evidence: `backend/api/detection_routes.py`)
- Detection API → SMS Analysis: dispatches SMS scans (evidence: `backend/api/detection_routes.py`)
- Detection API → Email Analysis: dispatches email scans (evidence: `backend/api/detection_routes.py`)
- Detection API → URL Analysis: dispatches URL scans (evidence: `backend/api/detection_routes.py`)
- Detection API → AI Link Analysis: analyzes email address (evidence: `backend/api/detection_routes.py`)
- Detection API → MongoDB: saves scan results (evidence: `backend/api/detection_routes.py`)
- SMS Analysis → Deep Link Inspection: inspects extracted links (evidence: `backend/detection/sms/sms_detector.py`)
- Email Analysis → Deep Link Inspection: inspects email links (evidence: `backend/detection/email/email_detector.py`)
- Email Analysis → AI Link Analysis: requests AI analysis (evidence: `backend/detection/email/email_detector.py`)
- URL Analysis → Deep Link Inspection: deep-inspects URL (evidence: `backend/detection/url/url_detector.py`)
- URL Analysis → URL Feature Extraction: extracts features (evidence: `backend/detection/url/url_detector.py`)
- Deep Link Inspection → AI Link Analysis: uses AI findings (evidence: `backend/detection/link/link_inspector.py`)
- User Dashboard → Frontend API Client: loads dashboard data
- Scan History → Frontend API Client: loads scan history
- Admin Dashboard → Frontend API Client: loads admin data
- Frontend API Client → User Data API: requests user history
- Frontend API Client → Admin API: requests admin data
- User Data API → Token Middleware: requires user token (evidence: `backend/api/user_routes.py`)
- User Data API → MongoDB: queries scan history (evidence: `backend/api/user_routes.py`)
- Admin API → Token Middleware: requires admin token (evidence: `backend/api/admin_routes.py`)
- Admin API → MongoDB: manages users and scans (evidence: `backend/api/admin_routes.py`)
