Design a Food Delivery System (Swiggy / Zomato) - System Design

“Design Swiggy” looks like a restaurant catalogue with a Buy button. Browse restaurants, tap dishes into a cart, pay, wait for food. The interviewer lets that picture stand until they ask the question that breaks it: a single order is a contract between three independent parties who do not trust each other and are never all online at once - a customer who has already paid, a restaurant that has to accept and cook, and a delivery partner who has to be found, sent to the restaurant, and routed to the door. None of them is under your control. The restaurant can reject. The partner can cancel at the pickup. The customer can change the address mid-cook. And the whole thing has a hard 40-minute deadline before the food is cold and the order is a refund. ...

31 min

Design Google Maps / Nearby Search - System Design

“Design Google Maps” sounds like it is about drawing a map. It is not. The map tiles are the easy, cacheable part. The interviewer is really asking two hard questions stacked on top of each other. First: there are hundreds of millions of places on Earth - restaurants, petrol pumps, ATMs, chemists - and a user standing on a street corner types “coffee” and wants the ten nearest open cafes, sorted, in under a second. How do you find “things near this point” out of a planet’s worth of static points without scanning the whole globe? Second: that same user then taps one of those cafes and asks for directions, and you have to compute the fastest route across a road graph with hundreds of millions of edges, weighted by live traffic, in a few hundred milliseconds. How do you plan a shortest path across a continent without running Dijkstra over the entire road network on every request? ...

28 min

Design a Distributed Unique ID Generator - System Design

Almost every large system needs one boring-sounding thing: a way to mint unique identifiers. Tweet IDs, order IDs, message IDs, row keys. It sounds trivial until you write down the real constraints: the IDs must be unique across thousands of machines, they must be generated at hundreds of thousands per second, no single box is allowed to be a bottleneck or a point of failure, and (the part people miss) they should be roughly sortable by creation time so you can use them as primary keys and range-scan recent data. ...

22 min

Design a Key-Value Store (like DynamoDB) - System Design

A key-value store looks like a solved problem for about thirty seconds. “Put a value under a key, get it back later, it is a hash map.” Then the interviewer says: it has to survive a machine catching fire, it has to stay writable when the network splits the cluster in half, it has to hold petabytes across thousands of nodes, and two clients are going to write the same key at the same instant from two different data centers. Now every easy answer is wrong. Which node owns a key when nodes are constantly joining and leaving? If you replicate a write to three nodes and one is down, do you fail the write or accept it? When two writes race, which one wins, and how do you even know they raced? And can the caller ask for “fast and maybe stale” on one request and “slow and correct” on the next? ...

29 min

Design a Metrics and Monitoring System - System Design

Everyone thinks a monitoring system is a database with a graph on top. “Every server writes its CPU and memory somewhere, you draw a line chart, and you send an email when the line goes red.” Then the interviewer adds the constraints that turn it into a real system: it is not a hundred servers, it is millions of time series reporting every few seconds; the same metric name with a slightly different label becomes a brand-new series, so a careless user_id label can explode your storage a thousandfold overnight; a query for “p99 latency across the fleet for the last 30 days” must not scan a trillion raw points; and an alert that fires two minutes late during an outage is worse than useless because the pager is how you find out production is down. ...

32 min

Design a Distributed Message Queue (like Kafka) - System Design

Everyone thinks a message queue is a list. “Producers push messages onto the back, consumers pop them off the front, done - it is a queue, the name is right there.” That mental model survives exactly until the interviewer asks the questions that make it a real system: what happens when the consumer crashes halfway through a batch, does the message come back or is it gone? What happens when you have a thousand consumers and one queue, how do they share the load without stepping on each other? What happens when the broker holding your messages dies, are the messages gone with it? And when the network retries a publish, does the message land once or twice, and who pays for the duplicate? ...

34 min

Design YouTube / a Video Streaming Platform - System Design

A video platform looks trivial for about five seconds: POST /video to upload, GET /video to play. Then you remember that one uploaded file is a 4GB 4K master that has to become a dozen different renditions, that a viewer on a train switching between 5G and a tunnel needs the stream to drop from 1080p to 240p without stalling, that the actual bytes are served to billions of people from machines physically close to them and never from your origin, and that the view counter under the video is being incremented tens of thousands of times per second on the popular ones. The upload button is the easy 1%. The real system is this: turn one giant immutable master file into many small streamable segments, store those segments once and serve them from the edge, let the player pick the right quality moment to moment, and count views and watch time at a scale where a naive UPDATE ... SET views = views + 1 would fall over on day one. ...

31 min

Design a Real-Time Leaderboard - System Design

Everyone thinks a leaderboard is a SELECT ... ORDER BY score DESC LIMIT 100. “Store the scores, sort them, return the top 100, done.” Then the interviewer adds the real constraints: it is not just the top 100, a player who ranks 4,192,304th wants to see their own rank and the ten people around them; scores update constantly as millions of people play, and a single kill or a single point can move someone up thousands of positions; the board must feel live, so a score bump should show up in a second, not on the next nightly batch; and there is not one board, there is a global all-time board, plus a daily board, a weekly board, and one per region, all at once. ...

28 min

Design a Web Crawler - System Design

Everyone starts a web crawler the same way: a queue of URLs, a while loop, fetch, parse out the links, push them back on the queue, repeat. It works on ten pages. Then the interviewer turns it into the real problem: crawl the whole web - billions of pages - politely (never hammer one server), without downloading the same page twice, without getting stuck in an infinite maze of dynamically generated URLs, across hundreds of machines, and refresh it all continuously because the web changes under you. ...

27 min

Design an Ad Click Aggregator - System Design

Everyone thinks an ad click aggregator is a SELECT COUNT(*) ... GROUP BY ad_id. “Log every click, count the rows, show the advertiser their numbers, done.” Then the interviewer adds the constraints that make it a real system: it is not a thousand clicks, it is millions of clicks per second at peak; advertisers pay per click so a double-counted or dropped click is literally money moving the wrong way; the dashboard must feel live, so a click should show up in seconds, not in tomorrow’s batch; and the same numbers must also be provably correct at the end of the day for billing, even though clicks arrive late, out of order, and sometimes twice. ...

28 min

Design BookMyShow / a Ticket Booking System - System Design

“Design BookMyShow” looks like a catalogue app: list cities, list movies, list showtimes, take a payment, print a QR code. The interviewer lets that version breathe for about a minute, then drops the question the toy design cannot answer: a cricket final goes on sale at 10:00 AM, 2 million people hit the same match’s seat map in the same second, and seat H14 in the same stadium can only be sold to exactly one of them. Two people are staring at the same seat, both tap “pay,” both cards are valid. Who gets it, and how do you make sure the other one never gets a confirmation for a seat that is already gone? ...

30 min

Design Dropbox / a File Sync and Storage Service - System Design

A file sync service sounds like a glorified upload button until you count the bytes. The naive version is a single PUT /file that stores a blob and a GET /file that returns it - and it works right up to the moment a user edits one paragraph in a 2GB video project and your service happily re-uploads all 2GB over their home DSL line. Multiply that by 700M users across 4 devices each, all expecting a saved file to appear on every other device within seconds, and the upload button collapses. The entire engineering problem of Dropbox is this: move the minimum number of bytes to keep N devices holding identical file trees, while storing those bytes once no matter how many users or versions contain them, and reconciling edits that happen concurrently on devices that were offline and never saw each other. ...

27 min

Design Search Autocomplete / Typeahead - System Design

Everyone thinks autocomplete is a LIKE 'prefix%' query. “Index the search terms, run a prefix match, return the top ten, done.” Then the interviewer adds the real constraints: the dropdown must update on every keystroke, so you are firing a query every ~50ms while someone types; it must feel instant, which means the whole round trip - network, lookup, ranking, render - has a budget under 100ms; the corpus is billions of queries and the popular ones shift by the hour; and “top ten” is not alphabetical, it is ranked by popularity, which a prefix index does not give you for free. ...

25 min

Design a Distributed Cache (like Redis) - System Design

Everyone thinks a cache is a hash map with a size cap. “Store key-value pairs in RAM, evict when it fills up, done.” Then the interviewer makes it distributed: the data no longer fits on one machine, you have twenty cache nodes, and now the hard questions arrive. Which node owns a given key, and what happens to every other key when you add node twenty-one? How do you decide what to throw out when memory is full, and does that decision cost you a lock on the hot path? When the source-of-truth database changes, how does the stale copy in the cache get corrected without a thundering herd? And when one celebrity key gets ten million reads a second, how do you stop a single node from melting? ...

30 min

Design a Payment System / Digital Wallet - System Design

“Move 500 rupees from Alice to Bob” sounds like an UPDATE statement. Then you think about it. What if the request times out and the client retries - did the first one go through? What if the debit succeeds and the process crashes before the credit? What if two withdrawals from the same wallet run at the same instant and both read the old balance? What if the bank tells you a transfer succeeded but your database says it failed? What if a support agent needs to prove, three years later, exactly where a specific rupee went? The one-line update is actually a distributed system with an idempotency layer, an immutable ledger, a state machine per transaction, an integration with unreliable external banks and gateways, and a reconciliation job that catches the cases where all of that still drifted. ...

31 min

Design Google Docs / Collaborative Editing - System Design

A document editor sounds trivial until you put two people in the same document. One editor is a text box that saves to a database: type, PUT /document, done. The interviewer nods, then asks the question that detonates the whole design: what happens when Alice and Bob both type into the same sentence at the same time? Alice inserts “Hello " at position 0 while Bob inserts “World” at position 5, their edits cross in flight over the network, and now each person’s copy of the document has to end up identical to the other’s - even though they applied the same two edits in a different order. Get that wrong and the document silently corrupts: characters land in the wrong place, text duplicates, people lose work. That is unacceptable in a system whose entire promise is “we will never lose your writing.” ...

28 min

Design a Notification System (Push, Email, SMS) - System Design

“Send the user a notification” sounds like one function call. Then you write it down. Which channel - push, email, SMS, in-app? What if the user turned push off but left email on? What if APNs is down for ten minutes? What if the order service retries and now the user gets charged-confirmation SMS three times? What if a bug in one service starts emitting a million notifications a second and you SMS your entire user base at a rupee each? The one-line function is actually a distributed system with a fan-out, a provider integration layer, a retry engine, a preference store, and a rate limiter, and every one of those is a place it breaks. ...

29 min

Design a Rate Limiter - System Design

Everyone thinks the rate limiter is a for-loop with a counter. “Count requests per user per minute, reject when it goes over 100, done.” Then the interviewer asks the questions that actually matter: which algorithm, where does the counter live when you have 40 API servers behind a load balancer, how do you stay accurate when two servers increment the same user’s counter at the same millisecond, and how much latency does this add to every single request in the system. Now it is a real problem. ...

24 min

Design Uber / a Ride-Hailing System - System Design

“Design Uber” sounds like a CRUD app with a map on top. A rider taps a pin, a driver shows up, money moves. The interviewer lets you believe that for about thirty seconds, then asks the question that breaks the toy version: there are 5 million drivers on the road right now, each one broadcasting its GPS position every few seconds, and a rider standing on a corner wants the nearest available car in under a second. How do you find “the closest driver” out of millions of constantly-moving points, hundreds of thousands of times per second, without scanning the whole planet on every request? ...

28 min

Design a URL Shortener (TinyURL) - System Design

Everyone thinks the URL shortener is a trivial problem. “It’s a hash map. Store long URL, return short URL, done.” Then the interviewer asks: how do you generate the key, how do you avoid collisions, what happens when one popular link gets 50,000 redirects a second, and how do you serve that redirect in under 10ms across the globe. Now it’s a real system. The whole problem is deceptively read-heavy and deceptively about one decision: how you mint short keys. Get the key generation wrong and everything downstream (collisions, hot shards, wasted storage) gets worse. Get it right and the rest is caching and sharding you already know. ...

17 min