# alphatech29/bittrixpay-backend architecture

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

- Interactive diagram: https://gitdiagram.com/alphatech29/bittrixpay-backend
- Repository: https://github.com/alphatech29/bittrixpay-backend

## Overview

Bittrixpay is a fintech REST and WebSocket backend for Nigerian-naira wallets, crypto, and related digital services. The main user workflow enters through versioned API routes, passes through controllers and business services, then updates the MySQL-backed wallet, ledger, or domain records; provider callbacks and scheduled reconciliation complete asynchronous transactions. The map also preserves crypto operations, other product services, staff access control, notifications, and real-time delivery. Relationships are limited to README documentation and shown source references; some product branches are documented but their detailed call paths were not sampled.

Main entry points: [`models`](https://github.com/alphatech29/bittrixpay-backend/tree/main/models) (Domain models), [`controllers/user`](https://github.com/alphatech29/bittrixpay-backend/tree/main/controllers/user) (Request controllers), [`services/notification`](https://github.com/alphatech29/bittrixpay-backend/tree/main/services/notification) (Notifications), [`services/crypto/cryptoWallet.service.js`](https://github.com/alphatech29/bittrixpay-backend/blob/main/services/crypto/cryptoWallet.service.js) (Crypto wallet)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and identity"]
  node_routes["API routes<br/>[user.routes.js]"]
  node_auth["Authentication<br/>[auth.service.js]"]
  node_controllers["Request controllers"]
end

subgraph group_money["Wallet and crypto"]
  node_wallet["Wallet and ledger"]
  node_crypto["Crypto wallet"]
  node_sweeps["Crypto sweeps"]
  node_crypto_provider["Crypto chain services"]
  node_fiat["Fiat payments<br/>[flutterwave.js]"]
end

subgraph group_products["Digital products"]
  node_giftcards["Gift cards"]
  node_digital["Digital accounts"]
  node_esim["eSIM services<br/>[esim.service.js]"]
  node_telecom["Telecom and bills"]
  node_virtual["Virtual numbers"]
end

subgraph group_operations["Operations and access"]
  node_crypto_webhooks["Crypto callbacks<br/>[tatum.webhook.js]"]
  node_fiat_webhooks["Fiat callbacks"]
  node_reconcile["Reconciliation jobs"]
  node_job_engine["Job scheduler<br/>[cronEngine.js]"]
  node_admin["Staff access"]
end

subgraph group_platform["Data and delivery"]
  node_mysql[("MySQL data layer<br/>[database.js]")]
  node_models["Domain models"]
  node_notifications["Notifications"]
  node_mail["Mail queue"]
  node_realtime["WebSocket updates<br/>[socketServer.js]"]
  node_push["Push delivery"]
end

node_user(("App user"))

node_user -->|"calls API"| node_routes
node_routes -->|"dispatches"| node_controllers
node_controllers -->|"invokes"| node_auth
node_controllers -->|"invokes"| node_wallet
node_controllers -->|"invokes"| node_crypto
node_auth -->|"reads and writes"| node_models
node_wallet -->|"reads and writes"| node_models
node_crypto -->|"uses chain tools"| node_crypto_provider
node_crypto -->|"publishes updates"| node_realtime
node_crypto_webhooks -->|"requests sweeps"| node_sweeps
node_fiat_webhooks -->|"enters callback route"| node_routes
node_reconcile -->|"triggers sweeps"| node_sweeps
node_job_engine -->|"schedules"| node_reconcile
node_giftcards -->|"reads and writes"| node_models
node_digital -->|"reads and writes"| node_models
node_esim -->|"reads and writes"| node_models
node_telecom -->|"reads and writes"| node_models
node_admin -->|"loads access profiles"| node_models
node_models -->|"queries"| node_mysql
node_notifications -->|"stores notifications"| node_models
node_notifications -.->|"delivers push"| node_push
node_notifications -.->|"emits events"| node_realtime
node_mail -->|"loads settings"| node_models
node_fiat -.->|"provides payment rails"| node_user

click node_routes "https://github.com/alphatech29/bittrixpay-backend/blob/main/routes/v1/user.routes.js"
click node_auth "https://github.com/alphatech29/bittrixpay-backend/blob/main/services/auth/auth.service.js"
click node_controllers "https://github.com/alphatech29/bittrixpay-backend/tree/main/controllers/user"
click node_wallet "https://github.com/alphatech29/bittrixpay-backend/tree/main/services/wallet"
click node_crypto "https://github.com/alphatech29/bittrixpay-backend/blob/main/services/crypto/cryptoWallet.service.js"
click node_sweeps "https://github.com/alphatech29/bittrixpay-backend/blob/main/services/crypto/cryptoSweep.service.js"
click node_crypto_provider "https://github.com/alphatech29/bittrixpay-backend/tree/main/integrations/crypto"
click node_fiat "https://github.com/alphatech29/bittrixpay-backend/blob/main/integrations/flutterwave/flutterwave.js"
click node_crypto_webhooks "https://github.com/alphatech29/bittrixpay-backend/blob/main/webhook/tatum.webhook.js"
click node_fiat_webhooks "https://github.com/alphatech29/bittrixpay-backend/blob/main/webhook/flutterwave.webhook.js"
click node_reconcile "https://github.com/alphatech29/bittrixpay-backend/blob/main/jobs/depositReconciliation.service.js"
click node_job_engine "https://github.com/alphatech29/bittrixpay-backend/blob/main/jobs/engine/cronEngine.js"
click node_giftcards "https://github.com/alphatech29/bittrixpay-backend/blob/main/services/giftcard/giftcard.service.js"
click node_digital "https://github.com/alphatech29/bittrixpay-backend/blob/main/services/digitalAccount/digitalAccount.service.js"
click node_esim "https://github.com/alphatech29/bittrixpay-backend/blob/main/services/esim/esim.service.js"
click node_telecom "https://github.com/alphatech29/bittrixpay-backend/tree/main/services/telecom"
click node_virtual "https://github.com/alphatech29/bittrixpay-backend/tree/main/services/virtualNumber"
click node_admin "https://github.com/alphatech29/bittrixpay-backend/tree/main/services/access"
click node_mysql "https://github.com/alphatech29/bittrixpay-backend/blob/main/config/database.js"
click node_models "https://github.com/alphatech29/bittrixpay-backend/tree/main/models"
click node_notifications "https://github.com/alphatech29/bittrixpay-backend/tree/main/services/notification"
click node_mail "https://github.com/alphatech29/bittrixpay-backend/blob/main/mail/queue/mailQueue.service.js"
click node_realtime "https://github.com/alphatech29/bittrixpay-backend/blob/main/sockets/socketServer.js"
click node_push "https://github.com/alphatech29/bittrixpay-backend/blob/main/services/notification/pushNotification.service.js"

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_routes,node_auth,node_controllers,node_user toneBlue
class node_wallet,node_crypto,node_sweeps,node_crypto_provider,node_fiat toneAmber
class node_giftcards,node_digital,node_esim,node_telecom,node_virtual toneMint
class node_crypto_webhooks,node_fiat_webhooks,node_reconcile,node_job_engine,node_admin toneRose
class node_mysql,node_models,node_notifications,node_mail,node_realtime,node_push toneIndigo
```

## Components

### API and identity

- [API routes](https://github.com/alphatech29/bittrixpay-backend/blob/main/routes/v1/user.routes.js): `routes/v1/user.routes.js`
- [Authentication](https://github.com/alphatech29/bittrixpay-backend/blob/main/services/auth/auth.service.js): `services/auth/auth.service.js`
- [Request controllers](https://github.com/alphatech29/bittrixpay-backend/tree/main/controllers/user): `controllers/user`

### Wallet and crypto

- [Wallet and ledger](https://github.com/alphatech29/bittrixpay-backend/tree/main/services/wallet): `services/wallet`
- [Crypto wallet](https://github.com/alphatech29/bittrixpay-backend/blob/main/services/crypto/cryptoWallet.service.js): `services/crypto/cryptoWallet.service.js`
- [Crypto sweeps](https://github.com/alphatech29/bittrixpay-backend/blob/main/services/crypto/cryptoSweep.service.js): `services/crypto/cryptoSweep.service.js`
- [Crypto chain services](https://github.com/alphatech29/bittrixpay-backend/tree/main/integrations/crypto): `integrations/crypto`
- [Fiat payments](https://github.com/alphatech29/bittrixpay-backend/blob/main/integrations/flutterwave/flutterwave.js): `integrations/flutterwave/flutterwave.js`

### Digital products

- [Gift cards](https://github.com/alphatech29/bittrixpay-backend/blob/main/services/giftcard/giftcard.service.js): `services/giftcard/giftcard.service.js`
- [Digital accounts](https://github.com/alphatech29/bittrixpay-backend/blob/main/services/digitalAccount/digitalAccount.service.js): `services/digitalAccount/digitalAccount.service.js`
- [eSIM services](https://github.com/alphatech29/bittrixpay-backend/blob/main/services/esim/esim.service.js): `services/esim/esim.service.js`
- [Telecom and bills](https://github.com/alphatech29/bittrixpay-backend/tree/main/services/telecom): `services/telecom`
- [Virtual numbers](https://github.com/alphatech29/bittrixpay-backend/tree/main/services/virtualNumber): `services/virtualNumber`

### Operations and access

- [Crypto callbacks](https://github.com/alphatech29/bittrixpay-backend/blob/main/webhook/tatum.webhook.js): `webhook/tatum.webhook.js`
- [Fiat callbacks](https://github.com/alphatech29/bittrixpay-backend/blob/main/webhook/flutterwave.webhook.js): `webhook/flutterwave.webhook.js`
- [Reconciliation jobs](https://github.com/alphatech29/bittrixpay-backend/blob/main/jobs/depositReconciliation.service.js): `jobs/depositReconciliation.service.js`
- [Job scheduler](https://github.com/alphatech29/bittrixpay-backend/blob/main/jobs/engine/cronEngine.js): `jobs/engine/cronEngine.js`
- [Staff access](https://github.com/alphatech29/bittrixpay-backend/tree/main/services/access): `services/access`

### Data and delivery

- [MySQL data layer](https://github.com/alphatech29/bittrixpay-backend/blob/main/config/database.js): `config/database.js`
- [Domain models](https://github.com/alphatech29/bittrixpay-backend/tree/main/models): `models`
- [Notifications](https://github.com/alphatech29/bittrixpay-backend/tree/main/services/notification): `services/notification`
- [Mail queue](https://github.com/alphatech29/bittrixpay-backend/blob/main/mail/queue/mailQueue.service.js): `mail/queue/mailQueue.service.js`
- [WebSocket updates](https://github.com/alphatech29/bittrixpay-backend/blob/main/sockets/socketServer.js): `sockets/socketServer.js`
- [Push delivery](https://github.com/alphatech29/bittrixpay-backend/blob/main/services/notification/pushNotification.service.js): `services/notification/pushNotification.service.js`

### Other components

- **App user**

## Connections

- App user → API routes: calls API (evidence: `README.md`)
- API routes → Request controllers: dispatches (evidence: `routes/v1/user.routes.js`)
- Request controllers → Authentication: invokes
- Request controllers → Wallet and ledger: invokes (evidence: `controllers/user/wallet.controller.js`)
- Request controllers → Crypto wallet: invokes (evidence: `controllers/user/cryptoWallet.controller.js`)
- Authentication → Domain models: reads and writes (evidence: `services/auth/auth.service.js`)
- Wallet and ledger → Domain models: reads and writes (evidence: `README.md`)
- Crypto wallet → Crypto chain services: uses chain tools (evidence: `services/crypto/cryptoWallet.service.js`)
- Crypto wallet → WebSocket updates: publishes updates (evidence: `services/crypto/cryptoWallet.service.js`)
- Crypto callbacks → Crypto sweeps: requests sweeps (evidence: `webhook/tatum.webhook.js`)
- Fiat callbacks → API routes: enters callback route
- Reconciliation jobs → Crypto sweeps: triggers sweeps (evidence: `jobs/depositReconciliation.service.js`)
- Job scheduler → Reconciliation jobs: schedules (evidence: `jobs/engine/cronEngine.js`)
- Gift cards → Domain models: reads and writes (evidence: `services/giftcard/giftcard.service.js`)
- Digital accounts → Domain models: reads and writes (evidence: `services/digitalAccount/digitalAccount.service.js`)
- eSIM services → Domain models: reads and writes (evidence: `services/esim/esim.service.js`)
- Telecom and bills → Domain models: reads and writes (evidence: `services/telecom/electricity.service.js`)
- Staff access → Domain models: loads access profiles (evidence: `README.md`)
- Domain models → MySQL data layer: queries (evidence: `README.md`)
- Notifications → Domain models: stores notifications (evidence: `services/notification/notification.service.js`)
- Notifications → Push delivery: delivers push
- Notifications → WebSocket updates: emits events
- Mail queue → Domain models: loads settings (evidence: `mail/queue/mailQueue.service.js`)
- Fiat payments → App user: provides payment rails (evidence: `README.md`)
