KatInterview

Architecting a Real-Time Exchange Web Client

System DesignModel answer
HardModel answerSystem Designfrontend-architecturewebsocketstate-management

Last updated

Plan the browser-side architecture of a live crypto-style exchange screen, covering rendering, state, streaming data, order safety, security, and observability.

You are asked to lay out the browser-side architecture for a production exchange-style trading screen. The page contains:

  • A price chart
  • A live order book
  • A feed of recent trades
  • An order-entry form for buying and selling
  • Account balances
  • A list of open orders and their execution status

The matching engine and backend are out of scope. Concentrate on what runs in the client.

Walk through your design from these angles:

  1. Framework choice and rendering strategy
  2. Component library and design-system decisions
  3. State management
  4. How live data flows from the network to the screen
  5. Error states and loading behavior
  6. Performance and reliability
  7. Security
  8. Testing and observability

State your assumptions about load (message rates, number of instruments watched, load-time and bundle budgets) before you begin. Expect follow-up questions about trade-offs and edge cases, especially around the order-entry flow, reconnects, and stale data.

Hints

Hint 1

Separate state by how often it changes and who owns the truth: high-frequency market streams, correctness-critical account data, and local UI state each deserve a different mechanism.

Hint 2

For the order book, think about how to join a REST snapshot with a delta stream using sequence numbers, what to do on a gap, and how to limit how often the UI is updated.

Hint 3

For order submission, ask what happens if the request times out: is the order placed or not? Consider idempotency keys, no optimistic fills, and a way to look up the outcome afterward.