# jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform architecture

> Architecture diagram of the GitHub repository jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform
- Repository: https://github.com/jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform

## Overview

RedFlag’s main workflow takes a message, URL, screenshot, or QR payload through a unified analysis API, then returns an explainable risk result. Campaign correlation, reporting, moderation, community intelligence, and the preserved classic scanner are additional product branches. Backend calls are shown where source excerpts or the SOURCE INDEX support them; some frontend-to-API and unsampled subsystem links rely on README documentation.

Main entry points: [`backend/app/intel/analyzer.py`](https://github.com/jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform/blob/main/backend/app/intel/analyzer.py) (Unified analysis engine), [`backend/app/api/intel_routes.py`](https://github.com/jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform/blob/main/backend/app/api/intel_routes.py) (Multimodal API routes), [`frontend/src/intel/api.ts`](https://github.com/jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform/blob/main/frontend/src/intel/api.ts) (Intelligence API client), [`backend/app/intel/db.py`](https://github.com/jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform/blob/main/backend/app/intel/db.py) (Intelligence database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_analyze_ui["Analyze inputs<br/>[AnalyzeHub.tsx]"]
  node_result_ui["Explainable result<br/>[ResultView.tsx]"]
  node_campaign_ui["Campaign view<br/>[CampaignView.tsx]"]
  node_community_ui["Community and pulse<br/>[Community.tsx]"]
  node_classic_ui["Classic scanner<br/>[UrlScanner.tsx]"]
end

subgraph group_api["API surface"]
  node_intel_client["Intelligence API client<br/>[api.ts]"]
  node_classic_client["Classic API client<br/>[api.ts]"]
  node_intel_routes["Multimodal API routes<br/>[intel_routes.py]"]
  node_classic_routes["Baseline scan routes<br/>[endpoints.py]"]
  node_schemas["Result and scan schemas<br/>[schemas.py]"]
end

subgraph group_analysis["Analysis and intelligence"]
  node_adapters["OCR and QR adapters<br/>[adapters.py]"]
  node_analyzer["Unified analysis engine<br/>[analyzer.py]"]
  node_language["Language normalization<br/>[language.py]"]
  node_intent["Scam intent detection<br/>[intent.py]"]
  node_classifier["Text classifier<br/>[classifier.py]"]
  node_url_analysis["URL risk analysis<br/>[url_analyzer.py]"]
  node_risk_scoring["Evidence risk scoring<br/>[risk_scorer.py]"]
end

subgraph group_intelligence["Threat intelligence"]
  node_entity_extract["Entity extraction<br/>[entities.py]"]
  node_campaign_graph["Campaign correlation<br/>[graph.py]"]
  node_reports["Community reports and moderation<br/>[reports.py]"]
  node_database[("Intelligence database<br/>[db.py]")]
end

node_citizen(("Citizen / analyst"))

node_citizen -.->|"submits evidence"| node_analyze_ui
node_analyze_ui -.->|"requests analysis"| node_intel_client
node_intel_client -.->|"calls API"| node_intel_routes
node_intel_routes -->|"validates and decodes"| node_adapters
node_intel_routes -->|"runs analysis"| node_analyzer
node_analyzer -->|"normalizes language"| node_language
node_analyzer -->|"classifies intent"| node_intent
node_analyzer -->|"uses classifier"| node_classifier
node_analyzer -->|"analyzes URLs"| node_url_analysis
node_analyzer -->|"builds risk factors"| node_risk_scoring
node_analyzer -->|"extracts entities"| node_entity_extract
node_analyzer -->|"correlates campaigns"| node_campaign_graph
node_analyzer -->|"persists analysis"| node_database
node_intel_routes -->|"handles reports"| node_reports
node_reports -->|"updates campaign links"| node_campaign_graph
node_reports -->|"reads and writes"| node_database
node_campaign_graph -->|"reads graph data"| node_database
node_analyzer -.->|"returns result contract"| node_schemas
node_intel_routes -->|"uses request models"| node_schemas
node_intel_routes -->|"loads analysis"| node_database
node_intel_client -.->|"returns analysis"| node_result_ui
node_intel_client -.->|"serves campaign views"| node_campaign_ui
node_intel_client -.->|"serves feed and pulse"| node_community_ui
node_community_ui -.->|"requests intelligence"| node_intel_client
node_citizen -.->|"scans URL or SMS"| node_classic_ui
node_classic_ui -->|"submits scan"| node_classic_client
node_classic_client -->|"calls baseline API"| node_classic_routes
node_classic_routes -->|"analyzes URL"| node_url_analysis
node_classic_routes -->|"scores scan"| node_risk_scoring

click node_analyze_ui "https://github.com/jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform/blob/main/frontend/src/intel/AnalyzeHub.tsx"
click node_result_ui "https://github.com/jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform/blob/main/frontend/src/intel/ResultView.tsx"
click node_campaign_ui "https://github.com/jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform/blob/main/frontend/src/intel/CampaignView.tsx"
click node_community_ui "https://github.com/jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform/blob/main/frontend/src/intel/Community.tsx"
click node_classic_ui "https://github.com/jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform/blob/main/frontend/src/components/UrlScanner.tsx"
click node_intel_client "https://github.com/jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform/blob/main/frontend/src/intel/api.ts"
click node_classic_client "https://github.com/jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform/blob/main/frontend/src/services/api.ts"
click node_intel_routes "https://github.com/jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform/blob/main/backend/app/api/intel_routes.py"
click node_classic_routes "https://github.com/jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform/blob/main/backend/app/api/endpoints.py"
click node_schemas "https://github.com/jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform/blob/main/backend/app/models/schemas.py"
click node_adapters "https://github.com/jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform/blob/main/backend/app/intel/adapters.py"
click node_analyzer "https://github.com/jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform/blob/main/backend/app/intel/analyzer.py"
click node_language "https://github.com/jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform/blob/main/backend/app/intel/language.py"
click node_intent "https://github.com/jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform/blob/main/backend/app/intel/intent.py"
click node_classifier "https://github.com/jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform/blob/main/backend/app/intel/classifier.py"
click node_url_analysis "https://github.com/jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform/blob/main/backend/app/services/url_analyzer.py"
click node_risk_scoring "https://github.com/jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform/blob/main/backend/app/services/risk_scorer.py"
click node_entity_extract "https://github.com/jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform/blob/main/backend/app/intel/entities.py"
click node_campaign_graph "https://github.com/jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform/blob/main/backend/app/intel/graph.py"
click node_reports "https://github.com/jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform/blob/main/backend/app/intel/reports.py"
click node_database "https://github.com/jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform/blob/main/backend/app/intel/db.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_analyze_ui,node_result_ui,node_campaign_ui,node_community_ui,node_classic_ui toneBlue
class node_intel_client,node_classic_client,node_intel_routes,node_classic_routes,node_schemas toneAmber
class node_adapters,node_analyzer,node_language,node_intent,node_classifier,node_url_analysis,node_risk_scoring toneMint
class node_entity_extract,node_campaign_graph,node_reports,node_database toneRose
class node_citizen toneIndigo
```

## Components

### User experience

- [Analyze inputs](https://github.com/jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform/blob/main/frontend/src/intel/AnalyzeHub.tsx): `frontend/src/intel/AnalyzeHub.tsx`
- [Explainable result](https://github.com/jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform/blob/main/frontend/src/intel/ResultView.tsx): `frontend/src/intel/ResultView.tsx`
- [Campaign view](https://github.com/jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform/blob/main/frontend/src/intel/CampaignView.tsx): `frontend/src/intel/CampaignView.tsx`
- [Community and pulse](https://github.com/jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform/blob/main/frontend/src/intel/Community.tsx): `frontend/src/intel/Community.tsx`
- [Classic scanner](https://github.com/jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform/blob/main/frontend/src/components/UrlScanner.tsx): `frontend/src/components/UrlScanner.tsx`

### API surface

- [Intelligence API client](https://github.com/jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform/blob/main/frontend/src/intel/api.ts): `frontend/src/intel/api.ts`
- [Classic API client](https://github.com/jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform/blob/main/frontend/src/services/api.ts): `frontend/src/services/api.ts`
- [Multimodal API routes](https://github.com/jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform/blob/main/backend/app/api/intel_routes.py): `backend/app/api/intel_routes.py`
- [Baseline scan routes](https://github.com/jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform/blob/main/backend/app/api/endpoints.py): `backend/app/api/endpoints.py`
- [Result and scan schemas](https://github.com/jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform/blob/main/backend/app/models/schemas.py): `backend/app/models/schemas.py`

### Analysis and intelligence

- [OCR and QR adapters](https://github.com/jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform/blob/main/backend/app/intel/adapters.py): `backend/app/intel/adapters.py`
- [Unified analysis engine](https://github.com/jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform/blob/main/backend/app/intel/analyzer.py): `backend/app/intel/analyzer.py`
- [Language normalization](https://github.com/jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform/blob/main/backend/app/intel/language.py): `backend/app/intel/language.py`
- [Scam intent detection](https://github.com/jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform/blob/main/backend/app/intel/intent.py): `backend/app/intel/intent.py`
- [Text classifier](https://github.com/jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform/blob/main/backend/app/intel/classifier.py): `backend/app/intel/classifier.py`
- [URL risk analysis](https://github.com/jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform/blob/main/backend/app/services/url_analyzer.py): `backend/app/services/url_analyzer.py`
- [Evidence risk scoring](https://github.com/jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform/blob/main/backend/app/services/risk_scorer.py): `backend/app/services/risk_scorer.py`

### Threat intelligence

- [Entity extraction](https://github.com/jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform/blob/main/backend/app/intel/entities.py): `backend/app/intel/entities.py`
- [Campaign correlation](https://github.com/jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform/blob/main/backend/app/intel/graph.py): `backend/app/intel/graph.py`
- [Community reports and moderation](https://github.com/jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform/blob/main/backend/app/intel/reports.py): `backend/app/intel/reports.py`
- [Intelligence database](https://github.com/jyothsnareddy-6299/redflag--phishing-and-fraud-alert-platform/blob/main/backend/app/intel/db.py): `backend/app/intel/db.py`

### Other components

- **Citizen / analyst**

## Connections

- Citizen / analyst → Analyze inputs: submits evidence
- Analyze inputs → Intelligence API client: requests analysis (evidence: `frontend/src/intel/AnalyzeHub.tsx`)
- Intelligence API client → Multimodal API routes: calls API
- Multimodal API routes → OCR and QR adapters: validates and decodes (evidence: `backend/app/api/intel_routes.py`)
- Multimodal API routes → Unified analysis engine: runs analysis (evidence: `backend/app/api/intel_routes.py`)
- Unified analysis engine → Language normalization: normalizes language (evidence: `backend/app/intel/analyzer.py`)
- Unified analysis engine → Scam intent detection: classifies intent (evidence: `backend/app/intel/analyzer.py`)
- Unified analysis engine → Text classifier: uses classifier (evidence: `backend/app/intel/analyzer.py`)
- Unified analysis engine → URL risk analysis: analyzes URLs (evidence: `backend/app/intel/analyzer.py`)
- Unified analysis engine → Evidence risk scoring: builds risk factors (evidence: `backend/app/intel/analyzer.py`)
- Unified analysis engine → Entity extraction: extracts entities (evidence: `backend/app/intel/analyzer.py`)
- Unified analysis engine → Campaign correlation: correlates campaigns (evidence: `backend/app/intel/analyzer.py`)
- Unified analysis engine → Intelligence database: persists analysis (evidence: `backend/app/intel/analyzer.py`)
- Multimodal API routes → Community reports and moderation: handles reports (evidence: `backend/app/api/intel_routes.py`)
- Community reports and moderation → Campaign correlation: updates campaign links (evidence: `backend/app/intel/reports.py`)
- Community reports and moderation → Intelligence database: reads and writes (evidence: `backend/app/intel/reports.py`)
- Campaign correlation → Intelligence database: reads graph data (evidence: `backend/app/intel/graph.py`)
- Unified analysis engine → Result and scan schemas: returns result contract
- Multimodal API routes → Result and scan schemas: uses request models (evidence: `backend/app/api/intel_routes.py`)
- Multimodal API routes → Intelligence database: loads analysis (evidence: `backend/app/api/intel_routes.py`)
- Intelligence API client → Explainable result: returns analysis (evidence: `frontend/src/intel/ResultView.tsx`)
- Intelligence API client → Campaign view: serves campaign views (evidence: `frontend/src/intel/CampaignView.tsx`)
- Intelligence API client → Community and pulse: serves feed and pulse (evidence: `frontend/src/intel/Community.tsx`)
- Community and pulse → Intelligence API client: requests intelligence (evidence: `frontend/src/intel/Community.tsx`)
- Citizen / analyst → Classic scanner: scans URL or SMS
- Classic scanner → Classic API client: submits scan (evidence: `frontend/src/components/UrlScanner.tsx`)
- Classic API client → Baseline scan routes: calls baseline API (evidence: `frontend/src/services/api.ts`)
- Baseline scan routes → URL risk analysis: analyzes URL (evidence: `backend/app/api/endpoints.py`)
- Baseline scan routes → Evidence risk scoring: scores scan (evidence: `backend/app/api/endpoints.py`)
