Skip to content

Database schema ​

Defined in server/prisma/schema.prisma. All IDs are CUIDs.

User 1───* PaymentAccount
User 1───* Order 1───* Trade
User 1───* Trade (as buyer)      Trade 1───* Message
User 1───* Trade (as seller)     Trade 1───* Transaction
User 1───* Message (sender)
User 1───* Transaction

Tables ​

ModelPurposePage
UserAccounts, KYC state and custodial walletUser
PaymentAccountSeller payout accountsPaymentAccount
OrderBuy and sell offersOrder
TradeA matched order with escrow stateTrade
MessageTrade chat and system messagesMessage
TransactionLedger of platform-initiated Stellar operationsTransaction

Enums ​

EnumValues
RoleUSER, ADMIN
UserStatusACTIVE, SUSPENDED, BANNED
KycStatusUNVERIFIED, PENDING, VERIFIED, REJECTED
KycIdTypeBVN, NIN
PaymentMethodBANK_TRANSFER, OPAY, PALMPAY, KUDA, MONIEPOINT
OrderTypeBUY, SELL
OrderStatusACTIVE, FILLED, CANCELLED, EXPIRED
TradeStatusPENDING_ESCROW, ESCROW_LOCKED, PAID, RELEASING, REFUNDING, COMPLETED, CANCELLED
TransactionTypeWITHDRAWAL, ESCROW_LOCK, ESCROW_RELEASE, ESCROW_REFUND

Decimal columns ​

ColumnTypeWhy
XLM amountsDecimal(20, 7)Stellar has 7 decimal places (stroops)
NGN ratesDecimal(14, 2)Kobo precision
NGN totalsDecimal(18, 2)Room for large trades

Prisma returns decimals as Decimal objects and serialises them to JSON strings. Never convert them with Number() for money math — see amounts.

Indexes ​

  • Order (status, type, expiresAt) — market queries and expiry job
  • Trade (status, paymentDeadline) — auto-refund job
  • Trade (buyerId), Trade (sellerId) — "my trades" and reputation
  • Message (tradeId, createdAt) — chat history
  • Transaction (userId, createdAt) — wallet ledger

Nexlm is a peer-to-peer facilitator and never holds customer Naira.