GuidanceSubmissions
30:00
Guidance

Design a scheduling system

for a hospital with multiple branches.

Design a scheduling system

NOT SAVED
0 words·0 / 8,000 chars
System Design

The Two-Sided Marketplaces Playbook

Designing a two-sided marketplace goes beyond a simple CRUD app. The architectural core lies in orchestrating complex state transitions, ensuring transactional consistency (preventing double-booking), and building a highly scalable real-time matching engine.

Step 1

Define the State Machine

Marketplaces are essentially complex state machines. Map out the lifecycle of a transaction (e.g., Ride Requested -> Finding Driver -> Driver Accepted -> In Transit -> Completed). Clarify how state changes are communicated in real-time (WebSockets or Server-Sent Events) to keep both the buyer and seller screens synced.

Step 2

Geolocation & Search Indexing

Step 3

Concurrency Control (The Double-Booking Problem)

Step 4

The Matching Logic Trade-offs

Step 5

Distributed Transactions & Payments

Additional Tips

  • Idempotency is Non-Negotiable: Network failures will happen. If a user's app drops connection and retries the "Confirm Payment" API, you must not charge them twice. Mentioning Idempotency Keys for all transactional APIs proves you have battle-tested engineering experience.
  • Asymmetric Scaling: Supply and Demand scale differently. On New Year's Eve, an app has massive rider demand but low driver supply. Explain that the architecture must allow scaling the 'Ride Request' services independently from the 'Driver Location Tracking' services.
  • The "Cold Start" Tech-Product Bridge: Show product sense. A tech-perfect marketplace is useless without liquidity. Briefly mention how the system should support targeted promotions or dynamic pricing (Surge Pricing) to incentivize the supply side when demand heavily outweighs supply.