# jpsiddharth2008/mindforge-tatva-finals architecture

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

- Interactive diagram: https://gitdiagram.com/jpsiddharth2008/mindforge-tatva-finals
- Repository: https://github.com/jpsiddharth2008/mindforge-tatva-finals

## Overview

MindForge provides an officer portal for issuing and managing institutional documents, plus a public verification flow. Issuance stores document bytes and metadata, then supports an on-chain credential step; verification has a fast exact-hash lookup and a richer three-tier engine. The README notes the forensic verdict engine is not yet connected to verification, so that branch is shown as a documented capability rather than an active endpoint. Several backend modules were not sampled, so uncertain internal links are omitted.

Main entry points: [`backend/app.js`](https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/backend/app.js) (REST routes), [`frontend/src/api.js`](https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/frontend/src/api.js) (API client), [`backend/verification.js`](https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/backend/verification.js) (Tiered verification), [`frontend/src/App.jsx`](https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/frontend/src/App.jsx) (Web portal)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["User portals"]
  node_portal["Web portal<br/>[App.jsx]"]
  node_issue_ui["Issue document<br/>[Issue.jsx]"]
  node_verify_ui["Verify document<br/>[Verify.jsx]"]
  node_record_ui["Document management<br/>[DocumentDetail.jsx]"]
  node_browser_api["API client<br/>[api.js]"]
  node_flows["Issuance and revoke flows<br/>[flows.js]"]
end

subgraph group_api["API and identity"]
  node_auth_ui["Officer session<br/>[auth.jsx]"]
  node_api_server["REST routes<br/>[app.js]"]
  node_auth["Authentication<br/>[auth.js]"]
end

subgraph group_document["Credential lifecycle"]
  node_issuance["Issuance coordinator<br/>[issuance.js]"]
  node_document_records[("Document records<br/>[documents.js]")]
  node_audit[("Audit trail<br/>[audit.js]")]
  node_qr["QR payload<br/>[qr.js]"]
end

subgraph group_verify["Verification engine"]
  node_exact_hash["SHA-256 lookup<br/>[app.js]"]
  node_verification["Tiered verification<br/>[verification.js]"]
  node_extract["Field extraction<br/>[extract.js]"]
  node_canonical["Canonical content hash"]
  node_preprocess["Image preprocessing"]
  node_ocr["OCR<br/>[ocr.service.js]"]
  node_phash["Perceptual analysis<br/>[phash.js]"]
  node_forensics["Verdict and field diffs<br/>[forensics.js]"]
end

subgraph group_trust["Persistence and trust"]
  node_storage[("Document object storage<br/>[storage.js]")]
  node_chain_service["Blockchain service"]
  node_chain_config["Blockchain configuration<br/>[blockchain.js]"]
  node_chain_ui["Wallet chain actions<br/>[chain.js]"]
  node_mongo[("MongoDB")]
  node_s3[("AWS S3")]
  node_polygon{{"Polygon network"}}
end

node_officer(("Issuing officer"))
node_public(("Public verifier"))

node_officer -->|"uses"| node_portal
node_public -->|"uses"| node_portal
node_portal -->|"routes to"| node_issue_ui
node_portal -->|"routes to"| node_verify_ui
node_issue_ui -->|"uploads to"| node_browser_api
node_verify_ui -->|"submits to"| node_browser_api
node_record_ui -->|"loads records"| node_browser_api
node_issue_ui -->|"starts flow"| node_flows
node_record_ui -->|"starts revoke"| node_flows
node_flows -->|"sends transaction"| node_chain_ui
node_flows -->|"reports status"| node_browser_api
node_auth_ui -->|"tracks session"| node_browser_api
node_browser_api -->|"calls API"| node_api_server
node_api_server -->|"checks identity"| node_auth
node_api_server -->|"coordinates issue"| node_issuance
node_issuance -->|"reads and writes"| node_document_records
node_api_server -->|"stores bytes"| node_storage
node_api_server -->|"handles hash lookup"| node_exact_hash
node_exact_hash -->|"looks up hash"| node_document_records
node_api_server -->|"dispatches verify"| node_verification
node_verification -->|"computes visual tier"| node_phash
node_verification -->|"extracts fields"| node_extract
node_extract -->|"hashes fields"| node_canonical
node_ocr -->|"preprocesses image"| node_preprocess
node_verification -.->|"assembles verdict"| node_forensics
node_verification -->|"checks QR"| node_qr
node_api_server -->|"records activity"| node_audit
node_api_server -.->|"checks chain"| node_chain_service
node_chain_service -->|"loads settings"| node_chain_config
node_chain_service -.->|"reads chain"| node_polygon
node_document_records -.->|"persists metadata"| node_mongo
node_storage -->|"stores objects"| node_s3
node_chain_ui -.->|"submits transactions"| node_polygon
node_api_server -->|"serves records"| node_document_records
node_api_server -.->|"serves QR payload"| node_qr

click node_portal "https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/frontend/src/App.jsx"
click node_issue_ui "https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/frontend/src/pages/Issue.jsx"
click node_verify_ui "https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/frontend/src/pages/Verify.jsx"
click node_record_ui "https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/frontend/src/pages/DocumentDetail.jsx"
click node_browser_api "https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/frontend/src/api.js"
click node_auth_ui "https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/frontend/src/auth.jsx"
click node_api_server "https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/backend/app.js"
click node_auth "https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/backend/auth.js"
click node_issuance "https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/backend/issuance.js"
click node_document_records "https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/backend/documents.js"
click node_audit "https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/backend/audit.js"
click node_storage "https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/backend/storage.js"
click node_chain_service "https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/backend/src/services/blockchain.service.js"
click node_chain_config "https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/backend/src/config/blockchain.js"
click node_chain_ui "https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/frontend/src/chain.js"
click node_flows "https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/frontend/src/flows.js"
click node_exact_hash "https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/backend/app.js"
click node_verification "https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/backend/verification.js"
click node_extract "https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/backend/extract.js"
click node_canonical "https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/backend/src/services/canonical.service.js"
click node_preprocess "https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/backend/src/services/preprocess.service.js"
click node_ocr "https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/backend/src/services/ocr.service.js"
click node_phash "https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/backend/phash.js"
click node_forensics "https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/backend/forensics.js"
click node_qr "https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/backend/qr.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_portal,node_issue_ui,node_verify_ui,node_record_ui,node_browser_api,node_flows toneBlue
class node_auth_ui,node_api_server,node_auth toneAmber
class node_issuance,node_document_records,node_audit,node_qr toneMint
class node_exact_hash,node_verification,node_extract,node_canonical,node_preprocess,node_ocr,node_phash,node_forensics toneRose
class node_storage,node_chain_service,node_chain_config,node_chain_ui,node_mongo,node_s3,node_polygon,node_officer,node_public toneIndigo
```

## Components

### User portals

- [Web portal](https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Issue document](https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/frontend/src/pages/Issue.jsx): `frontend/src/pages/Issue.jsx`
- [Verify document](https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/frontend/src/pages/Verify.jsx): `frontend/src/pages/Verify.jsx`
- [Document management](https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/frontend/src/pages/DocumentDetail.jsx): `frontend/src/pages/DocumentDetail.jsx`
- [API client](https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/frontend/src/api.js): `frontend/src/api.js`
- [Issuance and revoke flows](https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/frontend/src/flows.js): `frontend/src/flows.js`

### API and identity

- [Officer session](https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/frontend/src/auth.jsx): `frontend/src/auth.jsx`
- [REST routes](https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/backend/app.js): `backend/app.js`
- [Authentication](https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/backend/auth.js): `backend/auth.js`

### Credential lifecycle

- [Issuance coordinator](https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/backend/issuance.js): `backend/issuance.js`
- [Document records](https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/backend/documents.js): `backend/documents.js`
- [Audit trail](https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/backend/audit.js): `backend/audit.js`
- [QR payload](https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/backend/qr.js): `backend/qr.js`

### Verification engine

- [SHA-256 lookup](https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/backend/app.js): `backend/app.js`
- [Tiered verification](https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/backend/verification.js): `backend/verification.js`
- [Field extraction](https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/backend/extract.js): `backend/extract.js`
- [Canonical content hash](https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/backend/src/services/canonical.service.js): `backend/src/services/canonical.service.js`
- [Image preprocessing](https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/backend/src/services/preprocess.service.js): `backend/src/services/preprocess.service.js`
- [OCR](https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/backend/src/services/ocr.service.js): `backend/src/services/ocr.service.js`
- [Perceptual analysis](https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/backend/phash.js): `backend/phash.js`
- [Verdict and field diffs](https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/backend/forensics.js): `backend/forensics.js`

### Persistence and trust

- [Document object storage](https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/backend/storage.js): `backend/storage.js`
- [Blockchain service](https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/backend/src/services/blockchain.service.js): `backend/src/services/blockchain.service.js`
- [Blockchain configuration](https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/backend/src/config/blockchain.js): `backend/src/config/blockchain.js`
- [Wallet chain actions](https://github.com/jpsiddharth2008/mindforge-tatva-finals/blob/main/frontend/src/chain.js): `frontend/src/chain.js`
- **MongoDB**
- **AWS S3**
- **Polygon network**

### Other components

- **Issuing officer**
- **Public verifier**

## Connections

- Issuing officer → Web portal: uses (evidence: `README.md`)
- Public verifier → Web portal: uses (evidence: `README.md`)
- Web portal → Issue document: routes to (evidence: `frontend/src/App.jsx`)
- Web portal → Verify document: routes to (evidence: `frontend/src/App.jsx`)
- Issue document → API client: uploads to (evidence: `frontend/src/pages/Issue.jsx`)
- Verify document → API client: submits to (evidence: `frontend/src/api.js`)
- Document management → API client: loads records (evidence: `frontend/src/pages/DocumentDetail.jsx`)
- Issue document → Issuance and revoke flows: starts flow (evidence: `frontend/src/pages/Issue.jsx`)
- Document management → Issuance and revoke flows: starts revoke (evidence: `frontend/src/pages/DocumentDetail.jsx`)
- Issuance and revoke flows → Wallet chain actions: sends transaction (evidence: `frontend/src/flows.js`)
- Issuance and revoke flows → API client: reports status (evidence: `frontend/src/flows.js`)
- Officer session → API client: tracks session (evidence: `frontend/src/auth.jsx`)
- API client → REST routes: calls API (evidence: `frontend/src/api.js`)
- REST routes → Authentication: checks identity (evidence: `backend/app.js`)
- REST routes → Issuance coordinator: coordinates issue (evidence: `backend/app.js`)
- Issuance coordinator → Document records: reads and writes (evidence: `backend/issuance.js`)
- REST routes → Document object storage: stores bytes (evidence: `backend/app.js`)
- REST routes → SHA-256 lookup: handles hash lookup (evidence: `backend/app.js`)
- SHA-256 lookup → Document records: looks up hash (evidence: `backend/app.js`)
- REST routes → Tiered verification: dispatches verify (evidence: `backend/app.js`)
- Tiered verification → Perceptual analysis: computes visual tier (evidence: `backend/verification.js`)
- Tiered verification → Field extraction: extracts fields (evidence: `backend/verification.js`)
- Field extraction → Canonical content hash: hashes fields (evidence: `backend/extract.js`)
- OCR → Image preprocessing: preprocesses image (evidence: `backend/src/services/ocr.service.js`)
- Tiered verification → Verdict and field diffs: assembles verdict (evidence: `backend/verification.js`)
- Tiered verification → QR payload: checks QR (evidence: `backend/verification.js`)
- REST routes → Audit trail: records activity (evidence: `backend/app.js`)
- REST routes → Blockchain service: checks chain
- Blockchain service → Blockchain configuration: loads settings (evidence: `backend/src/services/blockchain.service.js`)
- Blockchain service → Polygon network: reads chain
- Document records → MongoDB: persists metadata
- Document object storage → AWS S3: stores objects (evidence: `backend/storage.js`)
- Wallet chain actions → Polygon network: submits transactions
- REST routes → Document records: serves records (evidence: `backend/app.js`)
- REST routes → QR payload: serves QR payload (evidence: `backend/app.js`)
