# nandv2007/redflag--phishing-and-fraud-alert-platform architecture

> Architecture diagram of the GitHub repository nandv2007/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/nandv2007/redflag--phishing-and-fraud-alert-platform
- Repository: https://github.com/nandv2007/redflag--phishing-and-fraud-alert-platform

## Overview

RedFlag is a multilingual fraud-alert platform: users submit text, URLs, screenshots, or QR codes; the service analyzes evidence, returns an explainable risk result, and supports campaign correlation and community reporting. The map includes the preserved classic scanner and documented campaign, moderation, and threat-pulse features. Some frontend/backend and unsampled-subsystem links are based on README contracts; source excerpts do not expose every implementation detail.

Main entry points: [`backend/app/intel/analyzer.py`](https://github.com/nandv2007/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/nandv2007/redflag--phishing-and-fraud-alert-platform/blob/main/backend/app/api/intel_routes.py) (Intelligence endpoints), [`frontend/src/intel/api.ts`](https://github.com/nandv2007/redflag--phishing-and-fraud-alert-platform/blob/main/frontend/src/intel/api.ts) (Intelligence API client), [`backend/app/intel/db.py`](https://github.com/nandv2007/redflag--phishing-and-fraud-alert-platform/blob/main/backend/app/intel/db.py) (Intelligence database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["User experience"]
  node_app["Application shell<br/>[App.tsx]"]
  node_analyze_ui["Analyze inputs<br/>[AnalyzeHub.tsx]"]
  node_result_ui["Analysis results<br/>[ResultView.tsx]"]
  node_intel_ui["Campaigns and feed<br/>[Community.tsx]"]
  node_campaign_ui["Campaign view<br/>[CampaignView.tsx]"]
  node_classic_ui["Classic scanners<br/>[UrlScanner.tsx]"]
  node_intel_client["Intelligence API client<br/>[api.ts]"]
  node_classic_client["Classic API client<br/>[api.ts]"]
end

subgraph group_api["API and intake"]
  node_api_routes["Intelligence endpoints<br/>[intel_routes.py]"]
  node_classic_routes["Classic endpoints<br/>[endpoints.py]"]
  node_adapters["Image and QR adapters<br/>[adapters.py]"]
  node_schemas["API and result schemas<br/>[schemas.py]"]
  node_server["HTTP service<br/>[main.py]"]
end

subgraph group_analysis["Evidence analysis"]
  node_engine["Unified analysis engine<br/>[analyzer.py]"]
  node_language["Language analysis<br/>[language.py]"]
  node_intent["Scam intent<br/>[intent.py]"]
  node_classifier["Text classifier<br/>[classifier.py]"]
  node_url_analysis["URL risk analysis<br/>[url_analyzer.py]"]
  node_brand_match["Brand matching<br/>[brand_matcher.py]"]
  node_risk_score["Risk scoring<br/>[risk_scorer.py]"]
end

subgraph group_intel["Threat intelligence"]
  node_entity_extract["Entity extraction<br/>[entities.py]"]
  node_campaign_graph["Campaign correlation<br/>[graph.py]"]
  node_reports["Community reports<br/>[reports.py]"]
end

subgraph group_storage["Persistence"]
  node_db[("Intelligence database<br/>[db.py]")]
end

node_citizen(("User"))

node_citizen -->|"uses"| node_app
node_app -->|"opens analysis"| node_analyze_ui
node_app -->|"opens feed"| node_intel_ui
node_app -->|"opens campaigns"| node_campaign_ui
node_analyze_ui -->|"submits inputs"| node_intel_client
node_intel_client -->|"calls analysis API"| node_api_routes
node_api_routes -->|"decodes uploads"| node_adapters
node_api_routes -->|"analyzes inputs"| node_engine
node_api_routes -->|"handles reports"| node_reports
node_api_routes -->|"loads analysis"| node_db
node_api_routes -->|"validates requests"| node_schemas
node_engine -->|"detects language"| node_language
node_engine -->|"classifies intent"| node_intent
node_engine -->|"uses model"| node_classifier
node_engine -->|"analyzes URLs"| node_url_analysis
node_url_analysis -->|"checks brands"| node_brand_match
node_engine -->|"scores evidence"| node_risk_score
node_engine -->|"extracts entities"| node_entity_extract
node_engine -->|"correlates threats"| node_campaign_graph
node_engine -->|"stores result"| node_db
node_campaign_graph -->|"reads and writes"| node_db
node_reports -->|"persists reports"| node_db
node_reports -->|"updates campaigns"| node_campaign_graph
node_intel_client -->|"returns result"| node_result_ui
node_intel_ui -->|"loads feed"| node_intel_client
node_campaign_ui -->|"loads campaign"| node_intel_client
node_citizen -->|"scans URL or SMS"| node_classic_ui
node_classic_ui -->|"requests scan"| node_classic_client
node_classic_client -->|"calls scan API"| node_classic_routes
node_classic_routes -->|"analyzes URL"| node_url_analysis
node_server -->|"mounts routes"| node_api_routes
node_server -->|"mounts routes"| node_classic_routes
node_server -->|"initializes database"| node_db

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

## Components

### User experience

- [Application shell](https://github.com/nandv2007/redflag--phishing-and-fraud-alert-platform/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Analyze inputs](https://github.com/nandv2007/redflag--phishing-and-fraud-alert-platform/blob/main/frontend/src/intel/AnalyzeHub.tsx): `frontend/src/intel/AnalyzeHub.tsx`
- [Analysis results](https://github.com/nandv2007/redflag--phishing-and-fraud-alert-platform/blob/main/frontend/src/intel/ResultView.tsx): `frontend/src/intel/ResultView.tsx`
- [Campaigns and feed](https://github.com/nandv2007/redflag--phishing-and-fraud-alert-platform/blob/main/frontend/src/intel/Community.tsx): `frontend/src/intel/Community.tsx`
- [Campaign view](https://github.com/nandv2007/redflag--phishing-and-fraud-alert-platform/blob/main/frontend/src/intel/CampaignView.tsx): `frontend/src/intel/CampaignView.tsx`
- [Classic scanners](https://github.com/nandv2007/redflag--phishing-and-fraud-alert-platform/blob/main/frontend/src/components/UrlScanner.tsx): `frontend/src/components/UrlScanner.tsx`
- [Intelligence API client](https://github.com/nandv2007/redflag--phishing-and-fraud-alert-platform/blob/main/frontend/src/intel/api.ts): `frontend/src/intel/api.ts`
- [Classic API client](https://github.com/nandv2007/redflag--phishing-and-fraud-alert-platform/blob/main/frontend/src/services/api.ts): `frontend/src/services/api.ts`

### API and intake

- [Intelligence endpoints](https://github.com/nandv2007/redflag--phishing-and-fraud-alert-platform/blob/main/backend/app/api/intel_routes.py): `backend/app/api/intel_routes.py`
- [Classic endpoints](https://github.com/nandv2007/redflag--phishing-and-fraud-alert-platform/blob/main/backend/app/api/endpoints.py): `backend/app/api/endpoints.py`
- [Image and QR adapters](https://github.com/nandv2007/redflag--phishing-and-fraud-alert-platform/blob/main/backend/app/intel/adapters.py): `backend/app/intel/adapters.py`
- [API and result schemas](https://github.com/nandv2007/redflag--phishing-and-fraud-alert-platform/blob/main/backend/app/models/schemas.py): `backend/app/models/schemas.py`
- [HTTP service](https://github.com/nandv2007/redflag--phishing-and-fraud-alert-platform/blob/main/backend/app/main.py): `backend/app/main.py`

### Evidence analysis

- [Unified analysis engine](https://github.com/nandv2007/redflag--phishing-and-fraud-alert-platform/blob/main/backend/app/intel/analyzer.py): `backend/app/intel/analyzer.py`
- [Language analysis](https://github.com/nandv2007/redflag--phishing-and-fraud-alert-platform/blob/main/backend/app/intel/language.py): `backend/app/intel/language.py`
- [Scam intent](https://github.com/nandv2007/redflag--phishing-and-fraud-alert-platform/blob/main/backend/app/intel/intent.py): `backend/app/intel/intent.py`
- [Text classifier](https://github.com/nandv2007/redflag--phishing-and-fraud-alert-platform/blob/main/backend/app/intel/classifier.py): `backend/app/intel/classifier.py`
- [URL risk analysis](https://github.com/nandv2007/redflag--phishing-and-fraud-alert-platform/blob/main/backend/app/services/url_analyzer.py): `backend/app/services/url_analyzer.py`
- [Brand matching](https://github.com/nandv2007/redflag--phishing-and-fraud-alert-platform/blob/main/backend/app/services/brand_matcher.py): `backend/app/services/brand_matcher.py`
- [Risk scoring](https://github.com/nandv2007/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/nandv2007/redflag--phishing-and-fraud-alert-platform/blob/main/backend/app/intel/entities.py): `backend/app/intel/entities.py`
- [Campaign correlation](https://github.com/nandv2007/redflag--phishing-and-fraud-alert-platform/blob/main/backend/app/intel/graph.py): `backend/app/intel/graph.py`
- [Community reports](https://github.com/nandv2007/redflag--phishing-and-fraud-alert-platform/blob/main/backend/app/intel/reports.py): `backend/app/intel/reports.py`

### Persistence

- [Intelligence database](https://github.com/nandv2007/redflag--phishing-and-fraud-alert-platform/blob/main/backend/app/intel/db.py): `backend/app/intel/db.py`

### Other components

- **User**

## Connections

- User → Application shell: uses
- Application shell → Analyze inputs: opens analysis (evidence: `frontend/src/App.tsx`)
- Application shell → Campaigns and feed: opens feed (evidence: `frontend/src/App.tsx`)
- Application shell → Campaign view: opens campaigns (evidence: `frontend/src/App.tsx`)
- Analyze inputs → Intelligence API client: submits inputs (evidence: `frontend/src/intel/AnalyzeHub.tsx`)
- Intelligence API client → Intelligence endpoints: calls analysis API
- Intelligence endpoints → Image and QR adapters: decodes uploads (evidence: `backend/app/api/intel_routes.py`)
- Intelligence endpoints → Unified analysis engine: analyzes inputs (evidence: `backend/app/api/intel_routes.py`)
- Intelligence endpoints → Community reports: handles reports (evidence: `backend/app/api/intel_routes.py`)
- Intelligence endpoints → Intelligence database: loads analysis (evidence: `backend/app/api/intel_routes.py`)
- Intelligence endpoints → API and result schemas: validates requests (evidence: `backend/app/api/intel_routes.py`)
- Unified analysis engine → Language analysis: detects language (evidence: `backend/app/intel/analyzer.py`)
- Unified analysis engine → Scam intent: classifies intent (evidence: `backend/app/intel/analyzer.py`)
- Unified analysis engine → Text classifier: uses model (evidence: `backend/app/intel/analyzer.py`)
- Unified analysis engine → URL risk analysis: analyzes URLs (evidence: `backend/app/intel/analyzer.py`)
- URL risk analysis → Brand matching: checks brands (evidence: `backend/app/services/url_analyzer.py`)
- Unified analysis engine → Risk scoring: scores evidence (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 threats (evidence: `backend/app/intel/analyzer.py`)
- Unified analysis engine → Intelligence database: stores result (evidence: `backend/app/intel/analyzer.py`)
- Campaign correlation → Intelligence database: reads and writes (evidence: `backend/app/intel/graph.py`)
- Community reports → Intelligence database: persists reports (evidence: `backend/app/intel/reports.py`)
- Community reports → Campaign correlation: updates campaigns (evidence: `backend/app/intel/reports.py`)
- Intelligence API client → Analysis results: returns result (evidence: `frontend/src/intel/ResultView.tsx`)
- Campaigns and feed → Intelligence API client: loads feed (evidence: `frontend/src/intel/Community.tsx`)
- Campaign view → Intelligence API client: loads campaign (evidence: `frontend/src/intel/CampaignView.tsx`)
- User → Classic scanners: scans URL or SMS
- Classic scanners → Classic API client: requests scan (evidence: `frontend/src/components/UrlScanner.tsx`)
- Classic API client → Classic endpoints: calls scan API (evidence: `frontend/src/services/api.ts`)
- Classic endpoints → URL risk analysis: analyzes URL (evidence: `backend/app/api/endpoints.py`)
- HTTP service → Intelligence endpoints: mounts routes (evidence: `backend/app/main.py`)
- HTTP service → Classic endpoints: mounts routes (evidence: `backend/app/main.py`)
- HTTP service → Intelligence database: initializes database (evidence: `backend/app/main.py`)
