System Design Interview Preparation — MAANG Complete Guide
40 system design problems with full High-Level Design documents, .NET Low-Level Design implementations, Mermaid architecture diagrams, practice questions, and interview tips.
How to Use This Repository
Study a problem — Read the HLD doc, understand requirements, architecture, and trade-offs
Review the code — Walk through the .NET implementation to internalize the algorithms
Practice — Answer the 5 practice questions at the end of each problem without looking
Mock interview — Pick a random problem, design it on a whiteboard in 35 minutes
Phase 1: Foundation Systems (Problems 1-5)
Core building blocks that appear as components inside every larger system.
#
Problem
HLD Docs
.NET Code
Key Patterns
1
API Rate Limiter
Part 1 / Part 2 / Part 3
TokenBucket , SlidingWindow , Middleware , RedisStore
Token bucket, sliding window, Redis counters
2
Unique ID Generator
Part 1 / Part 2 / Part 3
Snowflake , MachineIdProvider , LeaseRenewal
Snowflake IDs, clock skew, machine lease
3
Web Cache (CDN)
Part 1 / Part 2 / Part 3
MultiLevelCache , Invalidation
L1/L2 cache, write-through, cache stampede
4
Distributed Counter
Part 1 / Part 2
ShardedCounter , FlushWorker
Sharded writes, eventual read, flush worker
5
Load Balancer
Part 1 / Part 2
LeastConnections , ConsistentHash , HealthCheck
L4/L7, consistent hashing, health checks
Phase 2: Queue, Events & Reliability (Problems 6-10)
Asynchronous processing, reliable delivery, and distributed coordination.
#
Problem
HLD Docs
.NET Code
Key Patterns
6
Distributed Task Scheduler
Part 1 / Part 2
TaskScheduler , Dispatcher
Delay queues, cron, idempotent execution
7
Webhook Delivery Service
Part 1
DeliveryWorker
Exponential backoff, circuit breaker, DLQ
8
Distributed Messaging (Kafka)
Part 1
—
Partitions, consumer groups, exactly-once
9
Distributed Locking
Part 1
RedisLock
Redlock, fencing tokens, lease expiry
10
Batch Processing & Auditing
Part 1
AuditConsumer , BatchVerifier
Event sourcing, CDC, idempotent consumer
Phase 3: Social & Feed Systems (Problems 11-15)
Fan-out, ranking, and content delivery at social-media scale.
#
Problem
HLD Docs
.NET Code
Key Patterns
11
Twitter / X
Part 1 / Part 2
Timeline , FanOut , Models
Fan-out on write vs read, celebrity hybrid
12
Instagram
Part 1
—
Image pipeline, explore ranking, stories
13
Reddit
Part 1
—
Hot/Wilson ranking, nested comments, vote
14
Facebook News Feed
Part 1
—
ML ranking, EdgeRank, pull-on-demand
15
YouTube / Netflix
Part 1
—
ABR streaming, encoding pipeline, rec engine
Phase 4: Messaging & Real-Time (Problems 16-20)
WebSocket connections, presence, CRDTs, and real-time communication.
#
Problem
HLD Docs
.NET Code
Key Patterns
16
WhatsApp / Messenger
Part 1 / Part 2
ChatService , Models
WebSocket gateway, message queue, E2EE, presence
17
Live Comments
Part 1
—
Pub/sub, fan-out to WebSockets, throttling
18
Slack / Teams
Part 1
—
Channels, threads, search, workspace isolation
19
Video Conferencing (Zoom)
Part 1
—
SFU vs MCU, WebRTC, simulcast, SRTP
20
Google Docs (Collaboration)
Part 1
—
OT vs CRDT, operation transform, conflict resolution
Phase 5: E-Commerce & Payments (Problems 21-25)
Transactions, sagas, idempotency, and financial-grade consistency.
#
Problem
HLD Docs
.NET Code
Key Patterns
21
Amazon E-Commerce
Part 1 / Part 2
OrderSaga , Models
Saga orchestration, compensating transactions
22
Payment Service (Stripe)
Part 1
—
Idempotency keys, double-entry ledger, PCI
23
Digital Wallet
Part 1
—
Balance consistency, optimistic locking, audit
24
Shopify Multi-Tenant
Part 1
—
Multi-tenancy, tenant isolation, noisy neighbor
25
Food Delivery (DoorDash)
Part 1
—
Real-time dispatch, geo-matching, ETA
Phase 6: Data, Analytics & Observability (Problems 26-30)
Stream processing, probabilistic data structures, and lambda architecture.
#
Problem
HLD Docs
.NET Code
Key Patterns
26
Web Analytics (Google Analytics)
Part 1
—
Lambda architecture, HyperLogLog, rollups
27
Metrics Monitoring (Prometheus)
Part 1
—
TSDB, Gorilla compression, PromQL, alerting
28
Log Collection (ELK Stack)
Part 1
—
Kafka buffer, ILM tiered storage, trace correlation
29
Ad Click Aggregation
Part 1
—
Bloom + Redis dedup, watermarks, exactly-once
30
Top-K Request Analysis
Part 1
CountMinSketch + TopKTracker
Count-Min Sketch, Space-Saving, min-heap
Phase 7: Infrastructure & Distributed Systems (Problems 31-35)
The foundational distributed systems concepts that underpin everything.
#
Problem
HLD Docs
.NET Code
Key Patterns
31
Distributed KV Store (DynamoDB)
Part 1
ConsistentHashRing , VectorClock
Consistent hashing, quorum, vector clocks, Merkle trees, gossip
32
Distributed File System (GFS)
Part 1
—
Master/chunk architecture, 64MB chunks, write pipeline
33
Global CDN (CloudFront)
Part 1
—
GeoDNS, Anycast, origin shield, cache invalidation
34
Distributed Tracing (Jaeger)
Part 1
—
Trace/span/context, tail sampling, OpenTelemetry
35
Resource Allocation (K8s Scheduler)
Part 1
PodScheduler
Filter-Score-Bind, bin packing vs spreading, preemption
Phase 8: Boss Level (Problems 36-40)
Complex end-to-end systems that combine multiple patterns from previous phases.
#
Problem
HLD Docs
.NET Code
Key Patterns
36
Uber/Lyft (Ride Sharing)
Part 1
GeoSpatialIndex
GeoHash, driver matching, surge pricing, ride state machine
37
Ticketmaster (Event Ticketing)
Part 1
—
Virtual waiting room, seat locking (FOR UPDATE), zero-oversell
38
Google Search
Part 1
—
Crawler, inverted index, PageRank, fan-out query serving
39
Stock Trading Platform
Part 1
OrderBook
Order book matching, price-time priority, event sourcing, double-entry ledger
40
Container Orchestration (K8s)
Part 1
—
Control/data plane, reconciliation loops, etcd Watch, rolling updates
Key Algorithms & Data Structures (Code Index)
Quick reference for the most important implementations.
Metric
Count
System Design Problems
40
HLD Documents
52
.NET Implementation Files
53
Practice Questions
200 (5 per problem)
Architecture Diagrams
80+ (Mermaid)
Week
Phase
Problems
Focus
1
Foundation
1-5
Core building blocks (rate limiter, cache, load balancer)
2
Queue & Events
6-10
Async processing, reliability, distributed coordination
3
Social & Feed
11-15
Fan-out strategies, ranking, content delivery
4
Messaging & RT
16-20
WebSockets, presence, CRDTs, real-time systems
5
E-Commerce
21-25
Transactions, sagas, payments, multi-tenancy
6
Analytics
26-30
Stream processing, probabilistic data structures
7
Infrastructure
31-35
Distributed systems fundamentals (the theory)
8
Boss Level
36-40
End-to-end complex systems (bring it all together)
These patterns appear across multiple problems. Master them once, apply everywhere.
Concept
Problems Where It Appears
Consistent Hashing
#3 Cache, #5 Load Balancer, #31 KV Store, #33 CDN
Fan-Out
#11 Twitter, #14 Facebook, #17 Live Comments
Event Sourcing / CDC
#10 Auditing, #21 E-Commerce, #39 Stock Trading
Saga / Compensating Transactions
#21 E-Commerce, #22 Payments, #25 Food Delivery
Bloom Filter
#29 Ad Click, #30 Top-K, #38 Web Crawler
HyperLogLog
#26 Web Analytics
Count-Min Sketch
#29 Ad Click, #30 Top-K
GeoHash / Spatial Index
#25 Food Delivery, #36 Uber
Quorum (W + R > N)
#31 KV Store, #32 File System
Leader Election
#9 Distributed Lock, #32 File System, #40 Kubernetes
Circuit Breaker
#7 Webhooks, #22 Payments
Backpressure
#8 Kafka, #28 Log Collection, #29 Ad Click
Reconciliation Loop
#35 Scheduler, #40 Kubernetes
Double-Entry Ledger
#22 Payments, #23 Wallet, #39 Stock Trading