# chennamsettysashank34-ux/dhwani-pay architecture

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

- Interactive diagram: https://gitdiagram.com/chennamsettysashank34-ux/dhwani-pay
- Repository: https://github.com/chennamsettysashank34-ux/dhwani-pay

## Overview

DhwaniPay is a merchant-facing mobile soundbox and payment-management app. The main workflow detects incoming payment notifications, bridges them into the app for event tracking and spoken announcements; merchants can also create UPI QR collections and manage expenses, settings, and account sync. The README documents additional gateway and cloud features whose detailed runtime wiring is only partly sampled, so those links are shown only where documented. Several screens are unsampled; their subsystem presence follows the README and file tree.

Main entry points: [`context/AppContext.tsx`](https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/context/AppContext.tsx) (App state and speech), [`app/collect.tsx`](https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/app/collect.tsx) (Collect payment), [`lib/supabase.ts`](https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/lib/supabase.ts) (Supabase client), [`modules/payment-listener/android/src/main/java/in/dhwanipay/app/modules/PaymentListenerModule.kt`](https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/modules/payment-listener/android/src/main/java/in/dhwanipay/app/modules/PaymentListenerModule.kt) (Native event bridge)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mobile["Merchant app"]
  node_home["Home dashboard<br/>[index.tsx]"]
  node_account["Authentication<br/>[auth.tsx]"]
  node_setup["Setup and diagnostics<br/>[setup.tsx]"]
  node_settings["Merchant settings<br/>[settings.tsx]"]
  node_context["App state and speech<br/>[AppContext.tsx]"]
  node_ui["Shared UI components<br/>[ui.tsx]"]
  node_theme["Theme tokens<br/>[theme.ts]"]
end

subgraph group_soundbox["Payment soundbox"]
  node_native_service["Notification listener"]
  node_android_service["Android listener service"]
  node_native_bridge["Native event bridge"]
  node_listener_api["Listener JS API<br/>[index.ts]"]
end

subgraph group_ledger["Merchant ledger"]
  node_activity["Payment activity<br/>[activity.tsx]"]
  node_event["Event details<br/>[&#91;id&#93;.tsx]"]
  node_expenses["Expense manager<br/>[expenses.tsx]"]
  node_local[("Local persistence<br/>[storage.ts]")]
end

subgraph group_collection["UPI collection"]
  node_qr_collect["Collect payment<br/>[collect.tsx]"]
  node_qr_view["UPI QR renderer<br/>[UPIQRCode.tsx]"]
  node_qr_encode["QR matrix encoder<br/>[qrMatrix.ts]"]
  node_upi_intent["UPI intent launcher<br/>[upi.ts]"]
  node_qr_vault["QR vault<br/>[qr-vault.tsx]"]
  node_presets["QR presets<br/>[vaultPresets.ts]"]
end

subgraph group_cloud["Cloud services"]
  node_supabase_client["Supabase client<br/>[supabase.ts]"]
  node_supabase_db[("Supabase database")]
  node_gateway_server["Gateway service<br/>[gatewayService.ts]"]
  node_gateway_entry["Gateway server entry<br/>[index.ts]"]
end

node_merchant(("Merchant"))
node_android_os(("Android payment apps"))
node_gateway_apps(("Webhook providers"))
node_gateway_socket(("Connected app clients"))

node_merchant -->|"uses"| node_home
node_merchant -->|"signs in"| node_account
node_home -->|"reads app state"| node_context
node_account -.->|"authenticates through"| node_context
node_merchant -->|"configures"| node_setup
node_merchant -->|"manages"| node_settings
node_android_os -->|"delivers notifications"| node_native_service
node_native_service -->|"broadcasts payment"| node_native_bridge
node_android_service -.->|"broadcasts payment"| node_native_bridge
node_native_bridge -.->|"emits event"| node_listener_api
node_listener_api -->|"feeds payment events"| node_context
node_context -->|"persists state"| node_local
node_context -->|"syncs records"| node_supabase_client
node_context -.->|"provides events"| node_activity
node_activity -->|"opens detail"| node_event
node_context -.->|"provides expense state"| node_expenses
node_context -->|"inserts expenses"| node_supabase_client
node_supabase_client -->|"stores config and session"| node_local
node_supabase_client -.->|"reads and writes"| node_supabase_db
node_merchant -->|"creates collection QR"| node_qr_collect
node_qr_collect -->|"renders payment QR"| node_qr_view
node_qr_view -->|"generates matrix"| node_qr_encode
node_qr_collect -->|"launches payment intent"| node_upi_intent
node_qr_collect -->|"selects saved QR"| node_qr_vault
node_qr_collect -->|"uses presets"| node_presets
node_gateway_apps -.->|"sends signed webhooks"| node_gateway_entry
node_gateway_entry -.->|"routes gateway work"| node_gateway_server
node_gateway_server -->|"broadcasts settlements"| node_gateway_socket
node_gateway_socket -.->|"delivers live updates"| node_context
node_ui -.->|"uses palette"| node_theme

click node_home "https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/app/(tabs)/index.tsx"
click node_account "https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/app/auth.tsx"
click node_setup "https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/app/setup.tsx"
click node_settings "https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/app/(tabs)/settings.tsx"
click node_activity "https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/app/(tabs)/activity.tsx"
click node_event "https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/app/event/%5Bid%5D.tsx"
click node_expenses "https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/app/(tabs)/expenses.tsx"
click node_context "https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/context/AppContext.tsx"
click node_local "https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/utils/storage.ts"
click node_native_service "https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/android-native/PaymentNotificationListenerService.kt"
click node_android_service "https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/android/app/src/main/java/in/dhwanipay/app/PaymentNotificationListenerService.kt"
click node_native_bridge "https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/modules/payment-listener/android/src/main/java/in/dhwanipay/app/modules/PaymentListenerModule.kt"
click node_listener_api "https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/modules/payment-listener/index.ts"
click node_qr_collect "https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/app/collect.tsx"
click node_qr_view "https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/components/UPIQRCode.tsx"
click node_qr_encode "https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/utils/qrMatrix.ts"
click node_upi_intent "https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/utils/upi.ts"
click node_qr_vault "https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/app/qr-vault.tsx"
click node_presets "https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/constants/vaultPresets.ts"
click node_supabase_client "https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/lib/supabase.ts"
click node_gateway_server "https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/server/src/gatewayService.ts"
click node_gateway_entry "https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/server/src/index.ts"
click node_ui "https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/components/ui.tsx"
click node_theme "https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/constants/theme.ts"

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_home,node_account,node_setup,node_settings,node_context,node_ui,node_theme,node_gateway_socket toneBlue
class node_native_service,node_android_service,node_native_bridge,node_listener_api toneAmber
class node_activity,node_event,node_expenses,node_local,node_gateway_apps toneMint
class node_qr_collect,node_qr_view,node_qr_encode,node_upi_intent,node_qr_vault,node_presets toneRose
class node_supabase_client,node_supabase_db,node_gateway_server,node_gateway_entry,node_merchant,node_android_os toneIndigo
```

## Components

### Merchant app

- [Home dashboard](https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/app/(tabs)/index.tsx): `app/(tabs)/index.tsx`
- [Authentication](https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/app/auth.tsx): `app/auth.tsx`
- [Setup and diagnostics](https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/app/setup.tsx): `app/setup.tsx`
- [Merchant settings](https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/app/(tabs)/settings.tsx): `app/(tabs)/settings.tsx`
- [App state and speech](https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/context/AppContext.tsx): `context/AppContext.tsx`
- [Shared UI components](https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/components/ui.tsx): `components/ui.tsx`
- [Theme tokens](https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/constants/theme.ts): `constants/theme.ts`

### Payment soundbox

- [Notification listener](https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/android-native/PaymentNotificationListenerService.kt): `android-native/PaymentNotificationListenerService.kt`
- [Android listener service](https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/android/app/src/main/java/in/dhwanipay/app/PaymentNotificationListenerService.kt): `android/app/src/main/java/in/dhwanipay/app/PaymentNotificationListenerService.kt`
- [Native event bridge](https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/modules/payment-listener/android/src/main/java/in/dhwanipay/app/modules/PaymentListenerModule.kt): `modules/payment-listener/android/src/main/java/in/dhwanipay/app/modules/PaymentListenerModule.kt`
- [Listener JS API](https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/modules/payment-listener/index.ts): `modules/payment-listener/index.ts`

### Merchant ledger

- [Payment activity](https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/app/(tabs)/activity.tsx): `app/(tabs)/activity.tsx`
- [Event details](https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/app/event/%5Bid%5D.tsx): `app/event/[id].tsx`
- [Expense manager](https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/app/(tabs)/expenses.tsx): `app/(tabs)/expenses.tsx`
- [Local persistence](https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/utils/storage.ts): `utils/storage.ts`

### UPI collection

- [Collect payment](https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/app/collect.tsx): `app/collect.tsx`
- [UPI QR renderer](https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/components/UPIQRCode.tsx): `components/UPIQRCode.tsx`
- [QR matrix encoder](https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/utils/qrMatrix.ts): `utils/qrMatrix.ts`
- [UPI intent launcher](https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/utils/upi.ts): `utils/upi.ts`
- [QR vault](https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/app/qr-vault.tsx): `app/qr-vault.tsx`
- [QR presets](https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/constants/vaultPresets.ts): `constants/vaultPresets.ts`

### Cloud services

- [Supabase client](https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/lib/supabase.ts): `lib/supabase.ts`
- **Supabase database**
- [Gateway service](https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/server/src/gatewayService.ts): `server/src/gatewayService.ts`
- [Gateway server entry](https://github.com/chennamsettysashank34-ux/dhwani-pay/blob/main/server/src/index.ts): `server/src/index.ts`

### Other components

- **Merchant**
- **Android payment apps**
- **Webhook providers**
- **Connected app clients**

## Connections

- Merchant → Home dashboard: uses (evidence: `README.md`)
- Merchant → Authentication: signs in (evidence: `README.md`)
- Home dashboard → App state and speech: reads app state (evidence: `app/(tabs)/index.tsx`)
- Authentication → App state and speech: authenticates through
- Merchant → Setup and diagnostics: configures (evidence: `README.md`)
- Merchant → Merchant settings: manages (evidence: `README.md`)
- Android payment apps → Notification listener: delivers notifications (evidence: `README.md`)
- Notification listener → Native event bridge: broadcasts payment (evidence: `README.md`)
- Android listener service → Native event bridge: broadcasts payment
- Native event bridge → Listener JS API: emits event
- Listener JS API → App state and speech: feeds payment events (evidence: `context/AppContext.tsx`)
- App state and speech → Local persistence: persists state (evidence: `context/AppContext.tsx`)
- App state and speech → Supabase client: syncs records (evidence: `context/AppContext.tsx`)
- App state and speech → Payment activity: provides events
- Payment activity → Event details: opens detail (evidence: `README.md`)
- App state and speech → Expense manager: provides expense state
- App state and speech → Supabase client: inserts expenses (evidence: `context/AppContext.tsx`)
- Supabase client → Local persistence: stores config and session (evidence: `lib/supabase.ts`)
- Supabase client → Supabase database: reads and writes
- Merchant → Collect payment: creates collection QR (evidence: `README.md`)
- Collect payment → UPI QR renderer: renders payment QR (evidence: `app/collect.tsx`)
- UPI QR renderer → QR matrix encoder: generates matrix (evidence: `components/UPIQRCode.tsx`)
- Collect payment → UPI intent launcher: launches payment intent (evidence: `app/collect.tsx`)
- Collect payment → QR vault: selects saved QR (evidence: `app/collect.tsx`)
- Collect payment → QR presets: uses presets (evidence: `app/collect.tsx`)
- Webhook providers → Gateway server entry: sends signed webhooks
- Gateway server entry → Gateway service: routes gateway work
- Gateway service → Connected app clients: broadcasts settlements (evidence: `README.md`)
- Connected app clients → App state and speech: delivers live updates
- Shared UI components → Theme tokens: uses palette
