Learn

Questions answered, and a design doc for every template

Short answers to the questions that come up when a system fails, each with the arithmetic and a problem in the lab where you can watch it. Then design docs: the context, goals and non-goals, the numbers that size the system, why each component is there, the alternatives, and what fails under load.

Why does…

Design docs

  1. 01Beginner12 min readRead-heavy product catalogCache-aside in front of a database, and what happens to the database when the cache goes cold.Cache-asideHit rateCache stampedeDatabase capacity
  2. 02Beginner12 min readSlow database rescueTimeouts, retries and why a slow dependency can take down everything in front of it.TimeoutsRetriesRetry amplificationLittle’s law
  3. 03Intermediate10 min readPayment webhook processorAt-least-once delivery, duplicate side effects, and idempotency keys.At-least-once deliveryIdempotencyVisibility timeoutExactly-once effects
  4. 04Intermediate12 min readURL shortenerA read-heavy key-value system where one viral link can overload a single partition.Key-value storesPartitioningHot keysZipf popularityCost budgets
  5. 05Intermediate12 min readEvent pipeline catching upKafka-style streams: consumer lag, partitions as the limit on parallelism, and data lost to retention.Event streamsConsumer groupsPartitionsLagRetention
  6. 06Intermediate15 min readRAG support assistantRetrieval-augmented generation where the bottleneck is the model provider’s token quota, not your servers.RAGEmbeddingsVector searchToken quotasSemantic cacheTime to first token
  7. 07Intermediate12 min readEdge defence: survive a DDoSLayered protection at the edge: DDoS scrubbing, a WAF and bot management in front of your system.DDoSWAFBot managementDefence in depthFalse positives
  8. 08Advanced15 min readAgent runawayAn AI agent loop where steps multiply model calls into quota errors, latency and cost.AgentsTool useStep limitsModel quotasPrompt cachingCost
  9. 09Advanced25 min readYouTube end to endA full video platform: path routing, a real-world metadata cache, async uploads and transcoding, view counting, and capacity limits.Path routingCDNSharded SQLCache sizingAsync pipelinesKafkaCapacity planning
  10. 10Intermediate12 min readLLM gateway with fallbackOne door to your models: a prompt cache, model response time, and a second provider that takes over when the first fails.AI gatewayProvider fallbackTime to first token429s and outagesPrompt cacheCost per call
  11. 11Advanced15 min readMCP agent platformAgents that think with a model and act through MCP tools: steps multiply calls, errors and cost.MCPAgent loopTool serversCompounding errorsAgent memoryCost per task
  12. 12Advanced15 min readDocument Q&A on S3 and a vector DBUpload documents to S3, ingest them into a vector database, and answer questions with a model: two paths sharing one embedding quota.RAGS3SQS ingestionEmbeddingsVector index memoryModel response time
Interview deep dives

The full interview, end to end

The classic system design interviews at full depth: clarifying questions, capacity estimates, API, data model, the design, deep dives with the trade-offs, the follow-ups interviewers ask, common mistakes and what a strong answer covers at each level. Each one comes with a build-from-scratch problem in the lab, tested case by case.

  1. 0125 cr45 min readDesign Amazon: the full interviewThe whole retail storefront as a senior interview: home, search, product pages, a Dynamo-style cart, checkout as a saga with idempotency and an outbox, and Prime Day.Service-oriented architectureCells and shuffle shardingDynamo-style cartInventory reservationIdempotency keysSagas and the outboxSearch indexingItem-to-item recommendationsCaching and CDNPrime Day scaling
  2. 0225 cr45 min readYouTube: the full system design interviewUploads and a transcoding pipeline, adaptive streaming through ISP-hosted caches, sharded metadata, two-stage recommendations and view counting: the whole interview, with the numbers and the deep dives.Resumable uploadsTranscoding pipelineAdaptive bitrate streamingCDN tieringVitess shardingView countingTwo-stage recommendationsHot keys
  3. 0325 cr45 min readInstagram: the full interviewThe interview-grade Instagram design: background media processing, hybrid fan-out into precomputed timelines, a ranked feed with a fallback, time-ordered sharded IDs, hot counters and expiring stories.Fan-out on write vs readPrecomputed timelinesFeed rankingMedia pipelineSharded IDsHot keys and countersStories and TTLEdge security
Solved designs · 10 credits each, once

How the real products are put together

Instagram, Netflix, Slack, ChatGPT, a coding agent platform and more, as working designs that meet their goals, each with a design doc: every component and why it is there, the numbers, what breaks and how to fix it. Unlock one for 10 credits (new accounts start with 50) and it stays open for you.

  1. 0110 cr20 min readInstagramA photo feed: fan-out on write into per-user timelines, a learned ranker on every load, media on a CDN, likes on a key-value store.Fan-out on writeTimeline storeFeed rankingCache sizingAsync media processingHot keys
  2. 0210 cr18 min readFacebook news feedCandidate retrieval from precomputed timelines, a ranking model on every load, the social graph behind a cache (TAO), posts fanned out through Kafka.Feed rankingSocial graphCache tiersFan-outKafkaCapacity planning
  3. 0310 cr20 min readNetflixPlayback starts through a DRM license server and a metadata cache, browsing with a recommendation ranker, playback events into Kafka; video segments on Open Connect.CDNDRMRecommendationsCache (EVCache)KafkaStream processing
  4. 0410 cr18 min readSlackMessages into sharded MySQL and a Kafka stream, real-time fan-out to channel pub/sub, a message search index, presence heartbeats.Real-time messagingFan-outPub/subShardingSearchPresence
  5. 0510 cr22 min readChatGPTA chat product: auth and conversations, a moderation model, a spend cap, prefix reuse in a KV cache tier, and disaggregated prefill and decode GPU pools.LLM servingPrefill / decodeKV cacheModerationSpend governanceBot defence
  6. 0610 cr22 min readCoding agent platformA Claude Code-style harness: eight turns per task over a model with a provider fallback, policy-checked tools, sandboxes, context compaction, checkpoints and tracing.Agent harnessStep capsProvider fallbackSandboxesCheckpointsCompactionTracing
  7. 0710 cr20 min readDeep research (multi-agent)A lead agent fans each question out to parallel subagents that search and browse, then compacts and remembers; token use multiplies with the fan-out.Multi-agentFan-outSubagentsWeb searchBrowser toolToken budgets
  8. 0810 cr18 min readUberDriver location pings through Kafka into a geospatial index, ETAs from a short-lived cache, ride matching and trips in sharded Postgres, async notifications.Geospatial indexLocation streamsMatchingShort-TTL cachesShardingAsync notifications
  9. 0910 cr20 min readStripeCharges through a WAF and fraud scoring, a double-entry ledger, a card network with an acquirer fallback, and webhooks delivered through an outbox and idempotent workers.IdempotencyLedgerOutboxWebhooksFallbackFraud filtering
  10. 1010 cr18 min readTwitchBroadcasters push into live ingest and transcoders; viewers pull segments through a CDN with short-TTL manifests; chat fans out through Kafka to room pub/sub.Live videoIngest and transcodingCDNChat fan-outPub/subShort TTLs
  11. 1110 cr18 min readTwitter / X timelineHome timelines from fan-out on write behind a large Redis cache, a ranker on every load, tweets into Kafka, search on an inverted index.Home timelineFan-out on writeRedis at scaleRankingSearch indexKafka
  12. 1210 cr20 min readAmazon storefrontBrowsing with a product cache, search and recommendations; carts in a session store; checkout with atomic stock updates, a payment fallback and fulfilment through a queue.Product catalogCachingSearchRecommendationsAtomic updatesPayment fallbackAsync fulfilment