# reactjay/zaps architecture

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

- Interactive diagram: https://gitdiagram.com/reactjay/zaps
- Repository: https://github.com/reactjay/zaps

## Overview

Zaps is a Stellar-based social payments product spanning a mobile client, Axum backend, Soroban contracts, and an operations dashboard. The principal user workflow is to create or fund a wallet, send or receive a payment, and view or interact with its social and transaction history. Fiat settlement, cross-chain funding, yield, and bulk payouts are additional product branches. Several client-to-backend and dashboard-to-backend links are not established by the sampled evidence, so they are omitted rather than inferred.

Main entry points: [`backend/src/db/models.rs`](https://github.com/reactjay/zaps/blob/master/backend/src/db/models.rs) (Postgres data), [`dashboard/app/dashboard/page.tsx`](https://github.com/reactjay/zaps/blob/master/dashboard/app/dashboard/page.tsx) (Monitoring overview), [`mobileapp/app`](https://github.com/reactjay/zaps/tree/master/mobileapp/app) (Mobile flows), [`backend/src/indexer/worker.rs`](https://github.com/reactjay/zaps/blob/master/backend/src/indexer/worker.rs) (Ledger indexer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mobile["Mobile app"]
  node_mobile_ui["Mobile flows"]
  node_mobile_api["API client<br/>[api.ts]"]
  node_tx_hook["Transaction hook<br/>[useTransactions.ts]"]
  node_tx_service["Transaction service"]
  node_offline["Offline queue<br/>[offlineQueue.ts]"]
  node_tx_types["Transaction model<br/>[transaction.ts]"]
  node_biometric["Biometric auth<br/>[biometricAuth.ts]"]
end

subgraph group_backend["Backend services"]
  node_auth_api["Authentication API<br/>[auth.rs]"]
  node_auth_middleware["Auth middleware<br/>[auth_middleware.rs]"]
  node_user_api["User and friends<br/>[user.rs]"]
  node_feed_api["Social feed<br/>[feed.rs]"]
  node_social_api["Likes and comments<br/>[social.rs]"]
  node_bridge_api["Bridge funding<br/>[bridge.rs]"]
  node_payout_api["Payouts<br/>[payouts.rs]"]
  node_yield_api["Yield API<br/>[yield.rs]"]
  node_db[("Postgres data<br/>[models.rs]")]
  node_indexer["Ledger indexer<br/>[worker.rs]"]
  node_parser["Event parser<br/>[parser.rs]"]
  node_stellar["Stellar services<br/>[stellar.rs]"]
  node_disbursement["Disbursement worker"]
end

subgraph group_chain["Soroban contracts"]
  node_social_payment_contract["Social payments<br/>[lib.rs]"]
  node_social_graph_contract["Social graph<br/>[lib.rs]"]
  node_user_registry_contract["User registry<br/>[lib.rs]"]
  node_yield_contract["Yield vault<br/>[lib.rs]"]
  node_bridge_contract["Bridge receiver<br/>[lib.rs]"]
end

subgraph group_dashboard["Operations dashboard"]
  node_dashboard_home["Monitoring overview<br/>[page.tsx]"]
  node_dashboard_analytics["Analytics<br/>[page.tsx]"]
  node_dashboard_payouts["Payout monitoring<br/>[page.tsx]"]
  node_dashboard_yield["Yield monitoring<br/>[page.tsx]"]
  node_dashboard_contracts["Contract monitoring<br/>[page.tsx]"]
end

node_user(("User"))

node_user -->|"uses"| node_mobile_ui
node_mobile_ui -.->|"requests"| node_mobile_api
node_mobile_ui -->|"loads history"| node_tx_hook
node_tx_hook -->|"fetches pages"| node_tx_service
node_tx_service -->|"uses types"| node_tx_types
node_mobile_api -->|"queues requests"| node_offline
node_mobile_api -->|"uses"| node_tx_service
node_mobile_ui -.->|"secures actions"| node_biometric
node_user -->|"authenticates"| node_auth_api
node_auth_api -->|"protects routes"| node_auth_middleware
node_user_api -.->|"reads and writes"| node_db
node_feed_api -.->|"reads and writes"| node_db
node_social_api -.->|"stores interactions"| node_db
node_bridge_api -.->|"records bridge activity"| node_db
node_payout_api -.->|"records payouts"| node_db
node_yield_api -.->|"reads and writes"| node_db
node_indexer -->|"parses events"| node_parser
node_indexer -->|"stores events"| node_db
node_indexer -->|"invalidates cache"| node_yield_api
node_disbursement -->|"claims batches"| node_db
node_disbursement -->|"submits payments"| node_stellar
node_user -->|"pays on-chain"| node_social_payment_contract
node_social_payment_contract -.->|"social graph capability"| node_social_graph_contract
node_user -.->|"registers on-chain"| node_user_registry_contract
node_user -.->|"uses yield vault"| node_yield_contract
node_user -.->|"funds through bridge"| node_bridge_contract
node_user -.->|"monitors"| node_dashboard_home
node_dashboard_home -.->|"views analytics"| node_dashboard_analytics
node_dashboard_home -.->|"monitors payouts"| node_dashboard_payouts
node_dashboard_home -.->|"monitors yield"| node_dashboard_yield
node_dashboard_home -.->|"monitors contracts"| node_dashboard_contracts

click node_mobile_ui "https://github.com/reactjay/zaps/tree/master/mobileapp/app"
click node_mobile_api "https://github.com/reactjay/zaps/blob/master/mobileapp/src/services/api.ts"
click node_tx_hook "https://github.com/reactjay/zaps/blob/master/mobileapp/src/hooks/useTransactions.ts"
click node_tx_service "https://github.com/reactjay/zaps/blob/master/mobileapp/src/services/transactionService.ts"
click node_offline "https://github.com/reactjay/zaps/blob/master/mobileapp/src/services/offlineQueue.ts"
click node_tx_types "https://github.com/reactjay/zaps/blob/master/mobileapp/src/types/transaction.ts"
click node_biometric "https://github.com/reactjay/zaps/blob/master/src/services/biometricAuth.ts"
click node_auth_api "https://github.com/reactjay/zaps/blob/master/backend/src/api/auth.rs"
click node_auth_middleware "https://github.com/reactjay/zaps/blob/master/backend/src/api/auth_middleware.rs"
click node_user_api "https://github.com/reactjay/zaps/blob/master/backend/src/api/user.rs"
click node_feed_api "https://github.com/reactjay/zaps/blob/master/backend/src/api/feed.rs"
click node_social_api "https://github.com/reactjay/zaps/blob/master/backend/src/api/social.rs"
click node_bridge_api "https://github.com/reactjay/zaps/blob/master/backend/src/api/bridge.rs"
click node_payout_api "https://github.com/reactjay/zaps/blob/master/backend/src/api/payouts.rs"
click node_yield_api "https://github.com/reactjay/zaps/blob/master/backend/src/api/yield.rs"
click node_db "https://github.com/reactjay/zaps/blob/master/backend/src/db/models.rs"
click node_indexer "https://github.com/reactjay/zaps/blob/master/backend/src/indexer/worker.rs"
click node_parser "https://github.com/reactjay/zaps/blob/master/backend/src/indexer/parser.rs"
click node_stellar "https://github.com/reactjay/zaps/blob/master/backend/src/services/stellar.rs"
click node_disbursement "https://github.com/reactjay/zaps/blob/master/backend/src/services/disbursement_worker.rs"
click node_social_payment_contract "https://github.com/reactjay/zaps/blob/master/contracts/contracts/social_payment/src/lib.rs"
click node_social_graph_contract "https://github.com/reactjay/zaps/blob/master/contracts/contracts/social_graph/src/lib.rs"
click node_user_registry_contract "https://github.com/reactjay/zaps/blob/master/contracts/contracts/user_registry/src/lib.rs"
click node_yield_contract "https://github.com/reactjay/zaps/blob/master/contracts/contracts/yield_vault/src/lib.rs"
click node_bridge_contract "https://github.com/reactjay/zaps/blob/master/contracts/contracts/allbridge_receiver/src/lib.rs"
click node_dashboard_home "https://github.com/reactjay/zaps/blob/master/dashboard/app/dashboard/page.tsx"
click node_dashboard_analytics "https://github.com/reactjay/zaps/blob/master/dashboard/app/dashboard/analytics/page.tsx"
click node_dashboard_payouts "https://github.com/reactjay/zaps/blob/master/dashboard/app/dashboard/payouts/page.tsx"
click node_dashboard_yield "https://github.com/reactjay/zaps/blob/master/dashboard/app/dashboard/yield/page.tsx"
click node_dashboard_contracts "https://github.com/reactjay/zaps/blob/master/dashboard/app/dashboard/contracts/page.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_ui,node_mobile_api,node_tx_hook,node_tx_service,node_offline,node_tx_types,node_biometric,node_user toneBlue
class node_auth_api,node_auth_middleware,node_user_api,node_feed_api,node_social_api,node_bridge_api,node_payout_api,node_yield_api,node_db,node_indexer,node_parser,node_stellar,node_disbursement toneAmber
class node_social_payment_contract,node_social_graph_contract,node_user_registry_contract,node_yield_contract,node_bridge_contract toneMint
class node_dashboard_home,node_dashboard_analytics,node_dashboard_payouts,node_dashboard_yield,node_dashboard_contracts toneRose
```

## Components

### Mobile app

- [Mobile flows](https://github.com/reactjay/zaps/tree/master/mobileapp/app): `mobileapp/app`
- [API client](https://github.com/reactjay/zaps/blob/master/mobileapp/src/services/api.ts): `mobileapp/src/services/api.ts`
- [Transaction hook](https://github.com/reactjay/zaps/blob/master/mobileapp/src/hooks/useTransactions.ts): `mobileapp/src/hooks/useTransactions.ts`
- [Transaction service](https://github.com/reactjay/zaps/blob/master/mobileapp/src/services/transactionService.ts): `mobileapp/src/services/transactionService.ts`
- [Offline queue](https://github.com/reactjay/zaps/blob/master/mobileapp/src/services/offlineQueue.ts): `mobileapp/src/services/offlineQueue.ts`
- [Transaction model](https://github.com/reactjay/zaps/blob/master/mobileapp/src/types/transaction.ts): `mobileapp/src/types/transaction.ts`
- [Biometric auth](https://github.com/reactjay/zaps/blob/master/src/services/biometricAuth.ts): `src/services/biometricAuth.ts`

### Backend services

- [Authentication API](https://github.com/reactjay/zaps/blob/master/backend/src/api/auth.rs): `backend/src/api/auth.rs`
- [Auth middleware](https://github.com/reactjay/zaps/blob/master/backend/src/api/auth_middleware.rs): `backend/src/api/auth_middleware.rs`
- [User and friends](https://github.com/reactjay/zaps/blob/master/backend/src/api/user.rs): `backend/src/api/user.rs`
- [Social feed](https://github.com/reactjay/zaps/blob/master/backend/src/api/feed.rs): `backend/src/api/feed.rs`
- [Likes and comments](https://github.com/reactjay/zaps/blob/master/backend/src/api/social.rs): `backend/src/api/social.rs`
- [Bridge funding](https://github.com/reactjay/zaps/blob/master/backend/src/api/bridge.rs): `backend/src/api/bridge.rs`
- [Payouts](https://github.com/reactjay/zaps/blob/master/backend/src/api/payouts.rs): `backend/src/api/payouts.rs`
- [Yield API](https://github.com/reactjay/zaps/blob/master/backend/src/api/yield.rs): `backend/src/api/yield.rs`
- [Postgres data](https://github.com/reactjay/zaps/blob/master/backend/src/db/models.rs): `backend/src/db/models.rs`
- [Ledger indexer](https://github.com/reactjay/zaps/blob/master/backend/src/indexer/worker.rs): `backend/src/indexer/worker.rs`
- [Event parser](https://github.com/reactjay/zaps/blob/master/backend/src/indexer/parser.rs): `backend/src/indexer/parser.rs`
- [Stellar services](https://github.com/reactjay/zaps/blob/master/backend/src/services/stellar.rs): `backend/src/services/stellar.rs`
- [Disbursement worker](https://github.com/reactjay/zaps/blob/master/backend/src/services/disbursement_worker.rs): `backend/src/services/disbursement_worker.rs`

### Soroban contracts

- [Social payments](https://github.com/reactjay/zaps/blob/master/contracts/contracts/social_payment/src/lib.rs): `contracts/contracts/social_payment/src/lib.rs`
- [Social graph](https://github.com/reactjay/zaps/blob/master/contracts/contracts/social_graph/src/lib.rs): `contracts/contracts/social_graph/src/lib.rs`
- [User registry](https://github.com/reactjay/zaps/blob/master/contracts/contracts/user_registry/src/lib.rs): `contracts/contracts/user_registry/src/lib.rs`
- [Yield vault](https://github.com/reactjay/zaps/blob/master/contracts/contracts/yield_vault/src/lib.rs): `contracts/contracts/yield_vault/src/lib.rs`
- [Bridge receiver](https://github.com/reactjay/zaps/blob/master/contracts/contracts/allbridge_receiver/src/lib.rs): `contracts/contracts/allbridge_receiver/src/lib.rs`

### Operations dashboard

- [Monitoring overview](https://github.com/reactjay/zaps/blob/master/dashboard/app/dashboard/page.tsx): `dashboard/app/dashboard/page.tsx`
- [Analytics](https://github.com/reactjay/zaps/blob/master/dashboard/app/dashboard/analytics/page.tsx): `dashboard/app/dashboard/analytics/page.tsx`
- [Payout monitoring](https://github.com/reactjay/zaps/blob/master/dashboard/app/dashboard/payouts/page.tsx): `dashboard/app/dashboard/payouts/page.tsx`
- [Yield monitoring](https://github.com/reactjay/zaps/blob/master/dashboard/app/dashboard/yield/page.tsx): `dashboard/app/dashboard/yield/page.tsx`
- [Contract monitoring](https://github.com/reactjay/zaps/blob/master/dashboard/app/dashboard/contracts/page.tsx): `dashboard/app/dashboard/contracts/page.tsx`

### Other components

- **User**

## Connections

- User → Mobile flows: uses
- Mobile flows → API client: requests
- Mobile flows → Transaction hook: loads history (evidence: `mobileapp/src/hooks/useTransactions.ts`)
- Transaction hook → Transaction service: fetches pages (evidence: `mobileapp/src/hooks/useTransactions.ts`)
- Transaction service → Transaction model: uses types (evidence: `mobileapp/src/services/transactionService.ts`)
- API client → Offline queue: queues requests (evidence: `mobileapp/src/services/api.ts`)
- API client → Transaction service: uses (evidence: `mobileapp/src/services/api.ts`)
- Mobile flows → Biometric auth: secures actions
- User → Authentication API: authenticates
- Authentication API → Auth middleware: protects routes (evidence: `backend/src/api/mod.rs`)
- User and friends → Postgres data: reads and writes
- Social feed → Postgres data: reads and writes
- Likes and comments → Postgres data: stores interactions
- Bridge funding → Postgres data: records bridge activity
- Payouts → Postgres data: records payouts
- Yield API → Postgres data: reads and writes
- Ledger indexer → Event parser: parses events (evidence: `backend/src/indexer/worker.rs`)
- Ledger indexer → Postgres data: stores events (evidence: `backend/src/indexer/worker.rs`)
- Ledger indexer → Yield API: invalidates cache (evidence: `backend/src/indexer/worker.rs`)
- Disbursement worker → Postgres data: claims batches (evidence: `backend/src/services/disbursement_worker.rs`)
- Disbursement worker → Stellar services: submits payments (evidence: `backend/src/services/disbursement_worker.rs`)
- User → Social payments: pays on-chain
- Social payments → Social graph: social graph capability
- User → User registry: registers on-chain
- User → Yield vault: uses yield vault
- User → Bridge receiver: funds through bridge
- User → Monitoring overview: monitors
- Monitoring overview → Analytics: views analytics
- Monitoring overview → Payout monitoring: monitors payouts
- Monitoring overview → Yield monitoring: monitors yield
- Monitoring overview → Contract monitoring: monitors contracts
