# mhmmd2005/otc-exchange architecture

> Architecture diagram of the GitHub repository mhmmd2005/otc-exchange, 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/mhmmd2005/otc-exchange
- Repository: https://github.com/mhmmd2005/otc-exchange

## Overview

OTC Exchange is a Django REST backend foundation with Vue frontends; the README explicitly says the frontend is not yet integrated with the backend. The documented product domains cover identity, KYC, markets, wallets, OTC orders, trades, transactions, security and support, alongside payments and withdrawals visible in the source tree. The principal user workflow is account access followed by verification and financial activity, but the excerpts do not establish a complete end-to-end route. Backend service relationships below use indexed references or shown calls; broader domain links are omitted where evidence is unavailable.

Main entry points: [`backend/apps/payments/services.py`](https://github.com/mhmmd2005/otc-exchange/blob/main/backend/apps/payments/services.py) (Payment processing), [`backend/apps/withdrawals/services/toman_withdrawal_service.py`](https://github.com/mhmmd2005/otc-exchange/blob/main/backend/apps/withdrawals/services/toman_withdrawal_service.py) (Withdrawals), [`backend/apps/kyc/models.py`](https://github.com/mhmmd2005/otc-exchange/blob/main/backend/apps/kyc/models.py) (KYC), [`backend/apps/accounts/models.py`](https://github.com/mhmmd2005/otc-exchange/blob/main/backend/apps/accounts/models.py) (Accounts)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Vue clients"]
  node_frontend_app["Vue app<br/>[App.vue]"]
  node_frontend_router["App routing<br/>[index.ts]"]
  node_frontend_auth["Auth service<br/>[auth.service.ts]"]
  node_frontend_api["API client<br/>[api.ts]"]
end

subgraph group_identity["Identity and trust"]
  node_backend_accounts[("Accounts<br/>[models.py]")]
  node_backend_kyc[("KYC<br/>[models.py]")]
  node_backend_security["Security<br/>[services.py]"]
end

subgraph group_exchange["Exchange domains"]
  node_markets["Markets"]
  node_otc["OTC orders"]
  node_orders["Orders"]
  node_trades["Trades"]
end

subgraph group_money["Money movement"]
  node_wallets[("Wallets<br/>[models.py]")]
  node_wallet_services["Wallet operations<br/>[services.py]"]
  node_payments["Payment processing<br/>[services.py]"]
  node_payment_models[("Payment records<br/>[models.py]")]
  node_gateway["Payment gateways<br/>[base.py]"]
  node_transactions[("Transactions<br/>[models.py]")]
  node_withdrawals["Withdrawals"]
  node_withdrawal_records[("Withdrawal records<br/>[models.py]")]
end

subgraph group_operations["User services"]
  node_support["Support"]
  node_notifications[("Notifications<br/>[models.py]")]
  node_notification_delivery["Email delivery<br/>[tasks.py]"]
  node_email_templates["Email templates<br/>[email_templates.py]"]
  node_sms_delivery["OTP delivery<br/>[tasks.py]"]
  node_sms_service["SMS service<br/>[sms.py]"]
end

node_user(("User"))

node_user -.->|"uses"| node_frontend_app
node_frontend_app -->|"routes through"| node_frontend_router
node_frontend_auth -->|"resolves requests"| node_frontend_api
node_backend_kyc -->|"references"| node_backend_accounts
node_wallet_services -->|"updates balances"| node_wallets
node_payments -->|"checks user"| node_backend_accounts
node_payments -->|"checks verification"| node_backend_kyc
node_payments -->|"records attempts"| node_payment_models
node_payments -->|"uses gateways"| node_gateway
node_payments -->|"credits wallet"| node_wallet_services
node_payments -->|"creates transaction"| node_transactions
node_withdrawals -->|"checks user"| node_backend_accounts
node_withdrawals -->|"checks verification"| node_backend_kyc
node_withdrawals -->|"locks balance"| node_wallets
node_withdrawals -->|"records attempt"| node_withdrawal_records
node_withdrawals -->|"links settlement"| node_transactions
node_notification_delivery -->|"loads notification"| node_notifications
node_notification_delivery -->|"renders email"| node_email_templates
node_sms_delivery -->|"sends OTP"| node_sms_service
node_user -.->|"authenticates"| node_backend_accounts
node_user -.->|"submits verification"| node_backend_kyc
node_user -.->|"views markets"| node_markets
node_user -.->|"trades OTC"| node_otc
node_user -.->|"manages orders"| node_orders
node_user -.->|"views trades"| node_trades
node_user -.->|"uses wallet"| node_wallets
node_user -.->|"requests withdrawal"| node_withdrawals
node_user -.->|"requests support"| node_support
node_user -.->|"manages security"| node_backend_security

click node_frontend_app "https://github.com/mhmmd2005/otc-exchange/blob/main/frontend/src/App.vue"
click node_frontend_router "https://github.com/mhmmd2005/otc-exchange/blob/main/frontend/src/router/index.ts"
click node_frontend_auth "https://github.com/mhmmd2005/otc-exchange/blob/main/frontend/src/services/auth.service.ts"
click node_frontend_api "https://github.com/mhmmd2005/otc-exchange/blob/main/frontend/src/services/api.ts"
click node_backend_accounts "https://github.com/mhmmd2005/otc-exchange/blob/main/backend/apps/accounts/models.py"
click node_backend_kyc "https://github.com/mhmmd2005/otc-exchange/blob/main/backend/apps/kyc/models.py"
click node_backend_security "https://github.com/mhmmd2005/otc-exchange/blob/main/backend/apps/security/services.py"
click node_markets "https://github.com/mhmmd2005/otc-exchange/tree/main/backend/apps/markets"
click node_otc "https://github.com/mhmmd2005/otc-exchange/tree/main/backend/apps/otc"
click node_orders "https://github.com/mhmmd2005/otc-exchange/tree/main/backend/apps/orders"
click node_trades "https://github.com/mhmmd2005/otc-exchange/tree/main/backend/apps/trades"
click node_wallets "https://github.com/mhmmd2005/otc-exchange/blob/main/backend/apps/wallets/models.py"
click node_wallet_services "https://github.com/mhmmd2005/otc-exchange/blob/main/backend/apps/wallets/services.py"
click node_payments "https://github.com/mhmmd2005/otc-exchange/blob/main/backend/apps/payments/services.py"
click node_payment_models "https://github.com/mhmmd2005/otc-exchange/blob/main/backend/apps/payments/models.py"
click node_gateway "https://github.com/mhmmd2005/otc-exchange/blob/main/backend/apps/payments/gateways/base.py"
click node_transactions "https://github.com/mhmmd2005/otc-exchange/blob/main/backend/apps/transactions/models.py"
click node_withdrawals "https://github.com/mhmmd2005/otc-exchange/blob/main/backend/apps/withdrawals/services/toman_withdrawal_service.py"
click node_withdrawal_records "https://github.com/mhmmd2005/otc-exchange/blob/main/backend/apps/withdrawals/models.py"
click node_support "https://github.com/mhmmd2005/otc-exchange/tree/main/backend/apps/support"
click node_notifications "https://github.com/mhmmd2005/otc-exchange/blob/main/backend/apps/notifications/models.py"
click node_notification_delivery "https://github.com/mhmmd2005/otc-exchange/blob/main/backend/apps/notifications/tasks.py"
click node_email_templates "https://github.com/mhmmd2005/otc-exchange/blob/main/backend/apps/notifications/email_templates.py"
click node_sms_delivery "https://github.com/mhmmd2005/otc-exchange/blob/main/backend/apps/accounts/tasks.py"
click node_sms_service "https://github.com/mhmmd2005/otc-exchange/blob/main/backend/apps/accounts/services/sms.py"

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_frontend_app,node_frontend_router,node_frontend_auth,node_frontend_api,node_user toneBlue
class node_backend_accounts,node_backend_kyc,node_backend_security toneAmber
class node_markets,node_otc,node_orders,node_trades toneMint
class node_wallets,node_wallet_services,node_payments,node_payment_models,node_gateway,node_transactions,node_withdrawals,node_withdrawal_records toneRose
class node_support,node_notifications,node_notification_delivery,node_email_templates,node_sms_delivery,node_sms_service toneIndigo
```

## Components

### Vue clients

- [Vue app](https://github.com/mhmmd2005/otc-exchange/blob/main/frontend/src/App.vue): `frontend/src/App.vue`
- [App routing](https://github.com/mhmmd2005/otc-exchange/blob/main/frontend/src/router/index.ts): `frontend/src/router/index.ts`
- [Auth service](https://github.com/mhmmd2005/otc-exchange/blob/main/frontend/src/services/auth.service.ts): `frontend/src/services/auth.service.ts`
- [API client](https://github.com/mhmmd2005/otc-exchange/blob/main/frontend/src/services/api.ts): `frontend/src/services/api.ts`

### Identity and trust

- [Accounts](https://github.com/mhmmd2005/otc-exchange/blob/main/backend/apps/accounts/models.py): `backend/apps/accounts/models.py`
- [KYC](https://github.com/mhmmd2005/otc-exchange/blob/main/backend/apps/kyc/models.py): `backend/apps/kyc/models.py`
- [Security](https://github.com/mhmmd2005/otc-exchange/blob/main/backend/apps/security/services.py): `backend/apps/security/services.py`

### Exchange domains

- [Markets](https://github.com/mhmmd2005/otc-exchange/tree/main/backend/apps/markets): `backend/apps/markets`
- [OTC orders](https://github.com/mhmmd2005/otc-exchange/tree/main/backend/apps/otc): `backend/apps/otc`
- [Orders](https://github.com/mhmmd2005/otc-exchange/tree/main/backend/apps/orders): `backend/apps/orders`
- [Trades](https://github.com/mhmmd2005/otc-exchange/tree/main/backend/apps/trades): `backend/apps/trades`

### Money movement

- [Wallets](https://github.com/mhmmd2005/otc-exchange/blob/main/backend/apps/wallets/models.py): `backend/apps/wallets/models.py`
- [Wallet operations](https://github.com/mhmmd2005/otc-exchange/blob/main/backend/apps/wallets/services.py): `backend/apps/wallets/services.py`
- [Payment processing](https://github.com/mhmmd2005/otc-exchange/blob/main/backend/apps/payments/services.py): `backend/apps/payments/services.py`
- [Payment records](https://github.com/mhmmd2005/otc-exchange/blob/main/backend/apps/payments/models.py): `backend/apps/payments/models.py`
- [Payment gateways](https://github.com/mhmmd2005/otc-exchange/blob/main/backend/apps/payments/gateways/base.py): `backend/apps/payments/gateways/base.py`
- [Transactions](https://github.com/mhmmd2005/otc-exchange/blob/main/backend/apps/transactions/models.py): `backend/apps/transactions/models.py`
- [Withdrawals](https://github.com/mhmmd2005/otc-exchange/blob/main/backend/apps/withdrawals/services/toman_withdrawal_service.py): `backend/apps/withdrawals/services/toman_withdrawal_service.py`
- [Withdrawal records](https://github.com/mhmmd2005/otc-exchange/blob/main/backend/apps/withdrawals/models.py): `backend/apps/withdrawals/models.py`

### User services

- [Support](https://github.com/mhmmd2005/otc-exchange/tree/main/backend/apps/support): `backend/apps/support`
- [Notifications](https://github.com/mhmmd2005/otc-exchange/blob/main/backend/apps/notifications/models.py): `backend/apps/notifications/models.py`
- [Email delivery](https://github.com/mhmmd2005/otc-exchange/blob/main/backend/apps/notifications/tasks.py): `backend/apps/notifications/tasks.py`
- [Email templates](https://github.com/mhmmd2005/otc-exchange/blob/main/backend/apps/notifications/email_templates.py): `backend/apps/notifications/email_templates.py`
- [OTP delivery](https://github.com/mhmmd2005/otc-exchange/blob/main/backend/apps/accounts/tasks.py): `backend/apps/accounts/tasks.py`
- [SMS service](https://github.com/mhmmd2005/otc-exchange/blob/main/backend/apps/accounts/services/sms.py): `backend/apps/accounts/services/sms.py`

### Other components

- **User**

## Connections

- User → Vue app: uses
- Vue app → App routing: routes through (evidence: `frontend/src/main.ts`)
- Auth service → API client: resolves requests (evidence: `frontend/src/services/auth.service.ts`)
- KYC → Accounts: references (evidence: `backend/apps/kyc/models.py`)
- Wallet operations → Wallets: updates balances (evidence: `backend/apps/wallets/services.py`)
- Payment processing → Accounts: checks user (evidence: `backend/apps/payments/services.py`)
- Payment processing → KYC: checks verification (evidence: `backend/apps/payments/services.py`)
- Payment processing → Payment records: records attempts (evidence: `backend/apps/payments/services.py`)
- Payment processing → Payment gateways: uses gateways (evidence: `backend/apps/payments/services.py`)
- Payment processing → Wallet operations: credits wallet (evidence: `backend/apps/payments/services.py`)
- Payment processing → Transactions: creates transaction (evidence: `backend/apps/payments/services.py`)
- Withdrawals → Accounts: checks user (evidence: `backend/apps/withdrawals/services/toman_withdrawal_service.py`)
- Withdrawals → KYC: checks verification (evidence: `backend/apps/withdrawals/services/toman_withdrawal_service.py`)
- Withdrawals → Wallets: locks balance (evidence: `backend/apps/withdrawals/services/toman_withdrawal_service.py`)
- Withdrawals → Withdrawal records: records attempt (evidence: `backend/apps/withdrawals/services/toman_withdrawal_service.py`)
- Withdrawals → Transactions: links settlement (evidence: `backend/apps/withdrawals/services/toman_withdrawal_service.py`)
- Email delivery → Notifications: loads notification (evidence: `backend/apps/notifications/tasks.py`)
- Email delivery → Email templates: renders email (evidence: `backend/apps/notifications/tasks.py`)
- OTP delivery → SMS service: sends OTP (evidence: `backend/apps/accounts/tasks.py`)
- User → Accounts: authenticates
- User → KYC: submits verification
- User → Markets: views markets
- User → OTC orders: trades OTC
- User → Orders: manages orders
- User → Trades: views trades
- User → Wallets: uses wallet
- User → Withdrawals: requests withdrawal
- User → Support: requests support
- User → Security: manages security
