Skip to content

Backend Architecture

Course: Building an Exchange - Part 2 (Backend) - chapter 3

We have the following services -

  1. API - An API Server the user sends HTTP requests to
  2. Engine - Runs various market orderbooks, stores user balances in memory
  3. Websocket - Websocket server that user subscribes to real time events from
  4. DB Processor - Processes messages from the **Engine** and persists them in the DB
  5. Frontend - NextJS app (same as last week, only the URLs would change)
  6. Market maker (mm) - Places random orders to keep the book liquid
  7. Redis - Queue and pub sub
  8. TimescaleDB - Creates buckets of klines based on price feed

There should ideally be a primary database like postgres as well that stores user info/orders/trades etc.