Design Snapchat / Instagram Stories - System Design

Stories look like a photo feed with a countdown, and people design them like one. That is the trap. A story is not a permanent post you happen to hide after a day - the 24-hour lifetime, the ordering, and the read patterns are all fundamentally different from a feed, and they push the design in directions Instagram’s main feed never has to go. Three things make Stories their own animal. First, everything is ephemeral: a story exists for exactly 24 hours and then it is gone, so the entire data model is built around a TTL and auto-expiry rather than durable storage. Second, ordering is not ranked, it is per-viewer state: the story tray at the top of the app is sorted by “who has stuff I have not seen yet,” which means the sort key is a function of me, the viewer, not a global score. Third, the read amplification is brutal: 5B story views a day, most of which are cheap “has anything new happened” tray checks that must return in tens of milliseconds. The media bytes are the easy part (that is a solved CDN problem, same as any photo/video service); the hard part is the seen/unseen state and the tray, so that is where I spend the depth. ...

28 min

Design Voice Assistant (Alexa) - System Design

You say “Alexa, what’s the weather in Bangalore tomorrow?” and about eight hundred milliseconds later a speaker on your kitchen counter says “Tomorrow in Bangalore it’ll be partly cloudy, with a high of 31 degrees.” In that under-a-second window the device woke up on the word “Alexa,” streamed your voice to a data centre, turned the audio into text, figured out that this is a weather question about a specific city and a specific day, called a weather service, turned the answer back into a sentence, synthesized that sentence into speech, and streamed the audio back to the speaker. Any one of those steps done slowly blows the illusion that you are talking to something that understands you. ...

30 min

Design a Spam / Fraud Detection Pipeline - System Design

Everyone thinks fraud detection is a set of if statements. “Block logins from Nigeria, flag transactions over $5000, rate-limit signups per IP, done.” Then the interviewer piles on the constraints that make it a real system: it is not a rulebook run once a night, it is a synchronous gate in front of every login, every payment, every signup, and every message send - so it must return a verdict in the tens of milliseconds before the user’s request proceeds; it is not thousands of events, it is billions of events per day; the signal it needs (this card was used in three countries in the last hour, this device fingerprint has 40 accounts, this IP just failed 200 logins) lives in history, so scoring means joining live events against a huge, constantly-updating memory; and the fraudsters adapt, so the model that caught them yesterday is stale today, which is why the model has to be retrained daily on fresh labels and hot-swapped without downtime. ...

34 min

Design Gmail (Email Service Backend) - System Design

Email looks like a solved problem. It is 40 years old, the protocol fits on a napkin, and every framework ships a send_mail() in three lines. So when the interviewer says “design Gmail,” the temptation is to draw a box called “mail server” and move on. That box is where the interview goes to die. The real problem is that email is not one system. It is at least four, wired together and each hard at a different scale. You have to receive mail from the entire internet over SMTP, a protocol you do not control and cannot rate-limit at the source, from senders who range from your own users to botnets. You have to store it durably forever, because people treat their inbox as a filing cabinet and never delete anything. You have to make every user’s mailbox fully searchable in milliseconds, which at billions of messages means an inverted index the size of a small country. And you have to filter spam and malware on the way in, at line rate, before it ever touches a mailbox. 1.8B users, billions of messages a day, attachments up to 25MB, and a storage bill that only grows. Let me build it properly, one hard part at a time. ...

27 min

Design Truecaller (Crowdsourced Caller ID) - System Design

An unknown number rings your phone and, before you pick up, the screen says “Rajesh Kumar - Reported as spam 240 times.” You have never saved that number. Your phone has never seen it. So where did the name come from? The trick behind Truecaller is deceptively simple to state and genuinely hard to build: millions of other people have that number saved in their address book under some name, and Truecaller has quietly aggregated all of those private address books into one giant global reverse phone directory. You uploaded your contacts once; so did 350M other people; the union of everyone’s contacts is the product. ...

29 min

Design a CDN (Content Delivery Network) - System Design

A CDN sounds like a caching proxy you already know how to build: put an Nginx in front of the origin, set a TTL, done. That intuition survives about one slide. A real CDN is a globally distributed system whose entire job is to put a copy of someone else’s bytes physically close to every human on earth, keep those copies fresh (or provably safe to serve stale), route each request to the right box in the right city without the client knowing any of the plumbing exists, and do all of this while sustaining billions of requests per second and ~100 Tbps of egress without ever letting the origins behind it feel the load. The interesting part is not “cache a file.” It is: thousands of points of presence spread across the planet, each independently caching, each pulling from a shared origin through a tiered hierarchy that collapses cache-fill traffic, all fronted by a routing layer that steers a viewer in Lagos to a box in Lagos, plus an invalidation system that can purge a stale object from every edge on earth in seconds. Let me build it properly. ...

33 min

Design a DNS Resolver System - System Design

A DNS resolver sounds like a lookup table: a client asks “what is the IP for example.com,” you return an A record, done. That intuition survives about one query. A real recursive resolver is a globally distributed system whose whole job is to turn a name into an address by walking a delegation tree of servers it does not own, cache the answer for exactly as long as the record’s TTL allows and not one second more, hand back the geographically right address so a user in Mumbai gets the Mumbai edge of the site they asked for, and do all of this in under 50ms at p99 while sustaining trillions of queries per day. The interesting part is not “look up a name.” It is: thousands of resolver nodes spread across the planet behind one anycast IP, each running a recursive engine that chases NS delegations from the root down while a multi-tier cache absorbs 90%+ of traffic, each honoring per-record TTLs so answers are fresh without hammering authoritative servers, and each returning ECS-aware answers so the address you get is close to you - all while a single slow or dead authoritative server upstream must never stall the box. Let me build it properly. ...

32 min

Design Jira (Bug / Issue Tracking) - System Design

Jira looks like a CRUD app with extra menus. Create a ticket, assign it, drag it across a board, close it. Say that in an interview and the hard parts arrive in the first follow-up. “Every org defines its own fields - one team has a Story Points number, another has a Severity dropdown and a Customer picker - and users search across all of them with JQL like project = PAY AND status IN (Open, Reopened) AND assignee = currentUser() AND "Story Points" > 5 ORDER BY priority DESC.” “A ticket cannot jump from Open straight to Closed if the workflow says it must pass through In Review first, and the transition may run validators and fire a post-function.” “There are 100K organizations and 1B tickets total, most orgs tiny and a few enormous, and complex queries are the common case, not the exception.” ...

28 min

Design Coursera / Online Learning Platform - System Design

An online learning platform looks like “YouTube with a login” for about a minute, and then the differences bite. Video is only one plane of it: the actual product is a learner working through a structured course - watching a lecture, then taking a quiz that gets graded instantly, then submitting a programming assignment that runs against a test harness, then having every one of those actions bump a progress record that decides whether they have earned a certificate. The video is stateless and cacheable; everything wrapped around it is stateful, per-learner, write-heavy, and correctness-sensitive in a way a video counter never is. A wrong view count is a rounding error nobody notices. A wrong grade or a certificate issued to someone who did not finish is a support ticket and a trust problem. ...

31 min

Design Multiplayer Game Matchmaking - System Design

Everyone thinks matchmaking is “put waiting players in a list, grab the first ten, start a game.” That works in a hackathon demo with fifty players. Then the interviewer piles on the real constraints: the ten players you grabbed have to be close in skill or the match is a stomp and everyone rage-quits; they have to be in the same region or the connection lags to death; the ping between them has to be low even within a region; nobody should wait more than about thirty seconds staring at a “finding match” spinner; and the two teams you form out of those ten have to be balanced against each other, not just individually skilled. And you are doing this for 10 million people queued at the same time, continuously. ...

28 min

Design Online Auction (eBay) - System Design

An online auction looks like “a listing with a current price that goes up,” and if you model it that way you will lose the interview in the first five minutes. The trap is that an auction is not a CRUD row you update - it is a serialization problem wearing a shopping-site costume. The moment two people bid on the same item at the same instant, you have a race: which bid is higher, which one wins, what is the new current price, and did the loser get told they were outbid. Multiply that by a “hot” item - a rare sneaker drop, a graded Charizard, a concert ticket - where thousands of people pile in during the last ten seconds, and the naive “read price, compare, write price” pattern shreds itself into lost updates and double-wins. Then remember there are 100M active listings and each one has a hard deadline, and every one of those deadlines must fire close to on time, or the auction that “ended at 9:00:00” is still taking bids at 9:00:04 and someone is furious. ...

31 min

Design Coinbase (Crypto Exchange) - System Design

“Let users buy and sell crypto” hides two different, both-irreversible problems welded together. Inside the exchange, Coinbase is a matching engine: for a popular pair like BTC-USD it holds its own order book, matches your buy against someone’s sell by price-time priority, and the moment two orders cross, a trade has happened and cannot be un-happened. Outside the exchange, Coinbase is a custodian on a blockchain: it holds your coins, watches public chains for your deposits, and signs withdrawals that broadcast to Bitcoin or Ethereum where a confirmed transaction is permanent - no chargeback, no reversal, no support ticket that claws it back. So the core invariant is brutal on both sides: never let a user trade or withdraw a balance they do not have, never double-credit a deposit or double-broadcast a withdrawal, and never let the internal ledger disagree with what is actually on-chain. ...

35 min

Design Robinhood (Stock Trading Platform) - System Design

“Let a user buy and sell stocks” sounds like a form that writes a row. Then you notice where the money and the shares actually live. Robinhood does not match your buy against someone’s sell - an exchange does that. Robinhood is the broker: the stateful intermediary that holds your cash and your positions, reserves your buying power the instant you place an order, forwards that order to a real exchange or market maker, tracks it through a lifecycle it does not fully control, and settles the fill back into your portfolio - all while showing you a portfolio value that moves with the market in real time. A fill at the exchange is irreversible. You cannot un-buy 100 shares of AAPL. So the broker’s core invariant is brutal: never let a user place an order they cannot cover, never lose or duplicate an order sent to the exchange, and never let the positions ledger disagree with reality. ...

32 min

Design Venmo / P2P Payment - System Design

Venmo looks like a wallet with a Twitter feed bolted on, and that framing is exactly what makes it interesting. The money side demands strong consistency and an immutable ledger - a balance that goes negative from a race is theft, a double-send is a refund and an angry user. The social side demands fan-out, ranking, and privacy - a feed of “Alice paid Bob for dinner” that must respect who is allowed to see what, at read rates 100x the write rate. And sitting across both is fraud: an account takeover draining a balance, a scammer collecting payments for goods that never ship, a stolen card funding a top-up that gets clawed back. Get the ledger right but the fraud wrong and you lose real money; get fraud right but the feed wrong and you leak who paid whom. ...

32 min

Design GitHub (Code Hosting + PRs) - System Design

“Host code and let people review changes” sounds like a CRUD app with a diff view. It is not. Under the hood you are running a fleet that stores 100M Git repositories, each a content-addressed object database with its own history, serving the Git wire protocol (which is a chatty, stateful negotiation, not a REST call), computing diffs and merges on demand, fanning out webhooks to CI on every push, and - the genuinely hard part - indexing and searching across all public source code on earth so a query for a function name returns in a few hundred milliseconds. Every one of those is a different system with a different bottleneck. ...

36 min

Design LinkedIn (Professional Graph + Feed) - System Design

LinkedIn looks like Twitter with a suit on. It has a feed, it has profiles, people follow each other. So candidates walk in ready to reuse the Twitter fan-out answer and get about four minutes in before the interviewer asks the question that breaks it: “This person is a 2nd-degree connection. How did you compute that?” Now you are not designing a feed. You are designing a graph query engine that answers “are these two of my billion users within three hops of each other” in under 100ms, on a graph with 500 billion edges. ...

24 min

Design Tinder (Dating + Matching) - System Design

“Design Tinder” sounds like Instagram with a nicer gesture. Show a photo, swipe left or right, if two people both swipe right they can chat. The interviewer lets that toy version sit for about a minute, then drops the number that breaks it: 2 billion swipes a day. That is roughly 23,000 writes per second on average and 70,000+ at peak, every single one of them a tiny row that says “user A has an opinion about user B,” and every one of them potentially the second half of a mutual match that has to fire a notification within a second. ...

28 min

Design Reddit (Communities + Voting) - System Design

Reddit reads like three easy problems stapled together. Posts in communities: a table. Voting: a counter. Comments: a tree. Say it out loud and the interviewer starts pulling threads. “A vote must feel instant but the displayed score must not be a live sum of a billion rows.” “The front page is sorted by hot, which is a function of both score and age, so the sort order of every post changes every second even when nobody votes.” “One popular post has 40,000 comments nested twelve levels deep and must paginate.” “A brigade of 5,000 bot accounts can drive a post to the top of a subreddit in ninety seconds, and you have to notice before it happens.” ...

28 min

Design Stack Overflow / Quora (Q&A) - System Design

Stack Overflow looks like a CRUD app. Post a question, others post answers, everyone votes, one answer gets accepted, and a number next to your name goes up. Say that in an interview and the follow-ups arrive fast. “The question page is read a thousand times for every time it is written, and it must show a live-ish score, the accepted answer pinned first, and the rest sorted by score - all in under 200ms.” “Reputation is a running total over every vote you have ever received; you cannot re-sum a billion vote rows on every profile load.” “Search is not a LIKE '%...%' query - a user typing python list comprehension slow must get the canonical answer ranked above ten thousand near-duplicates, and that ranking blends text relevance with votes, recency, and acceptance.” “There are 100M questions and 1B answers; that does not fit on one box.” ...

29 min

Design Zoom (Video Conferencing) - System Design

People hear “build Zoom” and reach for the WebRTC tutorial: two peers, an SDP exchange, media flows directly, done. That works for a 1:1 call and detonates the moment a third person joins, and it is not even in the same universe as a 1000-person all-hands. The core problem in video conferencing is not “how do two browsers connect” - that is solved by WebRTC and I have written about it elsewhere. The core problem is fan-out of live media in a room of N participants under a hard sub-200ms latency budget, and the topology you pick to solve it - mesh, MCU, or SFU - determines whether the product exists at all. ...

29 min