Skip to content

System design scenario bank

Worked system design scenarios: a URL shortener, notification fan-out, chat, uploads, search, an exam platform, a traffic spike, multi-tenant SaaS and ticketing.

13 lessons

Classic warm-ups

  1. 1Scenario: URL shortenerGenerate codes that are unique and unguessable off the hot path, then answer every click from a cache with a 302.
  2. 2Scenario: distributed rate limiterCount in one Redis so that every key always gets an expiry, and decide per route what happens when Redis cannot answer.

Fan-out and real time

  1. 3Scenario: notification fan-outOne event becomes one job per recipient and channel, each channel paced by its own provider and recorded once.
  2. 4Scenario: chat and presenceStore every message until each device says it has it, and announce presence only when it changes.
  3. 5Scenario: news feedPay for a feed when posting, except for the few huge accounts, which every reader merges in at read time.

Files, search and money

  1. 6Scenario: file and image upload pipelineLet storage take the bytes into quarantine, and let a worker that trusts nothing but the bytes promote them.
  2. 7Scenario: search with facetsThe index is a derived copy: feed it, rebuild it, and count each facet without its own tick.
  3. 8Scenario: payments ledgerWrite money as entries summing to zero, serialise each account's debits on its row, and post each payment once, checked nightly by id.

ExamHall and SaaS

  1. 9Scenario: the exam engine and its anti-cheat pipelineThe server owns each candidate's clock and closes each attempt itself; anti-cheat signals are claims to review, never verdicts.
  2. 10A scheduled exam-start spikeA scheduled start needs one coordinated readiness plan and a rehearsal of the traffic that will actually arrive.
  3. 11Scenario: multi-tenant SaaSPick what tenants share layer by layer, give shared workers turns, run migrations as N jobs, and scope every copy of a row.

More scenarios

  1. 12Scenario: ticketing on-sale with seat holdsHold with a timed row and a guarded update, guard the confirm too, and let the waiting room absorb the crowd.
  2. 13Scenario: video-on-demand streamingThe app decides who may watch; transcoders, storage and the CDN move the bytes, and the bill is the bytes viewers receive.