Skip to content
dlab

~/dlab.zone (main) $ cat projects/pirateswap/README.md

pirateswap.com

Decentralized exchange & marketplace for Steam users — real-time prices, trading and a frontend that has to keep up.

role
Frontend developer → lead · UN7
when
05.2023 — 03.2026
stack
React · TypeScript · React Query · XState · WebSockets
links

context

Steam users trade in-game items with each other — prices, balances and order states change every second, and every change has to show up without anyone pressing refresh.

what I did

  1. 0a4b7d1init: architected the frontend from scratch
  2. f3e019bstate: React Query for server state, XState for the flows
  3. c0d93b8realtime: live market data & trading over websockets
  4. 7e51f02perf: kept it smooth for thousands of daily users
  5. 41ac7e3lead: reviews, planning, sync with the product owner

architecture

Websocket feed writes into the query cache; the UI reads the cache; XState machines run the trade, deposit and withdraw flows.

decisions

  1. Server state in React Query, flows in XState — never mixed.The cache answers “what is true now”, machines answer “what can the user do next”. Each stays small and testable.
  2. Websocket events write into the cache.Every view reads one source of truth, so a price tick updates the list, the detail and the trade dialog at once.
  3. Flows as explicit states.Trades have many in-between states (pending, confirming, failed, retry). Making them states rather than flags removed a class of “impossible” UI bugs.

results

1000sdaily users, smooth under live data
dev → leadfrom the first commit to owning the frontend
guest@dlab.zone — zsh/ commands · tab complete · ctrl+r search · esc close

Welcome to dlab.zone. Ask a question, type / for commands, or try `ls`.

NORMAL
choose-tree — pages and sections

↑ ↓ move · enter open · esc close

Keyboard shortcuts