# swiftbyte6/sih2026-2.0 architecture

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

- Interactive diagram: https://gitdiagram.com/swiftbyte6/sih2026-2.0
- Repository: https://github.com/swiftbyte6/sih2026-2.0

## Overview

The product is an AICTE portal for institutions to register and manage security deposits/FDRs and for officials to verify, review, and process them. Its central path is instrument/document submission, server-side extraction and regulatory checks, then human review and auditable case actions. The README documents lifecycle, release, renewal, administration, and integration capabilities. Some page and storage implementations were not sampled, so links to those areas are omitted unless documented.

Main entry points: [`lib/dataService.js`](https://github.com/swiftbyte6/sih2026-2.0/blob/main/lib/dataService.js) (Unified data gateway), [`app/official/verification/[id]/page.js`](https://github.com/swiftbyte6/sih2026-2.0/blob/main/app/official/verification/%5Bid%5D/page.js) (Case verification), [`app/api/intelligence/analyze/route.js`](https://github.com/swiftbyte6/sih2026-2.0/blob/main/app/api/intelligence/analyze/route.js) (Analysis endpoint), [`lib/intelligence/fdrOcrService.js`](https://github.com/swiftbyte6/sih2026-2.0/blob/main/lib/intelligence/fdrOcrService.js) (Document extraction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_portal["Portal workflows"]
  node_instrument_entry["Instrument submission<br/>[page.js]"]
  node_institution_portal["Institution workspace"]
  node_official_verification["Case verification<br/>[page.js]"]
end

subgraph group_intelligence["Verification intelligence"]
  node_intelligence_hub["Intelligence Hub"]
  node_analyze_api["Analysis endpoint<br/>[route.js]"]
  node_action_api["Reviewer actions<br/>[route.js]"]
  node_ocr_api["FDR OCR endpoint<br/>[route.js]"]
  node_ocr_service["Document extraction<br/>[fdrOcrService.js]"]
  node_crosscheck["Cross-document checks"]
  node_discrepancy["Discrepancy engine"]
  node_regulatory["Regulatory rules<br/>[regulatoryRules.js]"]
  node_risk["Risk scoring<br/>[riskScoring.js]"]
  node_gemini["Gemini provider<br/>[geminiProvider.js]"]
end

subgraph group_services["Data services"]
  node_data_service["Unified data gateway<br/>[dataService.js]"]
  node_demo_store[("Demo case data<br/>[mockData.js]")]
  node_live_store[("Live Supabase data<br/>[dataLive.js]")]
  node_mode_config["Data-mode config<br/>[config.js]"]
end

subgraph group_operations["Operations and lifecycle"]
  node_release["Release processing"]
  node_renewal["Renewal and maturity"]
  node_admin["Administration"]
  node_email["Email delivery<br/>[route.js]"]
end

node_institution(("Institution user"))
node_official(("Official reviewer"))

node_institution -->|"submits documents"| node_instrument_entry
node_institution -->|"manages deposits"| node_institution_portal
node_instrument_entry -->|"stores instrument data"| node_data_service
node_instrument_entry -->|"requests extraction"| node_ocr_service
node_intelligence_hub -->|"requests analysis"| node_analyze_api
node_intelligence_hub -->|"loads case data"| node_data_service
node_analyze_api -->|"invokes provider"| node_gemini
node_analyze_api -->|"runs checks"| node_crosscheck
node_analyze_api -->|"evaluates compliance"| node_regulatory
node_analyze_api -->|"loads case data"| node_data_service
node_gemini -->|"uses extraction"| node_ocr_service
node_ocr_api -->|"extracts document"| node_ocr_service
node_ocr_api -->|"loads and saves data"| node_data_service
node_official -->|"reviews case"| node_official_verification
node_official_verification -->|"checks discrepancies"| node_discrepancy
node_official_verification -->|"scores risk"| node_risk
node_risk -->|"uses findings"| node_discrepancy
node_discrepancy -->|"normalizes bank names"| node_ocr_service
node_official_verification -->|"reads case data"| node_data_service
node_official_verification -->|"records reviewer actions"| node_action_api
node_action_api -->|"updates case"| node_data_service
node_data_service -->|"selects data mode"| node_mode_config
node_data_service -->|"reads demo records"| node_demo_store
node_data_service -->|"delegates live queries"| node_live_store
node_institution -->|"manages renewal"| node_renewal
node_official -->|"reviews release"| node_release
node_official -.->|"administers portal"| node_admin
node_admin -.->|"sends notices"| node_email

click node_instrument_entry "https://github.com/swiftbyte6/sih2026-2.0/blob/main/app/institution/instruments/new/page.js"
click node_institution_portal "https://github.com/swiftbyte6/sih2026-2.0/tree/main/app/institution"
click node_official_verification "https://github.com/swiftbyte6/sih2026-2.0/blob/main/app/official/verification/%5Bid%5D/page.js"
click node_intelligence_hub "https://github.com/swiftbyte6/sih2026-2.0/blob/main/components/intelligence/IntelligenceHubView.js"
click node_analyze_api "https://github.com/swiftbyte6/sih2026-2.0/blob/main/app/api/intelligence/analyze/route.js"
click node_action_api "https://github.com/swiftbyte6/sih2026-2.0/blob/main/app/api/intelligence/action/route.js"
click node_ocr_api "https://github.com/swiftbyte6/sih2026-2.0/blob/main/app/api/intelligence/ocr-fdr/route.js"
click node_ocr_service "https://github.com/swiftbyte6/sih2026-2.0/blob/main/lib/intelligence/fdrOcrService.js"
click node_crosscheck "https://github.com/swiftbyte6/sih2026-2.0/blob/main/lib/intelligence/crossDocumentVerifier.js"
click node_discrepancy "https://github.com/swiftbyte6/sih2026-2.0/blob/main/lib/intelligence/discrepancyEngine.js"
click node_regulatory "https://github.com/swiftbyte6/sih2026-2.0/blob/main/lib/intelligence/regulatoryRules.js"
click node_risk "https://github.com/swiftbyte6/sih2026-2.0/blob/main/lib/intelligence/riskScoring.js"
click node_gemini "https://github.com/swiftbyte6/sih2026-2.0/blob/main/lib/intelligence/geminiProvider.js"
click node_data_service "https://github.com/swiftbyte6/sih2026-2.0/blob/main/lib/dataService.js"
click node_demo_store "https://github.com/swiftbyte6/sih2026-2.0/blob/main/lib/mockData.js"
click node_live_store "https://github.com/swiftbyte6/sih2026-2.0/blob/main/lib/supabase/dataLive.js"
click node_mode_config "https://github.com/swiftbyte6/sih2026-2.0/blob/main/lib/config.js"
click node_release "https://github.com/swiftbyte6/sih2026-2.0/tree/main/app/official/release"
click node_renewal "https://github.com/swiftbyte6/sih2026-2.0/tree/main/app/institution/renewals"
click node_admin "https://github.com/swiftbyte6/sih2026-2.0/tree/main/app/admin"
click node_email "https://github.com/swiftbyte6/sih2026-2.0/blob/main/app/api/email/send/route.js"

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_instrument_entry,node_institution_portal,node_official_verification,node_institution,node_official toneBlue
class node_intelligence_hub,node_analyze_api,node_action_api,node_ocr_api,node_ocr_service,node_crosscheck,node_discrepancy,node_regulatory,node_risk,node_gemini toneAmber
class node_data_service,node_demo_store,node_live_store,node_mode_config toneMint
class node_release,node_renewal,node_admin,node_email toneRose
```

## Components

### Portal workflows

- [Instrument submission](https://github.com/swiftbyte6/sih2026-2.0/blob/main/app/institution/instruments/new/page.js): `app/institution/instruments/new/page.js`
- [Institution workspace](https://github.com/swiftbyte6/sih2026-2.0/tree/main/app/institution): `app/institution`
- [Case verification](https://github.com/swiftbyte6/sih2026-2.0/blob/main/app/official/verification/%5Bid%5D/page.js): `app/official/verification/[id]/page.js`

### Verification intelligence

- [Intelligence Hub](https://github.com/swiftbyte6/sih2026-2.0/blob/main/components/intelligence/IntelligenceHubView.js): `components/intelligence/IntelligenceHubView.js`
- [Analysis endpoint](https://github.com/swiftbyte6/sih2026-2.0/blob/main/app/api/intelligence/analyze/route.js): `app/api/intelligence/analyze/route.js`
- [Reviewer actions](https://github.com/swiftbyte6/sih2026-2.0/blob/main/app/api/intelligence/action/route.js): `app/api/intelligence/action/route.js`
- [FDR OCR endpoint](https://github.com/swiftbyte6/sih2026-2.0/blob/main/app/api/intelligence/ocr-fdr/route.js): `app/api/intelligence/ocr-fdr/route.js`
- [Document extraction](https://github.com/swiftbyte6/sih2026-2.0/blob/main/lib/intelligence/fdrOcrService.js): `lib/intelligence/fdrOcrService.js`
- [Cross-document checks](https://github.com/swiftbyte6/sih2026-2.0/blob/main/lib/intelligence/crossDocumentVerifier.js): `lib/intelligence/crossDocumentVerifier.js`
- [Discrepancy engine](https://github.com/swiftbyte6/sih2026-2.0/blob/main/lib/intelligence/discrepancyEngine.js): `lib/intelligence/discrepancyEngine.js`
- [Regulatory rules](https://github.com/swiftbyte6/sih2026-2.0/blob/main/lib/intelligence/regulatoryRules.js): `lib/intelligence/regulatoryRules.js`
- [Risk scoring](https://github.com/swiftbyte6/sih2026-2.0/blob/main/lib/intelligence/riskScoring.js): `lib/intelligence/riskScoring.js`
- [Gemini provider](https://github.com/swiftbyte6/sih2026-2.0/blob/main/lib/intelligence/geminiProvider.js): `lib/intelligence/geminiProvider.js`

### Data services

- [Unified data gateway](https://github.com/swiftbyte6/sih2026-2.0/blob/main/lib/dataService.js): `lib/dataService.js`
- [Demo case data](https://github.com/swiftbyte6/sih2026-2.0/blob/main/lib/mockData.js): `lib/mockData.js`
- [Live Supabase data](https://github.com/swiftbyte6/sih2026-2.0/blob/main/lib/supabase/dataLive.js): `lib/supabase/dataLive.js`
- [Data-mode config](https://github.com/swiftbyte6/sih2026-2.0/blob/main/lib/config.js): `lib/config.js`

### Operations and lifecycle

- [Release processing](https://github.com/swiftbyte6/sih2026-2.0/tree/main/app/official/release): `app/official/release`
- [Renewal and maturity](https://github.com/swiftbyte6/sih2026-2.0/tree/main/app/institution/renewals): `app/institution/renewals`
- [Administration](https://github.com/swiftbyte6/sih2026-2.0/tree/main/app/admin): `app/admin`
- [Email delivery](https://github.com/swiftbyte6/sih2026-2.0/blob/main/app/api/email/send/route.js): `app/api/email/send/route.js`

### Other components

- **Institution user**
- **Official reviewer**

## Connections

- Institution user → Instrument submission: submits documents
- Institution user → Institution workspace: manages deposits
- Instrument submission → Unified data gateway: stores instrument data (evidence: `app/institution/instruments/new/page.js`)
- Instrument submission → Document extraction: requests extraction (evidence: `app/institution/instruments/new/page.js`)
- Intelligence Hub → Analysis endpoint: requests analysis
- Intelligence Hub → Unified data gateway: loads case data (evidence: `components/intelligence/IntelligenceHubView.js`)
- Analysis endpoint → Gemini provider: invokes provider (evidence: `app/api/intelligence/analyze/route.js`)
- Analysis endpoint → Cross-document checks: runs checks (evidence: `app/api/intelligence/analyze/route.js`)
- Analysis endpoint → Regulatory rules: evaluates compliance (evidence: `app/api/intelligence/analyze/route.js`)
- Analysis endpoint → Unified data gateway: loads case data (evidence: `app/api/intelligence/analyze/route.js`)
- Gemini provider → Document extraction: uses extraction (evidence: `lib/intelligence/geminiProvider.js`)
- FDR OCR endpoint → Document extraction: extracts document (evidence: `app/api/intelligence/ocr-fdr/route.js`)
- FDR OCR endpoint → Unified data gateway: loads and saves data (evidence: `app/api/intelligence/ocr-fdr/route.js`)
- Official reviewer → Case verification: reviews case
- Case verification → Discrepancy engine: checks discrepancies (evidence: `app/official/verification/[id]/page.js`)
- Case verification → Risk scoring: scores risk (evidence: `app/official/verification/[id]/page.js`)
- Risk scoring → Discrepancy engine: uses findings (evidence: `lib/intelligence/riskScoring.js`)
- Discrepancy engine → Document extraction: normalizes bank names (evidence: `lib/intelligence/discrepancyEngine.js`)
- Case verification → Unified data gateway: reads case data (evidence: `app/official/verification/[id]/page.js`)
- Case verification → Reviewer actions: records reviewer actions
- Reviewer actions → Unified data gateway: updates case (evidence: `app/api/intelligence/action/route.js`)
- Unified data gateway → Data-mode config: selects data mode (evidence: `lib/dataService.js`)
- Unified data gateway → Demo case data: reads demo records (evidence: `lib/dataService.js`)
- Unified data gateway → Live Supabase data: delegates live queries (evidence: `lib/dataService.js`)
- Institution user → Renewal and maturity: manages renewal
- Official reviewer → Release processing: reviews release
- Official reviewer → Administration: administers portal
- Administration → Email delivery: sends notices
