# imposterbharathkumarburugu15-cpu/prem architecture

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

- Interactive diagram: https://gitdiagram.com/imposterbharathkumarburugu15-cpu/prem
- Repository: https://github.com/imposterbharathkumarburugu15-cpu/prem

## Overview

PRAMAN is an evidence and provenance platform: farmers capture evidence, which can be queued offline and synchronized; backend services record supply-chain events and audit data, while reviewers assess flagged evidence and public users verify provenance. The web console provides operational workspaces, administration, and public verification; the mobile app supports farmer setup and capture. Excerpts establish the app routing, event recording, review decisions, and native persistence/sync, but do not show all service-to-route wiring or the AI and verification internals, so those connections are omitted where uncertain.

Main entry points: [`frontend/src/App.tsx`](https://github.com/imposterbharathkumarburugu15-cpu/prem/blob/main/frontend/src/App.tsx) (Web application), [`backend/app/main.py`](https://github.com/imposterbharathkumarburugu15-cpu/prem/blob/main/backend/app/main.py) (API server), [`backend/app/services/event_engine.py`](https://github.com/imposterbharathkumarburugu15-cpu/prem/blob/main/backend/app/services/event_engine.py) (Supply-chain events), [`mobile/android/app/src/main/java/org/praman/farmer/storage/NativeStorageBridge.java`](https://github.com/imposterbharathkumarburugu15-cpu/prem/blob/main/mobile/android/app/src/main/java/org/praman/farmer/storage/NativeStorageBridge.java) (Native bridge)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mobile["Farmer mobile"]
  node_mobile_app["Farmer app<br/>[App.tsx]"]
  node_capture["Evidence capture"]
  node_native_bridge["Native bridge"]
  node_offline_store[("Offline evidence store")]
  node_sync_engine["Evidence sync"]
end

subgraph group_web["Web console"]
  node_web_app["Web application<br/>[App.tsx]"]
  node_workspaces["Operational workspaces"]
  node_public_verify["Public verification"]
  node_api_client["API client<br/>[api.ts]"]
  node_farmer_web["Evidence officer"]
end

subgraph group_backend["Platform backend"]
  node_api_server["API server<br/>[main.py]"]
  node_api_routes["API routes"]
  node_event_engine["Supply-chain events<br/>[event_engine.py]"]
  node_evidence_storage[("Evidence blob storage<br/>[content_storage.py]")]
  node_relational_db[("Relational database<br/>[database.py]")]
  node_review["Human review<br/>[reviewer.py]"]
end

subgraph group_trust["Trust and intelligence"]
  node_ai_dispatch["AI dispatcher<br/>[ai_dispatcher.py]"]
  node_truth_engine["Evidence assessment<br/>[truth_engine.py]"]
  node_crypto["Cryptographic authority<br/>[authority.py]"]
  node_audit["Audit service<br/>[audit_service.py]"]
end

node_farmer(("Farmer"))

node_farmer -->|"uses"| node_mobile_app
node_mobile_app -->|"opens capture"| node_capture
node_capture -.->|"saves evidence"| node_native_bridge
node_native_bridge -->|"persists records"| node_offline_store
node_native_bridge -->|"delegates sync"| node_sync_engine
node_sync_engine -->|"loads pending"| node_offline_store
node_sync_engine -->|"posts enrollment"| node_api_routes
node_web_app -->|"routes to"| node_workspaces
node_web_app -->|"routes to"| node_public_verify
node_web_app -->|"routes to"| node_farmer_web
node_farmer_web -->|"uses"| node_api_client
node_api_server -->|"mounts router"| node_api_routes
node_api_server -->|"initializes schema"| node_relational_db
node_api_server -->|"starts worker"| node_ai_dispatch
node_event_engine -->|"queries and writes"| node_relational_db
node_event_engine -->|"stores content"| node_evidence_storage
node_event_engine -->|"records audit"| node_audit
node_review -->|"reads and updates"| node_relational_db
node_review -->|"logs decision"| node_audit

click node_mobile_app "https://github.com/imposterbharathkumarburugu15-cpu/prem/blob/main/mobile/App.tsx"
click node_capture "https://github.com/imposterbharathkumarburugu15-cpu/prem/blob/main/mobile/src/screens/EvidenceCaptureScreen.tsx"
click node_native_bridge "https://github.com/imposterbharathkumarburugu15-cpu/prem/blob/main/mobile/android/app/src/main/java/org/praman/farmer/storage/NativeStorageBridge.java"
click node_offline_store "https://github.com/imposterbharathkumarburugu15-cpu/prem/blob/main/mobile/android/app/src/main/java/org/praman/farmer/storage/EvidenceDbHelper.java"
click node_sync_engine "https://github.com/imposterbharathkumarburugu15-cpu/prem/blob/main/mobile/android/app/src/main/java/org/praman/farmer/sync/EvidenceSyncEngine.java"
click node_web_app "https://github.com/imposterbharathkumarburugu15-cpu/prem/blob/main/frontend/src/App.tsx"
click node_workspaces "https://github.com/imposterbharathkumarburugu15-cpu/prem/tree/main/frontend/src/pages"
click node_public_verify "https://github.com/imposterbharathkumarburugu15-cpu/prem/blob/main/frontend/src/pages/PublicVerifyPage.tsx"
click node_api_client "https://github.com/imposterbharathkumarburugu15-cpu/prem/blob/main/frontend/src/services/api.ts"
click node_api_server "https://github.com/imposterbharathkumarburugu15-cpu/prem/blob/main/backend/app/main.py"
click node_api_routes "https://github.com/imposterbharathkumarburugu15-cpu/prem/tree/main/backend/app/api/v1"
click node_event_engine "https://github.com/imposterbharathkumarburugu15-cpu/prem/blob/main/backend/app/services/event_engine.py"
click node_evidence_storage "https://github.com/imposterbharathkumarburugu15-cpu/prem/blob/main/backend/app/storage/content_storage.py"
click node_relational_db "https://github.com/imposterbharathkumarburugu15-cpu/prem/blob/main/backend/app/core/database.py"
click node_review "https://github.com/imposterbharathkumarburugu15-cpu/prem/blob/main/backend/app/api/v1/reviewer.py"
click node_ai_dispatch "https://github.com/imposterbharathkumarburugu15-cpu/prem/blob/main/backend/app/services/ai_dispatcher.py"
click node_truth_engine "https://github.com/imposterbharathkumarburugu15-cpu/prem/blob/main/backend/app/services/truth_engine.py"
click node_crypto "https://github.com/imposterbharathkumarburugu15-cpu/prem/blob/main/crypto/authority.py"
click node_audit "https://github.com/imposterbharathkumarburugu15-cpu/prem/blob/main/backend/app/services/audit_service.py"
click node_farmer_web "https://github.com/imposterbharathkumarburugu15-cpu/prem/blob/main/frontend/src/pages/EvidenceOfficerWorkspace.tsx"

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_mobile_app,node_capture,node_native_bridge,node_offline_store,node_sync_engine toneBlue
class node_web_app,node_workspaces,node_public_verify,node_api_client,node_farmer_web toneAmber
class node_api_server,node_api_routes,node_event_engine,node_evidence_storage,node_relational_db,node_review toneMint
class node_ai_dispatch,node_truth_engine,node_crypto,node_audit toneRose
class node_farmer toneIndigo
```

## Components

### Farmer mobile

- [Farmer app](https://github.com/imposterbharathkumarburugu15-cpu/prem/blob/main/mobile/App.tsx): `mobile/App.tsx`
- [Evidence capture](https://github.com/imposterbharathkumarburugu15-cpu/prem/blob/main/mobile/src/screens/EvidenceCaptureScreen.tsx): `mobile/src/screens/EvidenceCaptureScreen.tsx`
- [Native bridge](https://github.com/imposterbharathkumarburugu15-cpu/prem/blob/main/mobile/android/app/src/main/java/org/praman/farmer/storage/NativeStorageBridge.java): `mobile/android/app/src/main/java/org/praman/farmer/storage/NativeStorageBridge.java`
- [Offline evidence store](https://github.com/imposterbharathkumarburugu15-cpu/prem/blob/main/mobile/android/app/src/main/java/org/praman/farmer/storage/EvidenceDbHelper.java): `mobile/android/app/src/main/java/org/praman/farmer/storage/EvidenceDbHelper.java`
- [Evidence sync](https://github.com/imposterbharathkumarburugu15-cpu/prem/blob/main/mobile/android/app/src/main/java/org/praman/farmer/sync/EvidenceSyncEngine.java): `mobile/android/app/src/main/java/org/praman/farmer/sync/EvidenceSyncEngine.java`

### Web console

- [Web application](https://github.com/imposterbharathkumarburugu15-cpu/prem/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Operational workspaces](https://github.com/imposterbharathkumarburugu15-cpu/prem/tree/main/frontend/src/pages): `frontend/src/pages`
- [Public verification](https://github.com/imposterbharathkumarburugu15-cpu/prem/blob/main/frontend/src/pages/PublicVerifyPage.tsx): `frontend/src/pages/PublicVerifyPage.tsx`
- [API client](https://github.com/imposterbharathkumarburugu15-cpu/prem/blob/main/frontend/src/services/api.ts): `frontend/src/services/api.ts`
- [Evidence officer](https://github.com/imposterbharathkumarburugu15-cpu/prem/blob/main/frontend/src/pages/EvidenceOfficerWorkspace.tsx): `frontend/src/pages/EvidenceOfficerWorkspace.tsx`

### Platform backend

- [API server](https://github.com/imposterbharathkumarburugu15-cpu/prem/blob/main/backend/app/main.py): `backend/app/main.py`
- [API routes](https://github.com/imposterbharathkumarburugu15-cpu/prem/tree/main/backend/app/api/v1): `backend/app/api/v1`
- [Supply-chain events](https://github.com/imposterbharathkumarburugu15-cpu/prem/blob/main/backend/app/services/event_engine.py): `backend/app/services/event_engine.py`
- [Evidence blob storage](https://github.com/imposterbharathkumarburugu15-cpu/prem/blob/main/backend/app/storage/content_storage.py): `backend/app/storage/content_storage.py`
- [Relational database](https://github.com/imposterbharathkumarburugu15-cpu/prem/blob/main/backend/app/core/database.py): `backend/app/core/database.py`
- [Human review](https://github.com/imposterbharathkumarburugu15-cpu/prem/blob/main/backend/app/api/v1/reviewer.py): `backend/app/api/v1/reviewer.py`

### Trust and intelligence

- [AI dispatcher](https://github.com/imposterbharathkumarburugu15-cpu/prem/blob/main/backend/app/services/ai_dispatcher.py): `backend/app/services/ai_dispatcher.py`
- [Evidence assessment](https://github.com/imposterbharathkumarburugu15-cpu/prem/blob/main/backend/app/services/truth_engine.py): `backend/app/services/truth_engine.py`
- [Cryptographic authority](https://github.com/imposterbharathkumarburugu15-cpu/prem/blob/main/crypto/authority.py): `crypto/authority.py`
- [Audit service](https://github.com/imposterbharathkumarburugu15-cpu/prem/blob/main/backend/app/services/audit_service.py): `backend/app/services/audit_service.py`

### Other components

- **Farmer**

## Connections

- Farmer → Farmer app: uses (evidence: `mobile/App.tsx`)
- Farmer app → Evidence capture: opens capture (evidence: `mobile/App.tsx`)
- Evidence capture → Native bridge: saves evidence
- Native bridge → Offline evidence store: persists records (evidence: `mobile/android/app/src/main/java/org/praman/farmer/storage/NativeStorageBridge.java`)
- Native bridge → Evidence sync: delegates sync (evidence: `mobile/android/app/src/main/java/org/praman/farmer/storage/NativeStorageBridge.java`)
- Evidence sync → Offline evidence store: loads pending (evidence: `mobile/android/app/src/main/java/org/praman/farmer/sync/EvidenceSyncEngine.java`)
- Evidence sync → API routes: posts enrollment (evidence: `mobile/android/app/src/main/java/org/praman/farmer/sync/EvidenceSyncEngine.java`)
- Web application → Operational workspaces: routes to (evidence: `frontend/src/App.tsx`)
- Web application → Public verification: routes to (evidence: `frontend/src/App.tsx`)
- Web application → Evidence officer: routes to (evidence: `frontend/src/App.tsx`)
- Evidence officer → API client: uses (evidence: `frontend/src/pages/EvidenceOfficerWorkspace.tsx`)
- API server → API routes: mounts router (evidence: `backend/app/main.py`)
- API server → Relational database: initializes schema (evidence: `backend/app/main.py`)
- API server → AI dispatcher: starts worker (evidence: `backend/app/main.py`)
- Supply-chain events → Relational database: queries and writes (evidence: `backend/app/services/event_engine.py`)
- Supply-chain events → Evidence blob storage: stores content (evidence: `backend/app/services/event_engine.py`)
- Supply-chain events → Audit service: records audit (evidence: `backend/app/services/event_engine.py`)
- Human review → Relational database: reads and updates (evidence: `backend/app/api/v1/reviewer.py`)
- Human review → Audit service: logs decision (evidence: `backend/app/api/v1/reviewer.py`)
