
📝 System Design Interview Classics · C4 Architecture · Pro
The core of a ride-hailing app: drivers stream their locations, a geo index finds nearby drivers, and a matching service offers the trip to the best one.
C4 Architecture diagrams are part of Pro. Anyone can view this one; generating and editing it needs Pro.
Drawing diagram…
Ride-hailing design: driver apps send GPS every 4 seconds to a location service that updates a geospatial index in Redis (geohash). Rider apps request a trip through the trip service. The matching service finds nearby available drivers, ranks them by ETA and offers the trip to one driver at a time. Accepted trips are stored in PostgreSQL. A pricing service computes fare and surge, and a payment service charges the rider at the end.
C4Container
title Ride Matching
Person(rider, "Rider", "Requests trips")
Person(driver, "Driver", "Accepts trips")
System_Boundary(rh, "Ride Platform") {
Container(loc, "Location Service", "Go", "Ingests driver GPS")
ContainerDb(geo, "Geo Index", "Redis GEO", "Available drivers by area")
Container(trip, "Trip Service", "Java", "Trip requests and status")
Container(match, "Matching Service", "Go", "Finds and offers best driver")
Container(price, "Pricing Service", "Python", "Fare and surge")
Container(pay, "Payment Service", "Java", "Charges riders")
ContainerDb(db, "Trip DB", "PostgreSQL", "Trips and history")
}
System_Ext(maps, "Maps API", "Routes and ETA")
Rel(driver, loc, "GPS every 4 s", "WebSocket")
Rel(loc, geo, "Updates position")
Rel(rider, trip, "Requests trip", "HTTPS")
Rel(trip, price, "Gets fare")
Rel(trip, match, "Find driver")
Rel(match, geo, "Nearby drivers")
Rel(match, maps, "ETA")
Rel(match, driver, "Trip offer")
Rel(trip, db, "Saves trip")
Rel(trip, pay, "Charge at end")The classic interview design for a service like bit.ly: short code generation, fast redirects from a cache, and click analytics processed separately.
How a one-to-one chat message is delivered in a WhatsApp-style system, with sent, delivered and read ticks, and push notifications when the receiver is offline.
How posts reach followers' feeds: fan-out on write for normal users, fan-out on read for celebrities, and a ranked feed built from a cache.
How a token bucket rate limiter decides whether to let an API request through, using Redis so all servers share the same counts.
A notification system that sends email, SMS and push messages at scale: one API, a queue per channel, user preferences, and retries.
How search suggestions appear as you type: a prefix index built offline from past searches, served from memory, and refreshed regularly.