# sudo-anu/ai-scam-detector architecture

> Architecture diagram of the GitHub repository sudo-anu/ai-scam-detector, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sudo-anu/ai-scam-detector
- Repository: https://github.com/sudo-anu/ai-scam-detector

## Overview

This repository is a web-based scam detector: users submit a URL, email, text, or image through a React interface, the backend dispatches the input to a specialized scanner, and results are displayed in a dashboard. The backend also contains evidence normalization, risk scoring, threat-intelligence and Gemini integrations, and report generation. Several important modules are listed in the source index but were not excerpted; their connections are omitted or marked unverified rather than inferred.

Main entry points: [`frontend/src/App.jsx`](https://github.com/sudo-anu/ai-scam-detector/blob/main/frontend/src/App.jsx) (Scan app), [`backend/core/input_router.py`](https://github.com/sudo-anu/ai-scam-detector/blob/main/backend/core/input_router.py) (Input router), [`backend/core/risk_engine.py`](https://github.com/sudo-anu/ai-scam-detector/blob/main/backend/core/risk_engine.py) (Risk engine), [`backend/core/evidence.py`](https://github.com/sudo-anu/ai-scam-detector/blob/main/backend/core/evidence.py) (Evidence collector)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web interface"]
  node_app["Scan app<br/>[App.jsx]"]
  node_url_ui["URL input<br/>[UrlScanner.jsx]"]
  node_email_ui["Email input<br/>[EmailScanner.jsx]"]
  node_text_ui["Text input<br/>[TextScanner.jsx]"]
  node_image_ui["Image input<br/>[ImageScanner.jsx]"]
  node_dashboard["Results dashboard"]
end

subgraph group_api["API orchestration"]
  node_api_service["Scan API<br/>[main.py]"]
  node_endpoints["Scan endpoints<br/>[endpoints.py]"]
  node_input_router["Input router<br/>[input_router.py]"]
  node_schemas["Data schemas<br/>[schemas.py]"]
end

subgraph group_analysis["Scanning and assessment"]
  node_url_scanner["URL scanner<br/>[url_scanner.py]"]
  node_email_scanner["Email scanner<br/>[email_scanner.py]"]
  node_text_scanner["Text scanner<br/>[text_scanner.py]"]
  node_image_scanner["Image scanner<br/>[image_scanner.py]"]
  node_evidence["Evidence collector<br/>[evidence.py]"]
  node_risk["Risk engine<br/>[risk_engine.py]"]
end

subgraph group_reports["Integrations and reports"]
  node_threat_apis["Threat APIs<br/>[threat_apis.py]"]
  node_gemini["Gemini client<br/>[gemini_client.py]"]
  node_report_generator["Report generator<br/>[generator.py]"]
  node_report_files[("Saved reports")]
end

node_user(("User"))

node_user -->|"uses"| node_app
node_app -->|"renders"| node_url_ui
node_app -->|"renders"| node_email_ui
node_app -->|"renders"| node_text_ui
node_app -->|"renders"| node_image_ui
node_app -->|"posts scans"| node_endpoints
node_app -->|"renders results"| node_dashboard
node_api_service -->|"registers router"| node_endpoints
node_endpoints -.->|"dispatches scans"| node_input_router
node_input_router -->|"dispatches"| node_url_scanner
node_input_router -->|"dispatches"| node_email_scanner
node_input_router -->|"dispatches"| node_text_scanner
node_input_router -->|"dispatches"| node_image_scanner
node_evidence -->|"builds evidence"| node_schemas
node_risk -->|"returns evaluation"| node_schemas
node_input_router -.->|"normalizes output"| node_evidence
node_evidence -.->|"scores evidence"| node_risk
node_risk -.->|"enriches assessment"| node_threat_apis
node_risk -.->|"requests analysis"| node_gemini
node_report_generator -.->|"saves reports"| node_report_files

click node_app "https://github.com/sudo-anu/ai-scam-detector/blob/main/frontend/src/App.jsx"
click node_url_ui "https://github.com/sudo-anu/ai-scam-detector/blob/main/frontend/src/components/Inputs/UrlScanner.jsx"
click node_email_ui "https://github.com/sudo-anu/ai-scam-detector/blob/main/frontend/src/components/Inputs/EmailScanner.jsx"
click node_text_ui "https://github.com/sudo-anu/ai-scam-detector/blob/main/frontend/src/components/Inputs/TextScanner.jsx"
click node_image_ui "https://github.com/sudo-anu/ai-scam-detector/blob/main/frontend/src/components/Inputs/ImageScanner.jsx"
click node_dashboard "https://github.com/sudo-anu/ai-scam-detector/blob/main/frontend/src/components/Dashboard/ResultsDashboard.jsx"
click node_api_service "https://github.com/sudo-anu/ai-scam-detector/blob/main/backend/main.py"
click node_endpoints "https://github.com/sudo-anu/ai-scam-detector/blob/main/backend/api/endpoints.py"
click node_input_router "https://github.com/sudo-anu/ai-scam-detector/blob/main/backend/core/input_router.py"
click node_schemas "https://github.com/sudo-anu/ai-scam-detector/blob/main/backend/models/schemas.py"
click node_url_scanner "https://github.com/sudo-anu/ai-scam-detector/blob/main/backend/scanners/url_scanner.py"
click node_email_scanner "https://github.com/sudo-anu/ai-scam-detector/blob/main/backend/scanners/email_scanner.py"
click node_text_scanner "https://github.com/sudo-anu/ai-scam-detector/blob/main/backend/scanners/text_scanner.py"
click node_image_scanner "https://github.com/sudo-anu/ai-scam-detector/blob/main/backend/scanners/image_scanner.py"
click node_evidence "https://github.com/sudo-anu/ai-scam-detector/blob/main/backend/core/evidence.py"
click node_risk "https://github.com/sudo-anu/ai-scam-detector/blob/main/backend/core/risk_engine.py"
click node_threat_apis "https://github.com/sudo-anu/ai-scam-detector/blob/main/backend/integrations/threat_apis.py"
click node_gemini "https://github.com/sudo-anu/ai-scam-detector/blob/main/backend/integrations/gemini_client.py"
click node_report_generator "https://github.com/sudo-anu/ai-scam-detector/blob/main/backend/reporting/generator.py"
click node_report_files "https://github.com/sudo-anu/ai-scam-detector/tree/main/backend/storage/reports"

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_url_ui,node_email_ui,node_text_ui,node_image_ui,node_dashboard,node_user toneBlue
class node_api_service,node_endpoints,node_input_router,node_schemas toneAmber
class node_url_scanner,node_email_scanner,node_text_scanner,node_image_scanner,node_evidence,node_risk toneMint
class node_threat_apis,node_gemini,node_report_generator,node_report_files toneRose
```

## Components

### Web interface

- [Scan app](https://github.com/sudo-anu/ai-scam-detector/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [URL input](https://github.com/sudo-anu/ai-scam-detector/blob/main/frontend/src/components/Inputs/UrlScanner.jsx): `frontend/src/components/Inputs/UrlScanner.jsx`
- [Email input](https://github.com/sudo-anu/ai-scam-detector/blob/main/frontend/src/components/Inputs/EmailScanner.jsx): `frontend/src/components/Inputs/EmailScanner.jsx`
- [Text input](https://github.com/sudo-anu/ai-scam-detector/blob/main/frontend/src/components/Inputs/TextScanner.jsx): `frontend/src/components/Inputs/TextScanner.jsx`
- [Image input](https://github.com/sudo-anu/ai-scam-detector/blob/main/frontend/src/components/Inputs/ImageScanner.jsx): `frontend/src/components/Inputs/ImageScanner.jsx`
- [Results dashboard](https://github.com/sudo-anu/ai-scam-detector/blob/main/frontend/src/components/Dashboard/ResultsDashboard.jsx): `frontend/src/components/Dashboard/ResultsDashboard.jsx`

### API orchestration

- [Scan API](https://github.com/sudo-anu/ai-scam-detector/blob/main/backend/main.py): `backend/main.py`
- [Scan endpoints](https://github.com/sudo-anu/ai-scam-detector/blob/main/backend/api/endpoints.py): `backend/api/endpoints.py`
- [Input router](https://github.com/sudo-anu/ai-scam-detector/blob/main/backend/core/input_router.py): `backend/core/input_router.py`
- [Data schemas](https://github.com/sudo-anu/ai-scam-detector/blob/main/backend/models/schemas.py): `backend/models/schemas.py`

### Scanning and assessment

- [URL scanner](https://github.com/sudo-anu/ai-scam-detector/blob/main/backend/scanners/url_scanner.py): `backend/scanners/url_scanner.py`
- [Email scanner](https://github.com/sudo-anu/ai-scam-detector/blob/main/backend/scanners/email_scanner.py): `backend/scanners/email_scanner.py`
- [Text scanner](https://github.com/sudo-anu/ai-scam-detector/blob/main/backend/scanners/text_scanner.py): `backend/scanners/text_scanner.py`
- [Image scanner](https://github.com/sudo-anu/ai-scam-detector/blob/main/backend/scanners/image_scanner.py): `backend/scanners/image_scanner.py`
- [Evidence collector](https://github.com/sudo-anu/ai-scam-detector/blob/main/backend/core/evidence.py): `backend/core/evidence.py`
- [Risk engine](https://github.com/sudo-anu/ai-scam-detector/blob/main/backend/core/risk_engine.py): `backend/core/risk_engine.py`

### Integrations and reports

- [Threat APIs](https://github.com/sudo-anu/ai-scam-detector/blob/main/backend/integrations/threat_apis.py): `backend/integrations/threat_apis.py`
- [Gemini client](https://github.com/sudo-anu/ai-scam-detector/blob/main/backend/integrations/gemini_client.py): `backend/integrations/gemini_client.py`
- [Report generator](https://github.com/sudo-anu/ai-scam-detector/blob/main/backend/reporting/generator.py): `backend/reporting/generator.py`
- [Saved reports](https://github.com/sudo-anu/ai-scam-detector/tree/main/backend/storage/reports): `backend/storage/reports`

### Other components

- **User**

## Connections

- User → Scan app: uses
- Scan app → URL input: renders (evidence: `frontend/src/App.jsx`)
- Scan app → Email input: renders (evidence: `frontend/src/App.jsx`)
- Scan app → Text input: renders (evidence: `frontend/src/App.jsx`)
- Scan app → Image input: renders (evidence: `frontend/src/App.jsx`)
- Scan app → Scan endpoints: posts scans (evidence: `frontend/src/App.jsx`)
- Scan app → Results dashboard: renders results (evidence: `frontend/src/App.jsx`)
- Scan API → Scan endpoints: registers router (evidence: `backend/main.py`)
- Scan endpoints → Input router: dispatches scans
- Input router → URL scanner: dispatches (evidence: `backend/core/input_router.py`)
- Input router → Email scanner: dispatches (evidence: `backend/core/input_router.py`)
- Input router → Text scanner: dispatches (evidence: `backend/core/input_router.py`)
- Input router → Image scanner: dispatches (evidence: `backend/core/input_router.py`)
- Evidence collector → Data schemas: builds evidence (evidence: `backend/core/evidence.py`)
- Risk engine → Data schemas: returns evaluation (evidence: `backend/core/risk_engine.py`)
- Input router → Evidence collector: normalizes output
- Evidence collector → Risk engine: scores evidence
- Risk engine → Threat APIs: enriches assessment
- Risk engine → Gemini client: requests analysis
- Report generator → Saved reports: saves reports
