Skip to content
QSwapDocs

Architecture

How the app is put together. Modules, who calls whom, and where each kind of state lives.

Five rules

Five rules the code follows
  • The API is the source of truthGET /configcluster · fees · slippage · features
  • Amounts are bigint"1.5"1500000000n"1500000000" 1.5 (float)
  • Jupiter routes; QSwap never builds a swap/swap/orderQSwap APIJupiternever →own router
  • The wallet signs; it never sendssignTransaction/swap/executenever →sendTransaction
  • We own the look--pl-*Base UI

Modules

Module mapSelect a module to see what it owns and what it calls.
Routes
Features
Shared libraries
Outside the app
swapsrc/features/swap
Quote, slippage, impact tiers, the swap button, signing and execute.
Calls: 7← 3

Where state lives

Who owns which state
  • Config, tokens, prices, balances, quotesTanStack Query cache
  • Pair and amount being typedURLZustand (memory)
  • Slippage settinglocalStorage
  • Recent pairslocalStorage
  • Swap progressComponent reducer
  • Connected wallet and addressWallet adapter
  • Quantum Swap keys and notes (preview)SDK worker + encrypted IndexedDB

The folders

the QSwap API: Jupiter proxy, tokens, prices, balances, /rpc