# aakanksha-1408/netguard architecture

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

- Interactive diagram: https://gitdiagram.com/aakanksha-1408/netguard
- Repository: https://github.com/aakanksha-1408/netguard

## Overview

NetGuard is a social-media safety app whose main user flow is checking links or QR codes and presenting a verdict with supporting evidence. Other major product areas include scam investigation, identity exposure mapping, scam-report heatmaps, articles, quizzes, and reporting. The graph follows explicit imports and calls in the sampled source index; unsampled page internals and some API wiring are not inferred.

Main entry points: [`src/lib/aiQuota.ts`](https://github.com/aakanksha-1408/netguard/blob/main/src/lib/aiQuota.ts) (AI quota and cache), [`src/components/LinkChecker.tsx`](https://github.com/aakanksha-1408/netguard/blob/main/src/components/LinkChecker.tsx) (Link checker UI), [`src/components/QRCodeScanner.tsx`](https://github.com/aakanksha-1408/netguard/blob/main/src/components/QRCodeScanner.tsx) (QR scanner UI), [`src/lib/supabase.ts`](https://github.com/aakanksha-1408/netguard/blob/main/src/lib/supabase.ts) (Supabase client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_home["Home<br/>[page.tsx]"]
  node_linkpage["Link checker page<br/>[page.tsx]"]
  node_linkui["Link checker UI<br/>[LinkChecker.tsx]"]
  node_qrpage["QR scanner page<br/>[page.tsx]"]
  node_qrui["QR scanner UI<br/>[QRCodeScanner.tsx]"]
  node_evidence["Evidence panel<br/>[EvidencePanel.tsx]"]
  node_chatpage["Chatbot page<br/>[page.tsx]"]
  node_chatui["Scam chatbot<br/>[ScamChatbot.tsx]"]
  node_identitypage["Identity map page<br/>[page.tsx]"]
  node_identitygraph["Identity graph<br/>[IdentityGraph.tsx]"]
  node_heatpage["Heatmap page<br/>[page.tsx]"]
  node_heatui["Scam heatmap<br/>[ScamHeatmap.tsx]"]
  node_articles["Articles<br/>[page.tsx]"]
  node_quiz["Safety quiz<br/>[page.tsx]"]
  node_reportpage["Report scam<br/>[page.tsx]"]
end

subgraph group_analysis["Safety analysis"]
  node_qrlogic["QR analysis<br/>[qrScanner.ts]"]
  node_linklogic["Link assessment<br/>[linkCheck.ts]"]
  node_urlscan["URL scanner<br/>[urlScanner.ts]"]
  node_identify["Evidence identification<br/>[identification.ts]"]
  node_identitylogic["Identity analysis<br/>[identityMap.ts]"]
  node_exposure["Exposure store<br/>[exposureStore.ts]"]
  node_investigator["Scam investigator"]
end

subgraph group_services["API services"]
  node_apireports["Scam reports API<br/>[route.ts]"]
  node_aiinvestigate["Investigation API<br/>[route.ts]"]
  node_ainews["News check API<br/>[route.ts]"]
  node_ailink["Link info API<br/>[route.ts]"]
  node_aiqr["QR explain API<br/>[route.ts]"]
end

subgraph group_shared["Shared services"]
  node_quota["AI quota and cache<br/>[aiQuota.ts]"]
  node_translations["Translations"]
end

subgraph group_data["Persistence"]
  node_supabase["Supabase client<br/>[supabase.ts]"]
  node_db[("Supabase database")]
end

node_user(("Visitor"))
node_gemini["Google Gemini"]

node_user -->|"opens"| node_home
node_home -->|"uses language context"| node_translations
node_linkpage -.->|"renders"| node_linkui
node_qrpage -.->|"renders"| node_qrui
node_linkui -->|"runs checks"| node_linklogic
node_linkui -->|"uses"| node_urlscan
node_linkui -->|"builds identification"| node_identify
node_linkui -->|"renders"| node_evidence
node_qrui -->|"analyzes payload"| node_qrlogic
node_qrui -->|"checks links"| node_linklogic
node_qrui -->|"builds identification"| node_identify
node_qrui -->|"renders"| node_evidence
node_evidence -->|"uses"| node_identify
node_chatpage -.->|"renders"| node_chatui
node_chatui -->|"investigates"| node_investigator
node_identitypage -->|"renders"| node_identitygraph
node_identitypage -->|"uses"| node_identitylogic
node_identitypage -->|"uses"| node_exposure
node_identitygraph -->|"renders analysis"| node_identitylogic
node_heatpage -->|"renders"| node_heatui
node_apireports -->|"queries reports"| node_supabase
node_apireports -->|"reads and writes"| node_db
node_apireports -.-> node_gemini
node_aiinvestigate -->|"uses quota helpers"| node_quota
node_ainews -->|"uses quota helpers"| node_quota
node_ailink -->|"uses quota helpers"| node_quota
node_aiqr -->|"uses quota helpers"| node_quota
node_quota -->|"reads and updates cache"| node_supabase
node_quota -->|"stores quota data"| node_db
node_quota -->|"requests generation"| node_gemini
node_supabase -->|"connects"| node_db
node_chatui -->|"uses"| node_supabase
node_identitypage -->|"uses"| node_translations
node_qrui -->|"uses lookups"| node_translations
node_linkui -->|"uses"| node_supabase

click node_home "https://github.com/aakanksha-1408/netguard/blob/main/src/app/page.tsx"
click node_linkpage "https://github.com/aakanksha-1408/netguard/blob/main/src/app/link-checker/page.tsx"
click node_linkui "https://github.com/aakanksha-1408/netguard/blob/main/src/components/LinkChecker.tsx"
click node_qrpage "https://github.com/aakanksha-1408/netguard/blob/main/src/app/qr-scanner/page.tsx"
click node_qrui "https://github.com/aakanksha-1408/netguard/blob/main/src/components/QRCodeScanner.tsx"
click node_evidence "https://github.com/aakanksha-1408/netguard/blob/main/src/components/EvidencePanel.tsx"
click node_chatpage "https://github.com/aakanksha-1408/netguard/blob/main/src/app/chatbot/page.tsx"
click node_chatui "https://github.com/aakanksha-1408/netguard/blob/main/src/components/ScamChatbot.tsx"
click node_identitypage "https://github.com/aakanksha-1408/netguard/blob/main/src/app/identity-map/page.tsx"
click node_identitygraph "https://github.com/aakanksha-1408/netguard/blob/main/src/components/IdentityGraph.tsx"
click node_heatpage "https://github.com/aakanksha-1408/netguard/blob/main/src/app/heatmap/page.tsx"
click node_heatui "https://github.com/aakanksha-1408/netguard/blob/main/src/components/ScamHeatmap.tsx"
click node_articles "https://github.com/aakanksha-1408/netguard/blob/main/src/app/articles/page.tsx"
click node_quiz "https://github.com/aakanksha-1408/netguard/blob/main/src/app/quiz/page.tsx"
click node_reportpage "https://github.com/aakanksha-1408/netguard/blob/main/src/app/report/page.tsx"
click node_qrlogic "https://github.com/aakanksha-1408/netguard/blob/main/src/lib/qrScanner.ts"
click node_linklogic "https://github.com/aakanksha-1408/netguard/blob/main/src/lib/linkCheck.ts"
click node_urlscan "https://github.com/aakanksha-1408/netguard/blob/main/src/lib/urlScanner.ts"
click node_identify "https://github.com/aakanksha-1408/netguard/blob/main/src/lib/identification.ts"
click node_identitylogic "https://github.com/aakanksha-1408/netguard/blob/main/src/lib/identityMap.ts"
click node_exposure "https://github.com/aakanksha-1408/netguard/blob/main/src/lib/exposureStore.ts"
click node_investigator "https://github.com/aakanksha-1408/netguard/blob/main/src/lib/scamInvestigator.ts"
click node_apireports "https://github.com/aakanksha-1408/netguard/blob/main/src/app/api/scam-reports/route.ts"
click node_aiinvestigate "https://github.com/aakanksha-1408/netguard/blob/main/src/app/api/gemini/investigate/route.ts"
click node_ainews "https://github.com/aakanksha-1408/netguard/blob/main/src/app/api/gemini/news-check/route.ts"
click node_ailink "https://github.com/aakanksha-1408/netguard/blob/main/src/app/api/gemini/link-info/route.ts"
click node_aiqr "https://github.com/aakanksha-1408/netguard/blob/main/src/app/api/gemini/qr-explain/route.ts"
click node_quota "https://github.com/aakanksha-1408/netguard/blob/main/src/lib/aiQuota.ts"
click node_translations "https://github.com/aakanksha-1408/netguard/tree/main/src/lib/i18n"
click node_supabase "https://github.com/aakanksha-1408/netguard/blob/main/src/lib/supabase.ts"

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_home,node_linkpage,node_linkui,node_qrpage,node_qrui,node_evidence,node_chatpage,node_chatui,node_identitypage,node_identitygraph,node_heatpage,node_heatui,node_articles,node_quiz,node_reportpage toneBlue
class node_qrlogic,node_linklogic,node_urlscan,node_identify,node_identitylogic,node_exposure,node_investigator toneAmber
class node_apireports,node_aiinvestigate,node_ainews,node_ailink,node_aiqr toneMint
class node_quota,node_translations toneRose
class node_supabase,node_db,node_user,node_gemini toneIndigo
```

## Components

### User experience

- [Home](https://github.com/aakanksha-1408/netguard/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [Link checker page](https://github.com/aakanksha-1408/netguard/blob/main/src/app/link-checker/page.tsx): `src/app/link-checker/page.tsx`
- [Link checker UI](https://github.com/aakanksha-1408/netguard/blob/main/src/components/LinkChecker.tsx): `src/components/LinkChecker.tsx`
- [QR scanner page](https://github.com/aakanksha-1408/netguard/blob/main/src/app/qr-scanner/page.tsx): `src/app/qr-scanner/page.tsx`
- [QR scanner UI](https://github.com/aakanksha-1408/netguard/blob/main/src/components/QRCodeScanner.tsx): `src/components/QRCodeScanner.tsx`
- [Evidence panel](https://github.com/aakanksha-1408/netguard/blob/main/src/components/EvidencePanel.tsx): `src/components/EvidencePanel.tsx`
- [Chatbot page](https://github.com/aakanksha-1408/netguard/blob/main/src/app/chatbot/page.tsx): `src/app/chatbot/page.tsx`
- [Scam chatbot](https://github.com/aakanksha-1408/netguard/blob/main/src/components/ScamChatbot.tsx): `src/components/ScamChatbot.tsx`
- [Identity map page](https://github.com/aakanksha-1408/netguard/blob/main/src/app/identity-map/page.tsx): `src/app/identity-map/page.tsx`
- [Identity graph](https://github.com/aakanksha-1408/netguard/blob/main/src/components/IdentityGraph.tsx): `src/components/IdentityGraph.tsx`
- [Heatmap page](https://github.com/aakanksha-1408/netguard/blob/main/src/app/heatmap/page.tsx): `src/app/heatmap/page.tsx`
- [Scam heatmap](https://github.com/aakanksha-1408/netguard/blob/main/src/components/ScamHeatmap.tsx): `src/components/ScamHeatmap.tsx`
- [Articles](https://github.com/aakanksha-1408/netguard/blob/main/src/app/articles/page.tsx): `src/app/articles/page.tsx`
- [Safety quiz](https://github.com/aakanksha-1408/netguard/blob/main/src/app/quiz/page.tsx): `src/app/quiz/page.tsx`
- [Report scam](https://github.com/aakanksha-1408/netguard/blob/main/src/app/report/page.tsx): `src/app/report/page.tsx`

### Safety analysis

- [QR analysis](https://github.com/aakanksha-1408/netguard/blob/main/src/lib/qrScanner.ts): `src/lib/qrScanner.ts`
- [Link assessment](https://github.com/aakanksha-1408/netguard/blob/main/src/lib/linkCheck.ts): `src/lib/linkCheck.ts`
- [URL scanner](https://github.com/aakanksha-1408/netguard/blob/main/src/lib/urlScanner.ts): `src/lib/urlScanner.ts`
- [Evidence identification](https://github.com/aakanksha-1408/netguard/blob/main/src/lib/identification.ts): `src/lib/identification.ts`
- [Identity analysis](https://github.com/aakanksha-1408/netguard/blob/main/src/lib/identityMap.ts): `src/lib/identityMap.ts`
- [Exposure store](https://github.com/aakanksha-1408/netguard/blob/main/src/lib/exposureStore.ts): `src/lib/exposureStore.ts`
- [Scam investigator](https://github.com/aakanksha-1408/netguard/blob/main/src/lib/scamInvestigator.ts): `src/lib/scamInvestigator.ts`

### API services

- [Scam reports API](https://github.com/aakanksha-1408/netguard/blob/main/src/app/api/scam-reports/route.ts): `src/app/api/scam-reports/route.ts`
- [Investigation API](https://github.com/aakanksha-1408/netguard/blob/main/src/app/api/gemini/investigate/route.ts): `src/app/api/gemini/investigate/route.ts`
- [News check API](https://github.com/aakanksha-1408/netguard/blob/main/src/app/api/gemini/news-check/route.ts): `src/app/api/gemini/news-check/route.ts`
- [Link info API](https://github.com/aakanksha-1408/netguard/blob/main/src/app/api/gemini/link-info/route.ts): `src/app/api/gemini/link-info/route.ts`
- [QR explain API](https://github.com/aakanksha-1408/netguard/blob/main/src/app/api/gemini/qr-explain/route.ts): `src/app/api/gemini/qr-explain/route.ts`

### Shared services

- [AI quota and cache](https://github.com/aakanksha-1408/netguard/blob/main/src/lib/aiQuota.ts): `src/lib/aiQuota.ts`
- [Translations](https://github.com/aakanksha-1408/netguard/tree/main/src/lib/i18n): `src/lib/i18n`

### Persistence

- [Supabase client](https://github.com/aakanksha-1408/netguard/blob/main/src/lib/supabase.ts): `src/lib/supabase.ts`
- **Supabase database**

### Other components

- **Visitor**
- **Google Gemini**

## Connections

- Visitor → Home: opens (evidence: `src/app/page.tsx`)
- Home → Translations: uses language context (evidence: `src/app/page.tsx`)
- Link checker page → Link checker UI: renders
- QR scanner page → QR scanner UI: renders
- Link checker UI → Link assessment: runs checks (evidence: `src/components/LinkChecker.tsx`)
- Link checker UI → URL scanner: uses (evidence: `src/components/LinkChecker.tsx`)
- Link checker UI → Evidence identification: builds identification (evidence: `src/components/LinkChecker.tsx`)
- Link checker UI → Evidence panel: renders (evidence: `src/components/LinkChecker.tsx`)
- QR scanner UI → QR analysis: analyzes payload (evidence: `src/components/QRCodeScanner.tsx`)
- QR scanner UI → Link assessment: checks links (evidence: `src/components/QRCodeScanner.tsx`)
- QR scanner UI → Evidence identification: builds identification (evidence: `src/components/QRCodeScanner.tsx`)
- QR scanner UI → Evidence panel: renders (evidence: `src/components/QRCodeScanner.tsx`)
- Evidence panel → Evidence identification: uses (evidence: `src/components/EvidencePanel.tsx`)
- Chatbot page → Scam chatbot: renders
- Scam chatbot → Scam investigator: investigates (evidence: `src/components/ScamChatbot.tsx`)
- Identity map page → Identity graph: renders (evidence: `src/app/identity-map/page.tsx`)
- Identity map page → Identity analysis: uses (evidence: `src/app/identity-map/page.tsx`)
- Identity map page → Exposure store: uses (evidence: `src/app/identity-map/page.tsx`)
- Identity graph → Identity analysis: renders analysis (evidence: `src/components/IdentityGraph.tsx`)
- Heatmap page → Scam heatmap: renders (evidence: `src/app/heatmap/page.tsx`)
- Scam reports API → Supabase client: queries reports (evidence: `src/app/api/scam-reports/route.ts`)
- Scam reports API → Supabase database: reads and writes (evidence: `src/app/api/scam-reports/route.ts`)
- Scam reports API → Google Gemini
- Investigation API → AI quota and cache: uses quota helpers (evidence: `src/app/api/gemini/investigate/route.ts`)
- News check API → AI quota and cache: uses quota helpers (evidence: `src/app/api/gemini/news-check/route.ts`)
- Link info API → AI quota and cache: uses quota helpers (evidence: `src/app/api/gemini/link-info/route.ts`)
- QR explain API → AI quota and cache: uses quota helpers (evidence: `src/app/api/gemini/qr-explain/route.ts`)
- AI quota and cache → Supabase client: reads and updates cache (evidence: `src/lib/aiQuota.ts`)
- AI quota and cache → Supabase database: stores quota data (evidence: `src/lib/aiQuota.ts`)
- AI quota and cache → Google Gemini: requests generation (evidence: `src/lib/aiQuota.ts`)
- Supabase client → Supabase database: connects (evidence: `src/lib/supabase.ts`)
- Scam chatbot → Supabase client: uses (evidence: `src/components/ScamChatbot.tsx`)
- Identity map page → Translations: uses (evidence: `src/app/identity-map/page.tsx`)
- QR scanner UI → Translations: uses lookups (evidence: `src/components/QRCodeScanner.tsx`)
- Link checker UI → Supabase client: uses (evidence: `src/components/LinkChecker.tsx`)
