# rshakib/dpt architecture

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

- Interactive diagram: https://gitdiagram.com/rshakib/dpt
- Repository: https://github.com/rshakib/dpt

## Overview

DPT is a mobile digital-wallet and banking app. Users activate or log in, reach a dashboard, and use flows for transfers, QR/NFC payments, bills, recharge, and cash-out; transaction screens lead to processing and results. Auth, security, local storage, and background synchronization support those flows, while Android code provides NFC host-card emulation and keystore capabilities. The map reflects the sampled sources and SOURCE INDEX references; several route implementations and native registration details were not inspected, so uncertain connections are omitted.

Main entry points: [`src/services/db.ts`](https://github.com/rshakib/dpt/blob/master/src/services/db.ts) (Local wallet database), [`src/context/AuthContext.tsx`](https://github.com/rshakib/dpt/blob/master/src/context/AuthContext.tsx) (Session management), [`src/components/TransactionProcessingView.tsx`](https://github.com/rshakib/dpt/blob/master/src/components/TransactionProcessingView.tsx) (Transaction processing), [`src/services/sync.ts`](https://github.com/rshakib/dpt/blob/master/src/services/sync.ts) (Offline synchronization)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_wallet["Wallet experience"]
  node_onboarding["Onboarding and login<br/>[login.tsx]"]
  node_dashboard["Wallet dashboard<br/>[dashboard.tsx]"]
  node_money["Money movement<br/>[send-money.tsx]"]
  node_qr["QR payments<br/>[qr-pay.tsx]"]
  node_nfc["NFC transfers<br/>[nfc-transfer.tsx]"]
  node_billpay["Bills and recharge<br/>[bills.tsx]"]
  node_processing["Transaction processing"]
  node_results["Transaction results"]
end

subgraph group_identity["Identity and security"]
  node_authscreen["Transaction authorization"]
  node_auth["Session management<br/>[AuthContext.tsx]"]
  node_security["PIN security<br/>[security.ts]"]
  node_crypto["Device cryptography<br/>[crypto.ts]"]
end

subgraph group_platform["Wallet services"]
  node_api["Backend API<br/>[api.ts]"]
  node_sync["Offline synchronization<br/>[sync.ts]"]
  node_database[("Local wallet database<br/>[db.ts]")]
  node_mapper["Transaction mapping"]
  node_nfcservice["NFC service<br/>[nfc.ts]"]
end

subgraph group_native["Android capabilities"]
  node_hce["HCE bridge<br/>[DptHceModule.kt]"]
  node_hceservice["Card emulation service<br/>[DptHceService.kt]"]
  node_keystore["Android keystore"]
end

node_user(("Wallet user"))
node_backend["Wallet backend"]
node_sqlite[("SQLite")]
node_securestore[("Platform secure storage")]

node_user -->|"starts"| node_onboarding
node_user -->|"uses"| node_dashboard
node_dashboard -->|"fetches wallet data"| node_api
node_dashboard -->|"reads cached data"| node_database
node_dashboard -->|"subscribes to sync"| node_sync
node_dashboard -->|"maps transactions"| node_mapper
node_onboarding -.->|"authenticates"| node_auth
node_auth -->|"calls API"| node_api
node_auth -->|"clears user cache"| node_database
node_auth -->|"starts sync"| node_sync
node_auth -->|"saves PIN hash"| node_security
node_auth -->|"generates keys"| node_crypto
node_money -.->|"submits transaction"| node_processing
node_qr -->|"calls API"| node_api
node_qr -->|"uses local data"| node_database
node_qr -->|"uses cryptography"| node_crypto
node_qr -->|"uses synchronization"| node_sync
node_nfc -->|"uses NFC"| node_nfcservice
node_nfc -->|"uses local data"| node_database
node_nfc -->|"uses synchronization"| node_sync
node_nfc -->|"checks security"| node_security
node_nfc -->|"renders authorization"| node_authscreen
node_billpay -.->|"submits transaction"| node_processing
node_processing -->|"calls API"| node_api
node_processing -->|"uses cryptography"| node_crypto
node_processing -->|"uses local data"| node_database
node_processing -->|"uses synchronization"| node_sync
node_processing -->|"checks security"| node_security
node_authscreen -->|"verifies PIN"| node_security
node_authscreen -.->|"uses API"| node_api
node_results -.->|"shows outcome"| node_user
node_api -->|"sends requests"| node_backend
node_sync -->|"fetches and submits"| node_api
node_sync -->|"reads and updates"| node_database
node_database -->|"stores wallet data"| node_sqlite
node_database -->|"stores queued secrets"| node_securestore
node_hce -->|"uses service"| node_hceservice
node_nfcservice -.->|"bridges to native NFC"| node_hce
node_auth -.->|"uses native keys"| node_keystore

click node_onboarding "https://github.com/rshakib/dpt/blob/master/src/app/login.tsx"
click node_dashboard "https://github.com/rshakib/dpt/blob/master/src/app/dashboard.tsx"
click node_money "https://github.com/rshakib/dpt/blob/master/src/app/send-money.tsx"
click node_qr "https://github.com/rshakib/dpt/blob/master/src/app/qr-pay.tsx"
click node_nfc "https://github.com/rshakib/dpt/blob/master/src/app/nfc-transfer.tsx"
click node_billpay "https://github.com/rshakib/dpt/blob/master/src/app/bills.tsx"
click node_processing "https://github.com/rshakib/dpt/blob/master/src/components/TransactionProcessingView.tsx"
click node_authscreen "https://github.com/rshakib/dpt/blob/master/src/components/TransactionAuthScreen.tsx"
click node_results "https://github.com/rshakib/dpt/blob/master/src/app/transaction-result.tsx"
click node_auth "https://github.com/rshakib/dpt/blob/master/src/context/AuthContext.tsx"
click node_security "https://github.com/rshakib/dpt/blob/master/src/utils/security.ts"
click node_crypto "https://github.com/rshakib/dpt/blob/master/src/services/crypto.ts"
click node_api "https://github.com/rshakib/dpt/blob/master/src/services/api.ts"
click node_sync "https://github.com/rshakib/dpt/blob/master/src/services/sync.ts"
click node_database "https://github.com/rshakib/dpt/blob/master/src/services/db.ts"
click node_mapper "https://github.com/rshakib/dpt/blob/master/src/utils/transactionMapper.ts"
click node_nfcservice "https://github.com/rshakib/dpt/blob/master/src/services/nfc.ts"
click node_hce "https://github.com/rshakib/dpt/blob/master/android/app/src/main/java/com/riajulshakib/dptapp/DptHceModule.kt"
click node_hceservice "https://github.com/rshakib/dpt/blob/master/android/app/src/main/java/com/riajulshakib/dptapp/DptHceService.kt"
click node_keystore "https://github.com/rshakib/dpt/blob/master/android/app/src/main/java/com/riajulshakib/dptapp/DptKeystoreModule.kt"

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_onboarding,node_dashboard,node_money,node_qr,node_nfc,node_billpay,node_processing,node_results,node_user toneBlue
class node_authscreen,node_auth,node_security,node_crypto,node_sqlite,node_securestore toneAmber
class node_api,node_sync,node_database,node_mapper,node_nfcservice toneMint
class node_hce,node_hceservice,node_keystore toneRose
class node_backend toneIndigo
```

## Components

### Wallet experience

- [Onboarding and login](https://github.com/rshakib/dpt/blob/master/src/app/login.tsx): `src/app/login.tsx`
- [Wallet dashboard](https://github.com/rshakib/dpt/blob/master/src/app/dashboard.tsx): `src/app/dashboard.tsx`
- [Money movement](https://github.com/rshakib/dpt/blob/master/src/app/send-money.tsx): `src/app/send-money.tsx`
- [QR payments](https://github.com/rshakib/dpt/blob/master/src/app/qr-pay.tsx): `src/app/qr-pay.tsx`
- [NFC transfers](https://github.com/rshakib/dpt/blob/master/src/app/nfc-transfer.tsx): `src/app/nfc-transfer.tsx`
- [Bills and recharge](https://github.com/rshakib/dpt/blob/master/src/app/bills.tsx): `src/app/bills.tsx`
- [Transaction processing](https://github.com/rshakib/dpt/blob/master/src/components/TransactionProcessingView.tsx): `src/components/TransactionProcessingView.tsx`
- [Transaction results](https://github.com/rshakib/dpt/blob/master/src/app/transaction-result.tsx): `src/app/transaction-result.tsx`

### Identity and security

- [Transaction authorization](https://github.com/rshakib/dpt/blob/master/src/components/TransactionAuthScreen.tsx): `src/components/TransactionAuthScreen.tsx`
- [Session management](https://github.com/rshakib/dpt/blob/master/src/context/AuthContext.tsx): `src/context/AuthContext.tsx`
- [PIN security](https://github.com/rshakib/dpt/blob/master/src/utils/security.ts): `src/utils/security.ts`
- [Device cryptography](https://github.com/rshakib/dpt/blob/master/src/services/crypto.ts): `src/services/crypto.ts`

### Wallet services

- [Backend API](https://github.com/rshakib/dpt/blob/master/src/services/api.ts): `src/services/api.ts`
- [Offline synchronization](https://github.com/rshakib/dpt/blob/master/src/services/sync.ts): `src/services/sync.ts`
- [Local wallet database](https://github.com/rshakib/dpt/blob/master/src/services/db.ts): `src/services/db.ts`
- [Transaction mapping](https://github.com/rshakib/dpt/blob/master/src/utils/transactionMapper.ts): `src/utils/transactionMapper.ts`
- [NFC service](https://github.com/rshakib/dpt/blob/master/src/services/nfc.ts): `src/services/nfc.ts`

### Android capabilities

- [HCE bridge](https://github.com/rshakib/dpt/blob/master/android/app/src/main/java/com/riajulshakib/dptapp/DptHceModule.kt): `android/app/src/main/java/com/riajulshakib/dptapp/DptHceModule.kt`
- [Card emulation service](https://github.com/rshakib/dpt/blob/master/android/app/src/main/java/com/riajulshakib/dptapp/DptHceService.kt): `android/app/src/main/java/com/riajulshakib/dptapp/DptHceService.kt`
- [Android keystore](https://github.com/rshakib/dpt/blob/master/android/app/src/main/java/com/riajulshakib/dptapp/DptKeystoreModule.kt): `android/app/src/main/java/com/riajulshakib/dptapp/DptKeystoreModule.kt`

### Other components

- **Wallet user**
- **Wallet backend**
- **SQLite**
- **Platform secure storage**

## Connections

- Wallet user → Onboarding and login: starts
- Wallet user → Wallet dashboard: uses
- Wallet dashboard → Backend API: fetches wallet data (evidence: `src/app/dashboard.tsx`)
- Wallet dashboard → Local wallet database: reads cached data (evidence: `src/app/dashboard.tsx`)
- Wallet dashboard → Offline synchronization: subscribes to sync (evidence: `src/app/dashboard.tsx`)
- Wallet dashboard → Transaction mapping: maps transactions (evidence: `src/app/dashboard.tsx`)
- Onboarding and login → Session management: authenticates
- Session management → Backend API: calls API (evidence: `src/context/AuthContext.tsx`)
- Session management → Local wallet database: clears user cache (evidence: `src/context/AuthContext.tsx`)
- Session management → Offline synchronization: starts sync (evidence: `src/context/AuthContext.tsx`)
- Session management → PIN security: saves PIN hash (evidence: `src/context/AuthContext.tsx`)
- Session management → Device cryptography: generates keys (evidence: `src/context/AuthContext.tsx`)
- Money movement → Transaction processing: submits transaction
- QR payments → Backend API: calls API (evidence: `src/app/qr-pay.tsx`)
- QR payments → Local wallet database: uses local data (evidence: `src/app/qr-pay.tsx`)
- QR payments → Device cryptography: uses cryptography (evidence: `src/app/qr-pay.tsx`)
- QR payments → Offline synchronization: uses synchronization (evidence: `src/app/qr-pay.tsx`)
- NFC transfers → NFC service: uses NFC (evidence: `src/app/nfc-transfer.tsx`)
- NFC transfers → Local wallet database: uses local data (evidence: `src/app/nfc-transfer.tsx`)
- NFC transfers → Offline synchronization: uses synchronization (evidence: `src/app/nfc-transfer.tsx`)
- NFC transfers → PIN security: checks security (evidence: `src/app/nfc-transfer.tsx`)
- NFC transfers → Transaction authorization: renders authorization (evidence: `src/app/nfc-transfer.tsx`)
- Bills and recharge → Transaction processing: submits transaction
- Transaction processing → Backend API: calls API (evidence: `src/components/TransactionProcessingView.tsx`)
- Transaction processing → Device cryptography: uses cryptography (evidence: `src/components/TransactionProcessingView.tsx`)
- Transaction processing → Local wallet database: uses local data (evidence: `src/components/TransactionProcessingView.tsx`)
- Transaction processing → Offline synchronization: uses synchronization (evidence: `src/components/TransactionProcessingView.tsx`)
- Transaction processing → PIN security: checks security (evidence: `src/components/TransactionProcessingView.tsx`)
- Transaction authorization → PIN security: verifies PIN (evidence: `src/components/TransactionAuthScreen.tsx`)
- Transaction authorization → Backend API: uses API
- Transaction results → Wallet user: shows outcome
- Backend API → Wallet backend: sends requests (evidence: `src/services/api.ts`)
- Offline synchronization → Backend API: fetches and submits (evidence: `src/services/sync.ts`)
- Offline synchronization → Local wallet database: reads and updates (evidence: `src/services/sync.ts`)
- Local wallet database → SQLite: stores wallet data (evidence: `src/services/db.ts`)
- Local wallet database → Platform secure storage: stores queued secrets (evidence: `src/services/db.ts`)
- HCE bridge → Card emulation service: uses service (evidence: `android/app/src/main/java/com/riajulshakib/dptapp/DptHceModule.kt`)
- NFC service → HCE bridge: bridges to native NFC
- Session management → Android keystore: uses native keys
