# sheanfinnegan/insurancechain-blockchain-based-fraud-intelligence-sharing architecture

> Architecture diagram of the GitHub repository sheanfinnegan/insurancechain-blockchain-based-fraud-intelligence-sharing, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sheanfinnegan/insurancechain-blockchain-based-fraud-intelligence-sharing
- Repository: https://github.com/sheanfinnegan/insurancechain-blockchain-based-fraud-intelligence-sharing

## Overview

InsuranceChain is a multi-portal fraud-intelligence system for insurers and a regulator. Analysts submit cases and evidence, organizations vote across a case round, and authorized users search, inspect dossiers, and export results; the regulator also oversees organizations and blockchain activity. The Next.js portal invokes API route handlers, which coordinate PostgreSQL application state, evidence object storage, and Fabric transactions. The README documents the wider permissioned network and its per-peer ledgers. Some component relationships are supported by the SOURCE INDEX or README rather than complete source excerpts; unsampled implementation details are not inferred.

Main entry points: [`components/insurance-app.tsx`](https://github.com/sheanfinnegan/insurancechain-blockchain-based-fraud-intelligence-sharing/blob/main/components/insurance-app.tsx) (Role dashboards), [`app/api/[...path]/route.ts`](https://github.com/sheanfinnegan/insurancechain-blockchain-based-fraud-intelligence-sharing/blob/main/app/api/%5B...path%5D/route.ts) (API and workflows), [`lib/fabric.ts`](https://github.com/sheanfinnegan/insurancechain-blockchain-based-fraud-intelligence-sharing/blob/main/lib/fabric.ts) (Fabric gateway client), [`lib/storage.ts`](https://github.com/sheanfinnegan/insurancechain-blockchain-based-fraud-intelligence-sharing/blob/main/lib/storage.ts) (Evidence storage)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_portals["Portals and casework"]
  node_portal["Portal entry<br/>[page.tsx]"]
  node_appui["Role dashboards<br/>[insurance-app.tsx]"]
  node_dossier["Case dossier<br/>[case-dossier.tsx]"]
  node_evidenceboard["Evidence board<br/>[evidence-board.tsx]"]
  node_pdf["Evidence preview<br/>[pdf-evidence.tsx]"]
  node_identifiers["Identifier input"]
  node_map["Fraud map<br/>[indonesia-map.tsx]"]
  node_exportui["Export filters<br/>[export-form.tsx]"]
  node_explorer["Blockchain activity"]
  node_profile["Profile menu<br/>[profile-menu.tsx]"]
end

subgraph group_api["Application services"]
  node_api["API and workflows<br/>[route.ts]"]
  node_access["Role access<br/>[role-access.ts]"]
  node_identifierlogic["Identifier handling<br/>[identifiers.ts]"]
  node_filters["Export filtering<br/>[export-filter.ts]"]
  node_fabricclient["Fabric gateway client<br/>[fabric.ts]"]
  node_fabricconfig["Gateway configuration<br/>[fabric-config.ts]"]
  node_blocklog["Transaction logging<br/>[blockchain-log.ts]"]
end

subgraph group_ledger["Fabric ledger"]
  node_fabricnetwork["Fabric peers and orderers"]
  node_chaincode["Case and voting contract<br/>[main.go]"]
end

subgraph group_state["Application data"]
  node_applicationdb[("PostgreSQL state<br/>[db.ts]")]
  node_storage["Evidence storage<br/>[storage.ts]"]
end

node_users(("Portal users"))
node_objectstore[("Evidence object store")]
node_peerledgers[("Peer ledgers")]

node_users -->|"open portal"| node_portal
node_portal -->|"renders"| node_appui
node_appui -.->|"requests workflows"| node_api
node_appui -->|"opens cases"| node_dossier
node_appui -->|"uses input"| node_identifiers
node_appui -->|"renders map"| node_map
node_appui -->|"opens export"| node_exportui
node_appui -->|"shows activity"| node_explorer
node_appui -->|"renders menu"| node_profile
node_dossier -->|"renders evidence"| node_evidenceboard
node_evidenceboard -->|"previews files"| node_pdf
node_appui -.->|"refreshes activity"| node_api
node_api -->|"reads and mutates"| node_applicationdb
node_api -->|"checks case access"| node_access
node_api -->|"handles identifiers"| node_identifierlogic
node_api -->|"filters exports"| node_filters
node_api -->|"saves evidence"| node_storage
node_storage -->|"hashes files"| node_applicationdb
node_storage -->|"writes and reads"| node_objectstore
node_api -->|"submits transactions"| node_fabricclient
node_api -->|"loads activity"| node_blocklog
node_fabricclient -->|"gets connection"| node_fabricconfig
node_fabricclient -->|"records stages"| node_blocklog
node_fabricclient -->|"evaluates or submits"| node_fabricnetwork
node_fabricnetwork -->|"invokes contract"| node_chaincode
node_fabricnetwork -->|"commits state"| node_peerledgers

click node_portal "https://github.com/sheanfinnegan/insurancechain-blockchain-based-fraud-intelligence-sharing/blob/main/app/%5Bportal%5D/page.tsx"
click node_appui "https://github.com/sheanfinnegan/insurancechain-blockchain-based-fraud-intelligence-sharing/blob/main/components/insurance-app.tsx"
click node_dossier "https://github.com/sheanfinnegan/insurancechain-blockchain-based-fraud-intelligence-sharing/blob/main/components/case-dossier.tsx"
click node_evidenceboard "https://github.com/sheanfinnegan/insurancechain-blockchain-based-fraud-intelligence-sharing/blob/main/components/evidence-board.tsx"
click node_pdf "https://github.com/sheanfinnegan/insurancechain-blockchain-based-fraud-intelligence-sharing/blob/main/components/pdf-evidence.tsx"
click node_identifiers "https://github.com/sheanfinnegan/insurancechain-blockchain-based-fraud-intelligence-sharing/blob/main/components/identifier-input.tsx"
click node_map "https://github.com/sheanfinnegan/insurancechain-blockchain-based-fraud-intelligence-sharing/blob/main/components/indonesia-map.tsx"
click node_exportui "https://github.com/sheanfinnegan/insurancechain-blockchain-based-fraud-intelligence-sharing/blob/main/components/export-form.tsx"
click node_explorer "https://github.com/sheanfinnegan/insurancechain-blockchain-based-fraud-intelligence-sharing/blob/main/components/blockchain-explorer.tsx"
click node_profile "https://github.com/sheanfinnegan/insurancechain-blockchain-based-fraud-intelligence-sharing/blob/main/components/profile-menu.tsx"
click node_api "https://github.com/sheanfinnegan/insurancechain-blockchain-based-fraud-intelligence-sharing/blob/main/app/api/%5B...path%5D/route.ts"
click node_access "https://github.com/sheanfinnegan/insurancechain-blockchain-based-fraud-intelligence-sharing/blob/main/lib/role-access.ts"
click node_identifierlogic "https://github.com/sheanfinnegan/insurancechain-blockchain-based-fraud-intelligence-sharing/blob/main/lib/identifiers.ts"
click node_filters "https://github.com/sheanfinnegan/insurancechain-blockchain-based-fraud-intelligence-sharing/blob/main/lib/export-filter.ts"
click node_fabricclient "https://github.com/sheanfinnegan/insurancechain-blockchain-based-fraud-intelligence-sharing/blob/main/lib/fabric.ts"
click node_fabricconfig "https://github.com/sheanfinnegan/insurancechain-blockchain-based-fraud-intelligence-sharing/blob/main/lib/fabric-config.ts"
click node_blocklog "https://github.com/sheanfinnegan/insurancechain-blockchain-based-fraud-intelligence-sharing/blob/main/lib/blockchain-log.ts"
click node_applicationdb "https://github.com/sheanfinnegan/insurancechain-blockchain-based-fraud-intelligence-sharing/blob/main/lib/db.ts"
click node_storage "https://github.com/sheanfinnegan/insurancechain-blockchain-based-fraud-intelligence-sharing/blob/main/lib/storage.ts"
click node_chaincode "https://github.com/sheanfinnegan/insurancechain-blockchain-based-fraud-intelligence-sharing/blob/main/chaincode/main.go"

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_appui,node_dossier,node_evidenceboard,node_pdf,node_identifiers,node_map,node_exportui,node_explorer,node_profile,node_users toneBlue
class node_api,node_access,node_identifierlogic,node_filters,node_fabricclient,node_fabricconfig,node_blocklog,node_objectstore,node_peerledgers toneAmber
class node_fabricnetwork,node_chaincode toneMint
class node_applicationdb,node_storage toneRose
```

## Components

### Portals and casework

- [Portal entry](https://github.com/sheanfinnegan/insurancechain-blockchain-based-fraud-intelligence-sharing/blob/main/app/%5Bportal%5D/page.tsx): `app/[portal]/page.tsx`
- [Role dashboards](https://github.com/sheanfinnegan/insurancechain-blockchain-based-fraud-intelligence-sharing/blob/main/components/insurance-app.tsx): `components/insurance-app.tsx`
- [Case dossier](https://github.com/sheanfinnegan/insurancechain-blockchain-based-fraud-intelligence-sharing/blob/main/components/case-dossier.tsx): `components/case-dossier.tsx`
- [Evidence board](https://github.com/sheanfinnegan/insurancechain-blockchain-based-fraud-intelligence-sharing/blob/main/components/evidence-board.tsx): `components/evidence-board.tsx`
- [Evidence preview](https://github.com/sheanfinnegan/insurancechain-blockchain-based-fraud-intelligence-sharing/blob/main/components/pdf-evidence.tsx): `components/pdf-evidence.tsx`
- [Identifier input](https://github.com/sheanfinnegan/insurancechain-blockchain-based-fraud-intelligence-sharing/blob/main/components/identifier-input.tsx): `components/identifier-input.tsx`
- [Fraud map](https://github.com/sheanfinnegan/insurancechain-blockchain-based-fraud-intelligence-sharing/blob/main/components/indonesia-map.tsx): `components/indonesia-map.tsx`
- [Export filters](https://github.com/sheanfinnegan/insurancechain-blockchain-based-fraud-intelligence-sharing/blob/main/components/export-form.tsx): `components/export-form.tsx`
- [Blockchain activity](https://github.com/sheanfinnegan/insurancechain-blockchain-based-fraud-intelligence-sharing/blob/main/components/blockchain-explorer.tsx): `components/blockchain-explorer.tsx`
- [Profile menu](https://github.com/sheanfinnegan/insurancechain-blockchain-based-fraud-intelligence-sharing/blob/main/components/profile-menu.tsx): `components/profile-menu.tsx`

### Application services

- [API and workflows](https://github.com/sheanfinnegan/insurancechain-blockchain-based-fraud-intelligence-sharing/blob/main/app/api/%5B...path%5D/route.ts): `app/api/[...path]/route.ts`
- [Role access](https://github.com/sheanfinnegan/insurancechain-blockchain-based-fraud-intelligence-sharing/blob/main/lib/role-access.ts): `lib/role-access.ts`
- [Identifier handling](https://github.com/sheanfinnegan/insurancechain-blockchain-based-fraud-intelligence-sharing/blob/main/lib/identifiers.ts): `lib/identifiers.ts`
- [Export filtering](https://github.com/sheanfinnegan/insurancechain-blockchain-based-fraud-intelligence-sharing/blob/main/lib/export-filter.ts): `lib/export-filter.ts`
- [Fabric gateway client](https://github.com/sheanfinnegan/insurancechain-blockchain-based-fraud-intelligence-sharing/blob/main/lib/fabric.ts): `lib/fabric.ts`
- [Gateway configuration](https://github.com/sheanfinnegan/insurancechain-blockchain-based-fraud-intelligence-sharing/blob/main/lib/fabric-config.ts): `lib/fabric-config.ts`
- [Transaction logging](https://github.com/sheanfinnegan/insurancechain-blockchain-based-fraud-intelligence-sharing/blob/main/lib/blockchain-log.ts): `lib/blockchain-log.ts`

### Fabric ledger

- **Fabric peers and orderers**
- [Case and voting contract](https://github.com/sheanfinnegan/insurancechain-blockchain-based-fraud-intelligence-sharing/blob/main/chaincode/main.go): `chaincode/main.go`

### Application data

- [PostgreSQL state](https://github.com/sheanfinnegan/insurancechain-blockchain-based-fraud-intelligence-sharing/blob/main/lib/db.ts): `lib/db.ts`
- [Evidence storage](https://github.com/sheanfinnegan/insurancechain-blockchain-based-fraud-intelligence-sharing/blob/main/lib/storage.ts): `lib/storage.ts`

### Other components

- **Portal users**
- **Evidence object store**
- **Peer ledgers**

## Connections

- Portal users → Portal entry: open portal
- Portal entry → Role dashboards: renders (evidence: `app/[portal]/page.tsx`)
- Role dashboards → API and workflows: requests workflows
- Role dashboards → Case dossier: opens cases (evidence: `components/insurance-app.tsx`)
- Role dashboards → Identifier input: uses input (evidence: `components/insurance-app.tsx`)
- Role dashboards → Fraud map: renders map (evidence: `components/insurance-app.tsx`)
- Role dashboards → Export filters: opens export (evidence: `components/insurance-app.tsx`)
- Role dashboards → Blockchain activity: shows activity (evidence: `components/insurance-app.tsx`)
- Role dashboards → Profile menu: renders menu (evidence: `components/insurance-app.tsx`)
- Case dossier → Evidence board: renders evidence (evidence: `components/case-dossier.tsx`)
- Evidence board → Evidence preview: previews files (evidence: `components/evidence-board.tsx`)
- Role dashboards → API and workflows: refreshes activity
- API and workflows → PostgreSQL state: reads and mutates (evidence: `app/api/[...path]/route.ts`)
- API and workflows → Role access: checks case access (evidence: `app/api/[...path]/route.ts`)
- API and workflows → Identifier handling: handles identifiers (evidence: `app/api/[...path]/route.ts`)
- API and workflows → Export filtering: filters exports (evidence: `app/api/[...path]/route.ts`)
- API and workflows → Evidence storage: saves evidence (evidence: `app/api/[...path]/route.ts`)
- Evidence storage → PostgreSQL state: hashes files (evidence: `lib/storage.ts`)
- Evidence storage → Evidence object store: writes and reads (evidence: `lib/storage.ts`)
- API and workflows → Fabric gateway client: submits transactions (evidence: `app/api/[...path]/route.ts`)
- API and workflows → Transaction logging: loads activity (evidence: `app/api/[...path]/route.ts`)
- Fabric gateway client → Gateway configuration: gets connection (evidence: `lib/fabric.ts`)
- Fabric gateway client → Transaction logging: records stages (evidence: `lib/fabric.ts`)
- Fabric gateway client → Fabric peers and orderers: evaluates or submits
- Fabric peers and orderers → Case and voting contract: invokes contract
- Fabric peers and orderers → Peer ledgers: commits state
