Skip to content

BASILAHAMED/System-Design-Playbook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 

Repository files navigation

System Design Playbook 🎯

A comprehensive collection of system design case studies covering the most common and challenging interview questions in the tech industry. Each design includes detailed architecture diagrams, component breakdowns, scalability considerations, and trade-offs.

πŸ“‹ What's Inside

This playbook covers 8 major system designs that frequently appear in FAANG, Meta, Google, Amazon, Microsoft, and other top tech company interviews:

  1. YouTube/Netflix - Video Streaming πŸŽ₯

    • Video transcoding, adaptive bitrate streaming, CDN, global distribution
    • 15+ sections covering architecture, scalability, and cost optimization
  2. Uber - Ride-Sharing Platform πŸš—

    • Real-time matching, geospatial queries, location tracking, surge pricing
    • Focus on real-time systems and matching algorithms
  3. Twitter/X - Social Media 🐦

    • Timeline generation (fan-out vs pull), feed algorithms, scalability
    • Hybrid approach for handling celebrities
  4. TinyURL - URL Shortener πŸ”—

    • Hash generation, caching strategies, high read-to-write ratios
    • Multiple algorithm comparisons
  5. WhatsApp - Messaging System πŸ’¬

    • Real-time messaging, WebSocket, offline queues, end-to-end encryption
    • Distributed message persistence
  6. Rate Limiter - API Gateway πŸ›‘οΈ

    • Token bucket, sliding window, distributed rate limiting
    • Low-latency design with Redis
  7. Google Docs - Collaborative Editor πŸ“

    • Operational Transformation (OT), CRDTs, real-time sync
    • Conflict resolution and offline support
  8. Distributed Key-Value Store πŸ—„οΈ

    • DynamoDB/Cassandra style, consistent hashing, LSM trees
    • CAP theorem, tunable consistency, replication
  9. How ChatGPT Works πŸ€–

    • Transformer architecture, tokenization, attention mechanisms
    • Training pipeline, fine-tuning, inference optimization

🎯 Interview Preparation

Difficulty Levels

  • 🟒 Easy: 30-40 minutes
  • 🟑 Medium: 30-45 minutes
  • πŸ”΄ Hard: 45-60 minutes

Common Interview Questions Covered

  • "Design YouTube/Netflix"
  • "Design Uber/Ola/Lyft"
  • "Design Twitter/Facebook News Feed"
  • "Design a URL shortener"
  • "Design WhatsApp/Telegram/Messenger"
  • "Design a rate limiter"
  • "Design Google Docs/Notion/Figma"
  • "Design a distributed key-value store (like DynamoDB/Cassandra)"
  • "Design a web crawler"
  • "Design a cache (like Redis)"
  • "Design a payment system (like Stripe/PayPal)"
  • "Design an e-commerce platform (like Amazon/Flipkart)"
  • "Design a hotel booking system (like Oyo/Booking.com)"
  • "Design a food delivery app (like Swiggy/Zomato)"
  • "Design Netflix/YouTube video streaming"
  • "Design Uber/Ola ride-sharing"
  • "Design Twitter social media feed"
  • "Design WhatsApp messenger"
  • "Design Google Docs real-time collaboration"
  • "Design a distributed key-value store"
  • "Design a rate limiter"
  • "Design a URL shortener"
  • "Design a notification system"
  • "Design a search autocomplete system"
  • "Design a distributed cache"
  • "Design a logging system"
  • "Design a metrics monitoring system"
  • "Design a task queue (like Celery)"
  • "Design a file storage system (like Dropbox/Google Drive)"
  • "Design ChatGPT/LLM architecture"
  • "How does ChatGPT work internally"

πŸ“š How to Use

For Interviewees

  1. Read the design thoroughly - Understand all components and their interactions
  2. Draw the architecture - Practice sketching the diagrams from memory
  3. Deep dive into trade-offs - Be prepared to explain why you chose X over Y
  4. Practice scalability questions - "What if traffic increases 10x?"
  5. Learn the algorithms - Understand OT vs CRDT, consistent hashing, token bucket, etc.

For Interviewers

  • Use these designs as reference for evaluating candidate responses
  • Check if candidate covers: requirements, capacity estimation, core components, scalability, fault tolerance
  • Look for awareness of trade-offs and alternatives

Quick Reference

Each design includes:

  • βœ… Requirements (Functional & Non-functional)
  • βœ… Capacity Estimation (Back-of-envelope calculations)
  • βœ… System Architecture (High-level diagram)
  • βœ… Component Deep Dive (Detailed explanations)
  • βœ… Database Schema (SQL/NoSQL design)
  • βœ… Scalability Considerations (How to scale to millions/billions)
  • βœ… Advanced Features (Nice-to-haves)
  • βœ… Fault Tolerance (How system handles failures)
  • βœ… Monitoring & Alerting (Observability)
  • βœ… Security Considerations
  • βœ… Trade-offs Table (Key decisions and their implications)
  • βœ… Future Enhancements (What to build next)
  • βœ… References (Further reading)

πŸ—οΈ Design Principles

All designs follow these principles:

  1. Start with Requirements - Clarify functional and non-functional requirements
  2. Capacity Estimation - Back-of-envelope calculations to size the system
  3. High-Level Architecture - Component diagram with clear boundaries
  4. Deep Dives - Detailed explanations of critical components
  5. Data Modeling - Database schema with indexes
  6. Scalability - How to scale horizontally
  7. Fault Tolerance - Handle node/region failures
  8. Trade-offs - Every design decision has pros/cons

πŸ› οΈ Common Patterns

You'll see these patterns across multiple designs:

  • Caching: Redis/Memcached for hot data
  • Message Queues: Kafka/RabbitMQ for async processing
  • CDN: CloudFront/Cloudflare for static assets
  • Load Balancing: Round-robin, consistent hashing
  • Database Partitioning: Sharding by user_id or key hash
  • Replication: Master-slave, multi-master
  • Consistency Models: Strong, eventual, quorum-based
  • Rate Limiting: Token bucket, sliding window

πŸ“– Algorithm Cheat Sheet

Algorithm Use Case Trade-offs
Consistent Hashing Partitioning/distribution Load balancing, minimal movement on changes
Token Bucket Rate limiting Allows burst, simple
Sliding Window Log Accurate rate limiting Memory intensive
LSM Tree Write-heavy storage Read amplification, compaction overhead
Bloom Filter Fast negative lookups False positives, no false negatives
Merkle Tree Efficient data synchronization Tree maintenance overhead
Operational Transformation Real-time collaborative editing Central coordinator needed
CRDTs Decentralized collaboration Metadata overhead

πŸŽ“ Prerequisites

Before diving into these designs, ensure you understand:

  • Networking: HTTP/HTTPS, TCP/IP, DNS, CDNs, Load Balancers
  • Databases: SQL vs NoSQL, indexing, partitioning, replication
  • Caching: Redis, cache invalidation strategies
  • Message Queues: Kafka, RabbitMQ, pub/sub patterns
  • Distributed Systems: CAP theorem, consensus (Paxos/Raft), gossip protocols
  • Cloud Services: AWS/GCP/Azure offerings (S3, EC2, CloudFront, etc.)

πŸš€ Getting Started

  1. Clone this repository

    git clone https://github.com/BASILAHAMED/System-Design-Playbook.git
  2. Pick a design - Start with something familiar (like URL shortener) before tackling harder ones (video streaming, distributed databases)

  3. Practice explaining - Try to explain the design to a friend or record yourself

  4. Draw diagrams - Use tools like Excalidraw, Lucidchart, or even pen & paper

  5. Identify weaknesses - Think about what could fail and how you'd improve it

πŸ“Š Comparison Table

System Write-heavy Read-heavy Real-time Consistency Scalability
Video Streaming Medium Very High Medium Eventual Very High
Ride-Sharing High High Very High Strong High
Social Media Very High Very High High Eventual Very High
URL Shortener Low Very High Low Strong Very High
Messaging Very High Very High Very High Strong Very High
Rate Limiter High High High Eventual Very High
Collaborative Editor Very High Very High Very High Strong Medium
Key-Value Store Very High Very High High Tunable Very High
ChatGPT/LLM Medium High High Strong Very High

πŸ”„ Updates & Contributions

This playbook is actively maintained. Contributions welcome!

Found a bug? Have a suggestion?

πŸ“š Further Reading

Books

  • Designing Data-Intensive Applications by Martin Kleppmann (Bible of system design)
  • System Design Interview by Alex Xu (Vol 1 & 2)
  • Designing Distributed Systems by Brendan Burns

Blogs & Resources

YouTube Channels

πŸ“ License

MIT License - feel free to use, share, and modify.

πŸ™ Acknowledgments

Inspired by countless system design interviews, engineering blogs, and the open-source community. Special thanks to all the engineers who've shared their knowledge online.


Happy designing! May your interviews be smooth and your architectures scalable. πŸš€

Last updated: March 2026

About

System Design Playbook 🎯 is a curated collection of real-world system design case studies inspired by the most frequently asked architecture questions in top tech company interviews such as Google, Amazon, Meta, Microsoft, and other FAANG companies.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors