# rendbit/crossborderpayment architecture

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

- Interactive diagram: https://gitdiagram.com/rendbit/crossborderpayment
- Repository: https://github.com/rendbit/crossborderpayment

## Overview

#### Purpose and entry points
RendBit is a cross-border payments platform combining a Stellar-based wallet/transfer backend, fiat on/off-ramp providers, and a user-facing web client. The backend API starts at `backend/src/server.ts`; the SPA starts at `client/src/main.tsx` and composes routes/views through `client/src/App.tsx`. A separate Node proxy service is exposed from `proxyserver/index.js`.

#### API boundary and access control
Backend routes separate customer, administrative, compliance, super-admin, support, payment, and Stellar/SEP endpoints. Requests flow from route modules into controllers, then services, with validation and role-specific authentication middleware at the boundary.
- `backend/src/routes/transaction.ts`
- `backend/src/routes/multisig.ts`
- `backend/src/middlewares/authMiddleWare.ts`

Rate limiting, API-key checks, transaction-limit enforcement, standardized responses, and socket authentication are centralized middleware concerns rather than embedded in feature services.

#### Payment, wallet, and Stellar execution
Transaction orchestration is centered on transfer/transaction services and Stellar provider implementations. This layer likely builds/submits blockchain operations, retrieves Horizon data, supports Stellar authentication and SEP-24 anchor interactions, and records application-side transaction history.
- `backend/src/services/transaction.ts`
- `backend/src/services/transfer.ts`
- `backend/src/providers/stellar/transactions.ts`

Blockchain integration is abstracted behind a factory, allowing provider selection without coupling controllers directly to Stellar mechanics:
- `backend/src/providers/blockchainFactory.ts`
- `backend/src/providers/stellar/horizonQueries.ts`
- `backend/src/controllers/sep24.ts`

#### Fiat ramps and provider adapters
Fiat deposit/withdrawal and ramp workflows are handled through a provider-manager boundary and dedicated adapters for Linkio and SafeHaven. Controllers/services coordinate user-facing ramp state, while provider modules encapsulate external API behavior and country/bank/mobile-money integration.
- `backend/src/providers/bank.provider.manager.ts`
- `backend/src/services/ramp.ts`
- `backend/src/services/providers/linkio/linkioRampAdapter.ts`

Relevant persisted operational records include ramp transactions and withdrawals:
- `backend/src/models/RampTransaction.ts`
- `backend/src/models/Withdrawal.ts`

#### Security, identity, and compliance
Authentication includes JWT-oriented auth, MFA, PIN protections, KYC, liveness/face verification, guardian workflows, fraud detection, audit logging, and compliance-specific access. These checks form a gate around regulated money movement and privileged operations.
- `backend/src/services/auth.ts`
- `backend/src/services/kyc.ts`
- `backend/src/services/liveness/livenessVerifier.ts`

Security/compliance evidence and alerts are modeled separately from core users and transactions:
- `backend/src/models/Kyc.ts`
- `backend/src/models/AuditLog.ts`
- `backend/src/models/FraudAlert.ts`

#### Stateful payment products and asynchronous processing
Recurring payments, savings rules, and multisignature approvals have dedicated domain services and persistence. Scheduler/worker pairs indicate deferred execution outside the synchronous HTTP request path; RabbitMQ and Redis integrations provide material messaging/cache infrastructure.
- `backend/src/services/recurringPayment.ts`
- `backend/src/services/savings.ts`
- `backend/src/services/multisigService.ts`

- `backend/src/jobs/recurringPaymentScheduler.ts`
- `backend/src/jobs/multisigWorker.ts`
- `backend/src/microservices/rabbitmq.ts`

#### Client and real-time support experience
The React/Vite client provides wallet, send/receive, deposits, withdrawals, swaps, history, recurring-payment, and settings journeys. Client function modules form its backend/API integration layer. Support chat has both HTTP service/controller paths and Socket-based real-time delivery.
- `client/src/pages/Wallet.tsx`
- `client/src/pages/Transfer.tsx`
- `client/src/function/transaction/index.ts`

- `backend/src/services/support/chat.ts`
- `backend/src/sockets/chat.ts`
- `backend/src/sockets/emitter.ts`

Main entry points: [`backend/src/routes/transaction.ts`](https://github.com/rendbit/crossborderpayment/blob/main/backend/src/routes/transaction.ts) (Payment API routes), [`backend/src/services/transaction.ts`](https://github.com/rendbit/crossborderpayment/blob/main/backend/src/services/transaction.ts) (Transfer orchestration), [`backend/src/models/RampTransaction.ts`](https://github.com/rendbit/crossborderpayment/blob/main/backend/src/models/RampTransaction.ts) (Operational records), [`backend/src/server.ts`](https://github.com/rendbit/crossborderpayment/blob/main/backend/src/server.ts) (Backend server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_spa["React SPA<br/>frontend<br/>[App.tsx]"]
  node_client_api["Client API functions<br/>api client<br/>[index.ts]"]
  node_proxy["Node proxy<br/>proxy service<br/>[index.js]"]
end

subgraph group_api["Backend API"]
  node_server["Backend server<br/>API entry point<br/>[server.ts]"]
  node_middleware["Access middleware<br/>security boundary<br/>[authMiddleWare.ts]"]
  node_routes["Payment API routes<br/>route modules<br/>[transaction.ts]"]
  node_sep24_controller["SEP-24 controller<br/>[sep24.ts]"]
  node_support["Support chat<br/>real-time support<br/>[chat.ts]"]
  node_chat_socket["Chat sockets<br/>Socket delivery<br/>[chat.ts]"]
end

subgraph group_domain["Payment domains"]
  node_identity["Identity &amp; compliance<br/>security services<br/>[auth.ts]"]
  node_transaction_service["Transfer orchestration<br/>transaction services<br/>[transaction.ts]"]
  node_stellar_factory["Blockchain factory<br/>provider selector"]
  node_stellar_provider["Stellar execution<br/>blockchain provider<br/>[transactions.ts]"]
  node_ramps["Ramp workflows<br/>ramp service<br/>[ramp.ts]"]
  node_bank_manager["Bank provider manager<br/>provider boundary"]
  node_payment_products["Recurring, savings &amp; multisig<br/>payment product services"]
  node_records[("Operational records<br/>persistence models<br/>[RampTransaction.ts]")]
end

subgraph group_async["Async processing"]
  node_workers["Schedulers &amp; workers<br/>background jobs"]
  node_messaging["RabbitMQ &amp; Redis<br/>messaging and cache<br/>[rabbitmq.ts]"]
end

subgraph group_external["External systems"]
  node_stellar_network{{"Stellar &amp; anchors<br/>blockchain and SEP-24"}}
  node_fiat_providers{{"Linkio &amp; SafeHaven<br/>fiat ramp providers"}}
end

node_spa -->|"uses"| node_client_api
node_client_api -->|"API requests"| node_proxy
node_proxy -->|"forwards"| node_server
node_server -->|"applies"| node_middleware
node_middleware -->|"authorizes"| node_routes
node_middleware -->|"guards"| node_sep24_controller
node_routes -->|"identity checks"| node_identity
node_routes -->|"money movement"| node_transaction_service
node_routes -->|"deposits and withdrawals"| node_ramps
node_routes -->|"product actions"| node_payment_products
node_transaction_service -->|"selects provider"| node_stellar_factory
node_stellar_factory -->|"resolves"| node_stellar_provider
node_stellar_provider -->|"submits and queries"| node_stellar_network
node_sep24_controller -->|"anchor flows"| node_stellar_network
node_ramps -->|"uses adapters"| node_bank_manager
node_bank_manager -->|"provider APIs"| node_fiat_providers
node_identity -->|"compliance evidence"| node_records
node_transaction_service -->|"transaction history"| node_records
node_ramps -->|"ramp and withdrawal state"| node_records
node_payment_products -->|"payment state"| node_records
node_payment_products -->|"schedules execution"| node_workers
node_workers -->|"queues and cache"| node_messaging
node_workers -->|"executes transfers"| node_transaction_service
node_server -->|"support API"| node_support
node_support -->|"real-time delivery"| node_chat_socket
node_spa -->|"chat connection"| node_chat_socket

click node_spa "https://github.com/rendbit/crossborderpayment/blob/main/client/src/App.tsx"
click node_client_api "https://github.com/rendbit/crossborderpayment/blob/main/client/src/function/transaction/index.ts"
click node_proxy "https://github.com/rendbit/crossborderpayment/blob/main/proxyserver/index.js"
click node_server "https://github.com/rendbit/crossborderpayment/blob/main/backend/src/server.ts"
click node_middleware "https://github.com/rendbit/crossborderpayment/blob/main/backend/src/middlewares/authMiddleWare.ts"
click node_routes "https://github.com/rendbit/crossborderpayment/blob/main/backend/src/routes/transaction.ts"
click node_sep24_controller "https://github.com/rendbit/crossborderpayment/blob/main/backend/src/controllers/sep24.ts"
click node_identity "https://github.com/rendbit/crossborderpayment/blob/main/backend/src/services/auth.ts"
click node_transaction_service "https://github.com/rendbit/crossborderpayment/blob/main/backend/src/services/transaction.ts"
click node_stellar_factory "https://github.com/rendbit/crossborderpayment/blob/main/backend/src/providers/blockchainFactory.ts"
click node_stellar_provider "https://github.com/rendbit/crossborderpayment/blob/main/backend/src/providers/stellar/transactions.ts"
click node_ramps "https://github.com/rendbit/crossborderpayment/blob/main/backend/src/services/ramp.ts"
click node_bank_manager "https://github.com/rendbit/crossborderpayment/blob/main/backend/src/providers/bank.provider.manager.ts"
click node_payment_products "https://github.com/rendbit/crossborderpayment/blob/main/backend/src/services/recurringPayment.ts"
click node_records "https://github.com/rendbit/crossborderpayment/blob/main/backend/src/models/RampTransaction.ts"
click node_workers "https://github.com/rendbit/crossborderpayment/blob/main/backend/src/jobs/recurringPaymentScheduler.ts"
click node_messaging "https://github.com/rendbit/crossborderpayment/blob/main/backend/src/microservices/rabbitmq.ts"
click node_support "https://github.com/rendbit/crossborderpayment/blob/main/backend/src/services/support/chat.ts"
click node_chat_socket "https://github.com/rendbit/crossborderpayment/blob/main/backend/src/sockets/chat.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_spa,node_client_api,node_proxy toneBlue
class node_server,node_middleware,node_routes,node_sep24_controller,node_support,node_chat_socket toneAmber
class node_identity,node_transaction_service,node_stellar_factory,node_stellar_provider,node_ramps,node_bank_manager,node_payment_products,node_records toneMint
class node_workers,node_messaging toneRose
class node_stellar_network,node_fiat_providers toneIndigo
```

## Components

### Web client

- [React SPA](https://github.com/rendbit/crossborderpayment/blob/main/client/src/App.tsx): frontend · Wallet, transfer, ramp, and payment journeys. · `client/src/App.tsx`
- [Client API functions](https://github.com/rendbit/crossborderpayment/blob/main/client/src/function/transaction/index.ts): api client · `client/src/function/transaction/index.ts`
- [Node proxy](https://github.com/rendbit/crossborderpayment/blob/main/proxyserver/index.js): proxy service · `proxyserver/index.js`

### Backend API

- [Backend server](https://github.com/rendbit/crossborderpayment/blob/main/backend/src/server.ts): API entry point · `backend/src/server.ts`
- [Access middleware](https://github.com/rendbit/crossborderpayment/blob/main/backend/src/middlewares/authMiddleWare.ts): security boundary · Auth, roles, API keys, limits, rate limits, and socket auth. · `backend/src/middlewares/authMiddleWare.ts`
- [Payment API routes](https://github.com/rendbit/crossborderpayment/blob/main/backend/src/routes/transaction.ts): route modules · `backend/src/routes/transaction.ts`
- [SEP-24 controller](https://github.com/rendbit/crossborderpayment/blob/main/backend/src/controllers/sep24.ts): controller · `backend/src/controllers/sep24.ts`
- [Support chat](https://github.com/rendbit/crossborderpayment/blob/main/backend/src/services/support/chat.ts): real-time support · `backend/src/services/support/chat.ts`
- [Chat sockets](https://github.com/rendbit/crossborderpayment/blob/main/backend/src/sockets/chat.ts): Socket delivery · `backend/src/sockets/chat.ts`

### Payment domains

- [Identity & compliance](https://github.com/rendbit/crossborderpayment/blob/main/backend/src/services/auth.ts): security services · JWT, MFA, PIN, KYC, liveness, guardians, fraud, and audit controls. · `backend/src/services/auth.ts`
- [Transfer orchestration](https://github.com/rendbit/crossborderpayment/blob/main/backend/src/services/transaction.ts): transaction services · `backend/src/services/transaction.ts`
- [Blockchain factory](https://github.com/rendbit/crossborderpayment/blob/main/backend/src/providers/blockchainFactory.ts): provider selector · `backend/src/providers/blockchainFactory.ts`
- [Stellar execution](https://github.com/rendbit/crossborderpayment/blob/main/backend/src/providers/stellar/transactions.ts): blockchain provider · Builds and submits operations and queries Horizon. · `backend/src/providers/stellar/transactions.ts`
- [Ramp workflows](https://github.com/rendbit/crossborderpayment/blob/main/backend/src/services/ramp.ts): ramp service · `backend/src/services/ramp.ts`
- [Bank provider manager](https://github.com/rendbit/crossborderpayment/blob/main/backend/src/providers/bank.provider.manager.ts): provider boundary · `backend/src/providers/bank.provider.manager.ts`
- [Recurring, savings & multisig](https://github.com/rendbit/crossborderpayment/blob/main/backend/src/services/recurringPayment.ts): payment product services · `backend/src/services/recurringPayment.ts`
- [Operational records](https://github.com/rendbit/crossborderpayment/blob/main/backend/src/models/RampTransaction.ts): persistence models · Stores ramp, withdrawal, KYC, audit, fraud, and transaction evidence. · `backend/src/models/RampTransaction.ts`

### Async processing

- [Schedulers & workers](https://github.com/rendbit/crossborderpayment/blob/main/backend/src/jobs/recurringPaymentScheduler.ts): background jobs · Executes deferred recurring and multisig work. · `backend/src/jobs/recurringPaymentScheduler.ts`
- [RabbitMQ & Redis](https://github.com/rendbit/crossborderpayment/blob/main/backend/src/microservices/rabbitmq.ts): messaging and cache · `backend/src/microservices/rabbitmq.ts`

### External systems

- **Stellar & anchors**: blockchain and SEP-24
- **Linkio & SafeHaven**: fiat ramp providers

## Connections

- React SPA → Client API functions: uses
- Client API functions → Node proxy: API requests
- Node proxy → Backend server: forwards
- Backend server → Access middleware: applies
- Access middleware → Payment API routes: authorizes
- Access middleware → SEP-24 controller: guards
- Payment API routes → Identity & compliance: identity checks
- Payment API routes → Transfer orchestration: money movement
- Payment API routes → Ramp workflows: deposits and withdrawals
- Payment API routes → Recurring, savings & multisig: product actions
- Transfer orchestration → Blockchain factory: selects provider
- Blockchain factory → Stellar execution: resolves
- Stellar execution → Stellar & anchors: submits and queries
- SEP-24 controller → Stellar & anchors: anchor flows
- Ramp workflows → Bank provider manager: uses adapters
- Bank provider manager → Linkio & SafeHaven: provider APIs
- Identity & compliance → Operational records: compliance evidence
- Transfer orchestration → Operational records: transaction history
- Ramp workflows → Operational records: ramp and withdrawal state
- Recurring, savings & multisig → Operational records: payment state
- Recurring, savings & multisig → Schedulers & workers: schedules execution
- Schedulers & workers → RabbitMQ & Redis: queues and cache
- Schedulers & workers → Transfer orchestration: executes transfers
- Backend server → Support chat: support API
- Support chat → Chat sockets: real-time delivery
- React SPA → Chat sockets: chat connection
