# hritik3706/sih-1454-phishing-domain-detection architecture

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

- Interactive diagram: https://gitdiagram.com/hritik3706/sih-1454-phishing-domain-detection
- Repository: https://github.com/hritik3706/sih-1454-phishing-domain-detection

## Overview

PHISHEYE detects suspicious URLs and other scam inputs, combines technical, threat-intelligence, brand, and content signals into risk assessments, and presents explanations through its dashboard and browser extension. The backend also supports accounts, scan history, reports, feedback, reputation, and statistics. A separate RAG service retrieves curated threat knowledge for grounded explanations; its corpus, retrieval, and vector-store components are included. Relationships are limited to README statements and visible source-index references or excerpts; unsampled internals are not assumed.

Main entry points: [`backend/app/main.py`](https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/backend/app/main.py) (Backend application), [`backend/app/routes/threat_detection.py`](https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/backend/app/routes/threat_detection.py) (Threat-check routes), [`backend/app/database/connection.py`](https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/backend/app/database/connection.py) (Application database), [`rag_service/app/main.py`](https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/rag_service/app/main.py) (Grounded explanation API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["User clients"]
  node_dashboard["Web dashboard"]
  node_auth_context["Web authentication<br/>[AuthContext.jsx]"]
  node_web_api["Web API client<br/>[api.js]"]
  node_extension["Browser extension<br/>[service-worker.js]"]
  node_extension_api["Extension API client<br/>[api.js]"]
end

subgraph group_detection["Detection API"]
  node_api["Backend application<br/>[main.py]"]
  node_threat_routes["Threat-check routes"]
  node_analyze_routes["Content-analysis routes<br/>[analyze.py]"]
  node_url_checker["URL and threat checks<br/>[url_checker.py]"]
  node_content_analysis["Content analysis"]
  node_risk_engine["Risk assessment<br/>[risk_engine.py]"]
  node_explanation["Scan explanation<br/>[explanation.py]"]
  node_rag_client["RAG connector<br/>[rag_client.py]"]
end

subgraph group_knowledge["Threat knowledge"]
  node_rag_service["Grounded explanation API<br/>[main.py]"]
  node_retrieval["Hybrid retrieval<br/>[retrieval.py]"]
  node_vector_store[("Vector index<br/>[chroma_store.py]")]
  node_corpus["Threat corpus<br/>[corpus.py]"]
  node_feed_ingestion["Feed ingestion<br/>[feed_ingestion.py]"]
end

subgraph group_persistence["Accounts and records"]
  node_database[("Application database<br/>[connection.py]")]
  node_auth_routes["Account routes<br/>[user.py]"]
  node_reports["Reports and reputation<br/>[reports.py]"]
  node_scans["Scan history<br/>[scans.py]"]
  node_stats["Statistics<br/>[stats.py]"]
  node_visits["Visit records<br/>[visits.py]"]
end

node_user(("User"))

node_user -->|"uses"| node_dashboard
node_user -->|"browses with"| node_extension
node_dashboard -.->|"requests scans"| node_web_api
node_auth_context -->|"requests profile"| node_web_api
node_extension -->|"requests checks"| node_extension_api
node_extension_api -.->|"calls API"| node_api
node_web_api -.->|"calls API"| node_api
node_api -->|"registers routes"| node_threat_routes
node_api -->|"registers routes"| node_analyze_routes
node_api -->|"registers routes"| node_auth_routes
node_api -->|"registers routes"| node_reports
node_api -->|"registers routes"| node_scans
node_api -->|"registers routes"| node_stats
node_api -->|"registers routes"| node_visits
node_threat_routes -->|"checks URLs"| node_url_checker
node_threat_routes -->|"analyzes content"| node_content_analysis
node_threat_routes -->|"builds explanation"| node_explanation
node_threat_routes -->|"records checks"| node_database
node_analyze_routes -->|"analyzes input"| node_content_analysis
node_analyze_routes -->|"stores results"| node_database
node_threat_routes -.->|"requests RAG"| node_rag_client
node_rag_client -->|"posts explanation request"| node_rag_service
node_rag_service -->|"retrieves evidence"| node_retrieval
node_rag_service -->|"uses corpus"| node_corpus
node_rag_service -->|"checks index"| node_vector_store
node_retrieval -->|"searches vectors"| node_vector_store
node_feed_ingestion -->|"loads documents"| node_corpus
node_feed_ingestion -->|"indexes chunks"| node_vector_store
node_auth_routes -.->|"stores accounts"| node_database
node_reports -->|"reads and writes"| node_database
node_scans -->|"reads and writes"| node_database
node_stats -.->|"aggregates records"| node_database
node_visits -.->|"records visits"| node_database

click node_dashboard "https://github.com/hritik3706/sih-1454-phishing-domain-detection/tree/main/frontend/src/pages"
click node_auth_context "https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/frontend/src/context/AuthContext.jsx"
click node_web_api "https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/frontend/src/services/api.js"
click node_extension "https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/extension/background/service-worker.js"
click node_extension_api "https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/extension/utils/api.js"
click node_api "https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/backend/app/main.py"
click node_threat_routes "https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/backend/app/routes/threat_detection.py"
click node_analyze_routes "https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/backend/app/routes/analyze.py"
click node_url_checker "https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/backend/app/services/url_checker.py"
click node_content_analysis "https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/backend/app/services/content_analyzer.py"
click node_risk_engine "https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/backend/app/services/risk_engine.py"
click node_explanation "https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/backend/app/services/explanation.py"
click node_rag_client "https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/backend/app/services/rag_client.py"
click node_rag_service "https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/rag_service/app/main.py"
click node_retrieval "https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/rag_service/app/retrieval.py"
click node_vector_store "https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/rag_service/app/chroma_store.py"
click node_corpus "https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/rag_service/app/corpus.py"
click node_feed_ingestion "https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/rag_service/app/feed_ingestion.py"
click node_database "https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/backend/app/database/connection.py"
click node_auth_routes "https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/backend/app/routes/user.py"
click node_reports "https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/backend/app/routes/reports.py"
click node_scans "https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/backend/app/routes/scans.py"
click node_stats "https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/backend/app/routes/stats.py"
click node_visits "https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/backend/app/routes/visits.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_dashboard,node_auth_context,node_web_api,node_extension,node_extension_api,node_user toneBlue
class node_api,node_threat_routes,node_analyze_routes,node_url_checker,node_content_analysis,node_risk_engine,node_explanation,node_rag_client toneAmber
class node_rag_service,node_retrieval,node_vector_store,node_corpus,node_feed_ingestion toneMint
class node_database,node_auth_routes,node_reports,node_scans,node_stats,node_visits toneRose
```

## Components

### User clients

- [Web dashboard](https://github.com/hritik3706/sih-1454-phishing-domain-detection/tree/main/frontend/src/pages): `frontend/src/pages`
- [Web authentication](https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [Web API client](https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`
- [Browser extension](https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/extension/background/service-worker.js): `extension/background/service-worker.js`
- [Extension API client](https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/extension/utils/api.js): `extension/utils/api.js`

### Detection API

- [Backend application](https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/backend/app/main.py): `backend/app/main.py`
- [Threat-check routes](https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/backend/app/routes/threat_detection.py): `backend/app/routes/threat_detection.py`
- [Content-analysis routes](https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/backend/app/routes/analyze.py): `backend/app/routes/analyze.py`
- [URL and threat checks](https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/backend/app/services/url_checker.py): `backend/app/services/url_checker.py`
- [Content analysis](https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/backend/app/services/content_analyzer.py): `backend/app/services/content_analyzer.py`
- [Risk assessment](https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/backend/app/services/risk_engine.py): `backend/app/services/risk_engine.py`
- [Scan explanation](https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/backend/app/services/explanation.py): `backend/app/services/explanation.py`
- [RAG connector](https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/backend/app/services/rag_client.py): `backend/app/services/rag_client.py`

### Threat knowledge

- [Grounded explanation API](https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/rag_service/app/main.py): `rag_service/app/main.py`
- [Hybrid retrieval](https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/rag_service/app/retrieval.py): `rag_service/app/retrieval.py`
- [Vector index](https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/rag_service/app/chroma_store.py): `rag_service/app/chroma_store.py`
- [Threat corpus](https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/rag_service/app/corpus.py): `rag_service/app/corpus.py`
- [Feed ingestion](https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/rag_service/app/feed_ingestion.py): `rag_service/app/feed_ingestion.py`

### Accounts and records

- [Application database](https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/backend/app/database/connection.py): `backend/app/database/connection.py`
- [Account routes](https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/backend/app/routes/user.py): `backend/app/routes/user.py`
- [Reports and reputation](https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/backend/app/routes/reports.py): `backend/app/routes/reports.py`
- [Scan history](https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/backend/app/routes/scans.py): `backend/app/routes/scans.py`
- [Statistics](https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/backend/app/routes/stats.py): `backend/app/routes/stats.py`
- [Visit records](https://github.com/hritik3706/sih-1454-phishing-domain-detection/blob/main/backend/app/routes/visits.py): `backend/app/routes/visits.py`

### Other components

- **User**

## Connections

- User → Web dashboard: uses (evidence: `README.md`)
- User → Browser extension: browses with (evidence: `README.md`)
- Web dashboard → Web API client: requests scans
- Web authentication → Web API client: requests profile (evidence: `frontend/src/context/AuthContext.jsx`)
- Browser extension → Extension API client: requests checks (evidence: `extension/background/service-worker.js`)
- Extension API client → Backend application: calls API
- Web API client → Backend application: calls API
- Backend application → Threat-check routes: registers routes (evidence: `backend/app/main.py`)
- Backend application → Content-analysis routes: registers routes (evidence: `backend/app/main.py`)
- Backend application → Account routes: registers routes (evidence: `backend/app/main.py`)
- Backend application → Reports and reputation: registers routes (evidence: `backend/app/main.py`)
- Backend application → Scan history: registers routes (evidence: `backend/app/main.py`)
- Backend application → Statistics: registers routes (evidence: `backend/app/main.py`)
- Backend application → Visit records: registers routes (evidence: `backend/app/main.py`)
- Threat-check routes → URL and threat checks: checks URLs (evidence: `backend/app/routes/threat_detection.py`)
- Threat-check routes → Content analysis: analyzes content (evidence: `backend/app/routes/threat_detection.py`)
- Threat-check routes → Scan explanation: builds explanation (evidence: `backend/app/routes/threat_detection.py`)
- Threat-check routes → Application database: records checks (evidence: `backend/app/routes/threat_detection.py`)
- Content-analysis routes → Content analysis: analyzes input (evidence: `backend/app/routes/analyze.py`)
- Content-analysis routes → Application database: stores results (evidence: `backend/app/routes/analyze.py`)
- Threat-check routes → RAG connector: requests RAG
- RAG connector → Grounded explanation API: posts explanation request (evidence: `backend/app/services/rag_client.py`)
- Grounded explanation API → Hybrid retrieval: retrieves evidence (evidence: `rag_service/app/main.py`)
- Grounded explanation API → Threat corpus: uses corpus (evidence: `rag_service/app/main.py`)
- Grounded explanation API → Vector index: checks index (evidence: `rag_service/app/main.py`)
- Hybrid retrieval → Vector index: searches vectors (evidence: `rag_service/app/retrieval.py`)
- Feed ingestion → Threat corpus: loads documents (evidence: `rag_service/app/feed_ingestion.py`)
- Feed ingestion → Vector index: indexes chunks (evidence: `rag_service/app/feed_ingestion.py`)
- Account routes → Application database: stores accounts
- Reports and reputation → Application database: reads and writes (evidence: `backend/app/routes/reports.py`)
- Scan history → Application database: reads and writes (evidence: `backend/app/routes/scans.py`)
- Statistics → Application database: aggregates records
- Visit records → Application database: records visits
