# vissinkus1/upi_without_internet architecture

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

- Interactive diagram: https://gitdiagram.com/vissinkus1/upi_without_internet
- Repository: https://github.com/vissinkus1/upi_without_internet

## Overview

UPI Offline Mesh demonstrates deferred payments: a sender composes a payment, encrypted packets propagate across offline peers, and an internet-connected bridge submits them for deduplicated settlement. The dashboard can drive this flow against the Spring backend or use a client-side simulator when the backend is unavailable. The README documents the backend’s encryption, freshness checks, idempotency and ledger updates; sampled frontend code shows the simulator, API fallback and packet inspection. Backend service connections below follow the README’s documented pipeline, not inspected backend source.

Main entry points: [`frontend/src/lib/api.js`](https://github.com/vissinkus1/upi_without_internet/blob/main/frontend/src/lib/api.js) (API client), [`src/main/java/com/demo/upimesh/service/BridgeIngestionService.java`](https://github.com/vissinkus1/upi_without_internet/blob/main/src/main/java/com/demo/upimesh/service/BridgeIngestionService.java) (Bridge ingestion), [`src/main/java/com/demo/upimesh/controller/ApiController.java`](https://github.com/vissinkus1/upi_without_internet/blob/main/src/main/java/com/demo/upimesh/controller/ApiController.java) (API controller), [`src/main/java/com/demo/upimesh/service/SettlementService.java`](https://github.com/vissinkus1/upi_without_internet/blob/main/src/main/java/com/demo/upimesh/service/SettlementService.java) (Settlement)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User Experience"]
  node_dashboard["Demo dashboard<br/>[page.js]"]
  node_flow["Demo controls<br/>[DemoFlowPanel.js]"]
  node_visual["Mesh visualization"]
  node_nodeinspect["Node inspector"]
  node_packetinspect["Packet inspector"]
  node_api["API client<br/>[api.js]"]
  node_polling["Polling hooks<br/>[useApi.js]"]
end

subgraph group_mesh["Offline Mesh"]
  node_sim["Mesh simulator<br/>[meshEngine.js]"]
  node_devices["Virtual devices<br/>[VirtualDevice.java]"]
  node_meshservice["Mesh simulation"]
end

subgraph group_backend["Backend Processing"]
  node_controller["API controller<br/>[ApiController.java]"]
  node_dashboardctl["Dashboard controller"]
  node_demo["Demo orchestration<br/>[DemoService.java]"]
  node_crypto["Hybrid encryption"]
  node_key["Server key holder"]
  node_bridge["Bridge ingestion"]
  node_idempotency["Idempotency claims"]
  node_settlement["Settlement"]
end

subgraph group_state["Accounts And Ledger"]
  node_accountrepo["Account repository"]
  node_txrepo["Transaction repository"]
  node_accounts[("Accounts<br/>[Account.java]")]
  node_transactions[("Transactions<br/>[Transaction.java]")]
end

node_sender(("Payment sender"))
node_bridgeactor(("Internet bridge"))

node_sender -->|"composes payment"| node_flow
node_flow -->|"submits demo"| node_api
node_dashboard -.->|"presents controls"| node_flow
node_api -->|"calls endpoints"| node_controller
node_api -->|"falls back"| node_sim
node_polling -->|"fetches state"| node_api
node_dashboard -.->|"polls state"| node_polling
node_visual -->|"opens inspector"| node_nodeinspect
node_visual -->|"opens inspector"| node_packetinspect
node_packetinspect -->|"tests replay and tamper"| node_api
node_demo -->|"encrypts payment"| node_crypto
node_crypto -.->|"uses server key"| node_key
node_demo -->|"injects packet"| node_meshservice
node_meshservice -->|"routes packets"| node_devices
node_devices -->|"carries packets"| node_bridgeactor
node_bridgeactor -->|"uploads packets"| node_bridge
node_bridge -->|"claims hash"| node_idempotency
node_bridge -->|"decrypts packet"| node_crypto
node_bridge -->|"settles valid payment"| node_settlement
node_settlement -.->|"updates balances"| node_accountrepo
node_settlement -.->|"records transaction"| node_txrepo
node_accountrepo -.->|"persists accounts"| node_accounts
node_txrepo -.->|"persists transactions"| node_transactions
node_controller -.->|"handles demo flow"| node_demo
node_controller -.->|"routes mesh actions"| node_meshservice

click node_dashboard "https://github.com/vissinkus1/upi_without_internet/blob/main/frontend/src/app/dashboard/page.js"
click node_flow "https://github.com/vissinkus1/upi_without_internet/blob/main/frontend/src/components/dashboard/DemoFlowPanel.js"
click node_visual "https://github.com/vissinkus1/upi_without_internet/blob/main/frontend/src/components/dashboard/MeshVisualization.js"
click node_nodeinspect "https://github.com/vissinkus1/upi_without_internet/blob/main/frontend/src/components/dashboard/NodeInspectorDrawer.js"
click node_packetinspect "https://github.com/vissinkus1/upi_without_internet/blob/main/frontend/src/components/dashboard/PacketInspectorModal.js"
click node_api "https://github.com/vissinkus1/upi_without_internet/blob/main/frontend/src/lib/api.js"
click node_polling "https://github.com/vissinkus1/upi_without_internet/blob/main/frontend/src/hooks/useApi.js"
click node_sim "https://github.com/vissinkus1/upi_without_internet/blob/main/frontend/src/lib/meshEngine.js"
click node_controller "https://github.com/vissinkus1/upi_without_internet/blob/main/src/main/java/com/demo/upimesh/controller/ApiController.java"
click node_dashboardctl "https://github.com/vissinkus1/upi_without_internet/blob/main/src/main/java/com/demo/upimesh/controller/DashboardController.java"
click node_demo "https://github.com/vissinkus1/upi_without_internet/blob/main/src/main/java/com/demo/upimesh/service/DemoService.java"
click node_crypto "https://github.com/vissinkus1/upi_without_internet/blob/main/src/main/java/com/demo/upimesh/crypto/HybridCryptoService.java"
click node_key "https://github.com/vissinkus1/upi_without_internet/blob/main/src/main/java/com/demo/upimesh/crypto/ServerKeyHolder.java"
click node_devices "https://github.com/vissinkus1/upi_without_internet/blob/main/src/main/java/com/demo/upimesh/service/VirtualDevice.java"
click node_meshservice "https://github.com/vissinkus1/upi_without_internet/blob/main/src/main/java/com/demo/upimesh/service/MeshSimulatorService.java"
click node_bridge "https://github.com/vissinkus1/upi_without_internet/blob/main/src/main/java/com/demo/upimesh/service/BridgeIngestionService.java"
click node_idempotency "https://github.com/vissinkus1/upi_without_internet/blob/main/src/main/java/com/demo/upimesh/service/IdempotencyService.java"
click node_settlement "https://github.com/vissinkus1/upi_without_internet/blob/main/src/main/java/com/demo/upimesh/service/SettlementService.java"
click node_accountrepo "https://github.com/vissinkus1/upi_without_internet/blob/main/src/main/java/com/demo/upimesh/model/AccountRepository.java"
click node_txrepo "https://github.com/vissinkus1/upi_without_internet/blob/main/src/main/java/com/demo/upimesh/model/TransactionRepository.java"
click node_accounts "https://github.com/vissinkus1/upi_without_internet/blob/main/src/main/java/com/demo/upimesh/model/Account.java"
click node_transactions "https://github.com/vissinkus1/upi_without_internet/blob/main/src/main/java/com/demo/upimesh/model/Transaction.java"

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_dashboard,node_flow,node_visual,node_nodeinspect,node_packetinspect,node_api,node_polling toneBlue
class node_sim,node_devices,node_meshservice toneAmber
class node_controller,node_dashboardctl,node_demo,node_crypto,node_key,node_bridge,node_idempotency,node_settlement toneMint
class node_accountrepo,node_txrepo,node_accounts,node_transactions toneRose
class node_sender,node_bridgeactor toneIndigo
```

## Components

### User Experience

- [Demo dashboard](https://github.com/vissinkus1/upi_without_internet/blob/main/frontend/src/app/dashboard/page.js): `frontend/src/app/dashboard/page.js`
- [Demo controls](https://github.com/vissinkus1/upi_without_internet/blob/main/frontend/src/components/dashboard/DemoFlowPanel.js): `frontend/src/components/dashboard/DemoFlowPanel.js`
- [Mesh visualization](https://github.com/vissinkus1/upi_without_internet/blob/main/frontend/src/components/dashboard/MeshVisualization.js): `frontend/src/components/dashboard/MeshVisualization.js`
- [Node inspector](https://github.com/vissinkus1/upi_without_internet/blob/main/frontend/src/components/dashboard/NodeInspectorDrawer.js): `frontend/src/components/dashboard/NodeInspectorDrawer.js`
- [Packet inspector](https://github.com/vissinkus1/upi_without_internet/blob/main/frontend/src/components/dashboard/PacketInspectorModal.js): `frontend/src/components/dashboard/PacketInspectorModal.js`
- [API client](https://github.com/vissinkus1/upi_without_internet/blob/main/frontend/src/lib/api.js): `frontend/src/lib/api.js`
- [Polling hooks](https://github.com/vissinkus1/upi_without_internet/blob/main/frontend/src/hooks/useApi.js): `frontend/src/hooks/useApi.js`

### Offline Mesh

- [Mesh simulator](https://github.com/vissinkus1/upi_without_internet/blob/main/frontend/src/lib/meshEngine.js): `frontend/src/lib/meshEngine.js`
- [Virtual devices](https://github.com/vissinkus1/upi_without_internet/blob/main/src/main/java/com/demo/upimesh/service/VirtualDevice.java): `src/main/java/com/demo/upimesh/service/VirtualDevice.java`
- [Mesh simulation](https://github.com/vissinkus1/upi_without_internet/blob/main/src/main/java/com/demo/upimesh/service/MeshSimulatorService.java): `src/main/java/com/demo/upimesh/service/MeshSimulatorService.java`

### Backend Processing

- [API controller](https://github.com/vissinkus1/upi_without_internet/blob/main/src/main/java/com/demo/upimesh/controller/ApiController.java): `src/main/java/com/demo/upimesh/controller/ApiController.java`
- [Dashboard controller](https://github.com/vissinkus1/upi_without_internet/blob/main/src/main/java/com/demo/upimesh/controller/DashboardController.java): `src/main/java/com/demo/upimesh/controller/DashboardController.java`
- [Demo orchestration](https://github.com/vissinkus1/upi_without_internet/blob/main/src/main/java/com/demo/upimesh/service/DemoService.java): `src/main/java/com/demo/upimesh/service/DemoService.java`
- [Hybrid encryption](https://github.com/vissinkus1/upi_without_internet/blob/main/src/main/java/com/demo/upimesh/crypto/HybridCryptoService.java): `src/main/java/com/demo/upimesh/crypto/HybridCryptoService.java`
- [Server key holder](https://github.com/vissinkus1/upi_without_internet/blob/main/src/main/java/com/demo/upimesh/crypto/ServerKeyHolder.java): `src/main/java/com/demo/upimesh/crypto/ServerKeyHolder.java`
- [Bridge ingestion](https://github.com/vissinkus1/upi_without_internet/blob/main/src/main/java/com/demo/upimesh/service/BridgeIngestionService.java): `src/main/java/com/demo/upimesh/service/BridgeIngestionService.java`
- [Idempotency claims](https://github.com/vissinkus1/upi_without_internet/blob/main/src/main/java/com/demo/upimesh/service/IdempotencyService.java): `src/main/java/com/demo/upimesh/service/IdempotencyService.java`
- [Settlement](https://github.com/vissinkus1/upi_without_internet/blob/main/src/main/java/com/demo/upimesh/service/SettlementService.java): `src/main/java/com/demo/upimesh/service/SettlementService.java`

### Accounts And Ledger

- [Account repository](https://github.com/vissinkus1/upi_without_internet/blob/main/src/main/java/com/demo/upimesh/model/AccountRepository.java): `src/main/java/com/demo/upimesh/model/AccountRepository.java`
- [Transaction repository](https://github.com/vissinkus1/upi_without_internet/blob/main/src/main/java/com/demo/upimesh/model/TransactionRepository.java): `src/main/java/com/demo/upimesh/model/TransactionRepository.java`
- [Accounts](https://github.com/vissinkus1/upi_without_internet/blob/main/src/main/java/com/demo/upimesh/model/Account.java): `src/main/java/com/demo/upimesh/model/Account.java`
- [Transactions](https://github.com/vissinkus1/upi_without_internet/blob/main/src/main/java/com/demo/upimesh/model/Transaction.java): `src/main/java/com/demo/upimesh/model/Transaction.java`

### Other components

- **Payment sender**
- **Internet bridge**

## Connections

- Payment sender → Demo controls: composes payment (evidence: `README.md`)
- Demo controls → API client: submits demo (evidence: `frontend/src/lib/api.js`)
- Demo dashboard → Demo controls: presents controls
- API client → API controller: calls endpoints (evidence: `frontend/src/lib/api.js`)
- API client → Mesh simulator: falls back (evidence: `frontend/src/lib/api.js`)
- Polling hooks → API client: fetches state
- Demo dashboard → Polling hooks: polls state
- Mesh visualization → Node inspector: opens inspector (evidence: `frontend/src/components/dashboard/MeshVisualization.js`)
- Mesh visualization → Packet inspector: opens inspector (evidence: `frontend/src/components/dashboard/MeshVisualization.js`)
- Packet inspector → API client: tests replay and tamper (evidence: `frontend/src/components/dashboard/PacketInspectorModal.js`)
- Demo orchestration → Hybrid encryption: encrypts payment (evidence: `README.md`)
- Hybrid encryption → Server key holder: uses server key
- Demo orchestration → Mesh simulation: injects packet (evidence: `README.md`)
- Mesh simulation → Virtual devices: routes packets (evidence: `README.md`)
- Virtual devices → Internet bridge: carries packets (evidence: `README.md`)
- Internet bridge → Bridge ingestion: uploads packets (evidence: `README.md`)
- Bridge ingestion → Idempotency claims: claims hash (evidence: `README.md`)
- Bridge ingestion → Hybrid encryption: decrypts packet (evidence: `README.md`)
- Bridge ingestion → Settlement: settles valid payment (evidence: `README.md`)
- Settlement → Account repository: updates balances
- Settlement → Transaction repository: records transaction
- Account repository → Accounts: persists accounts
- Transaction repository → Transactions: persists transactions
- API controller → Demo orchestration: handles demo flow
- API controller → Mesh simulation: routes mesh actions
