Skip to content

Consolidating open repo for system design problems I faced in or studied for the interviews

License

Notifications You must be signed in to change notification settings

bindian0509/system-design

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

87 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

System Design Knowledge Base

A comprehensive collection of system design case studies, architectural patterns, production-grade implementations, and interview preparation resources.


📖 Glossary & Quick Navigation

mindmap
  root((System Design))
    Case Studies
      Financial Systems
      E-Commerce
      Food Delivery
      IoT & Streaming
      Collaboration
    Patterns
      Communication
      Resilience
      Data
      Messaging
      Deployment
    Implementations
      URL Shortener
      Rate Limiter
      Leaderboard
      OAuth 2.0
      JWT Auth
      Products API
    Resources
      Interview Guide
      Compliance Guide
      Job Search HQ
      Workflow Tools
Loading

🏗️ System Design Case Studies

Financial Systems

Topic Description Key Concepts Links
Financial Clearing House Interbank settlement system with multilateral netting achieving 93%+ efficiency Graph algorithms, Two-phase settlement, Saga pattern 📘 Overview🏛️ Architecture🔄 Flow
Seller Payment System E-commerce seller payouts with configurable schedules and fee optimization Exactly-once semantics, State machines, Idempotency 📘 Overview🏛️ Architecture💾 Data Models
Fintech Data Platform End-to-end data architecture with CDC, event streaming, and federated queries CDC (Debezium), Kafka, HTAP, Data Lake 📘 Overview📊 E2E Diagram

E-Commerce & Marketplace

Topic Description Key Concepts Links
Merchandise Browsing Large-scale product discovery for 1M+ DAU with real-time trending Popularity scoring, Flink streaming, Personalization 📘 Overview📊 Diagrams
Uber Cart System Multi-merchant cart with family accounts and offline-first behavior CRDT sync, Multi-tenant, Event sourcing 📘 Overview🏛️ Architecture📱 API
Issue Tracking System Multi-tenant Jira-like platform for 50M DAU with 10B issues Row-level security, Elasticsearch, Tenant isolation 📘 Overview🏛️ Architecture🔍 Search

Food Delivery & Logistics

Topic Description Key Concepts Links
Uber Eats Feed Restaurant feed with H3 spatial indexing handling 10K+ views/sec H3 hexagonal grid, Geo-sharding, ML ranking 📘 Overview🗺️ Spatial Indexing📊 Ranking

Real-Time & Collaboration

Topic Description Key Concepts Links
Collaborative Editor Google Docs-like editor with CRDTs for 100 concurrent editors CRDT, WebSocket, Offline-first, Causal consistency 📘 Overview🧬 CRDT Design🔄 Sync Protocol
Real-Time Leaderboard Gaming leaderboard for 100M users with global/regional rankings Redis Sorted Sets, Kafka, WebSocket push 📘 Overview🏛️ Architecture📊 Redis Deep Dive

IoT & Streaming Systems

Topic Description Key Concepts Links
Trucking Crash Detection Real-time crash detection for 1M vehicles with <30s notification Stream processing, ML inference, IoT ingestion 📘 Overview🏛️ Architecture🧠 ML Pipeline

📐 Distributed System Patterns

📚 Complete Pattern Reference — Decision flowcharts, trade-off analysis, and implementation examples

API & Communication Patterns

Pattern When to Use Trade-offs Link
REST API Public APIs, CRUD operations Simple ↔ Over/under-fetching 📄 Docs
GraphQL Mobile apps, complex queries Flexible ↔ Caching complexity 📄 Docs
gRPC Internal microservices, high performance Fast ↔ Browser support 📄 Docs
WebSockets Real-time bidirectional Low latency ↔ Connection overhead 📄 Docs

Gateway & Routing Patterns

Pattern When to Use Trade-offs Link
API Gateway Centralized entry point Single entry ↔ SPOF risk 📄 Docs
Backend for Frontend Multi-platform clients Optimized UX ↔ Code duplication 📄 Docs
Aggregator Composite responses Reduced round trips ↔ Complexity 📄 Docs

Resilience Patterns

Pattern When to Use Trade-offs Link
Circuit Breaker Prevent cascading failures Fail-fast ↔ Implementation complexity 📄 Docs
Retry with Backoff Handle transient failures Reliability ↔ Thundering herd 📄 Docs
Bulkhead Isolate resource pools Fault isolation ↔ Resource underutilization 📄 Docs
Rate Limiting Traffic spike protection System protection ↔ User experience 📄 Docs
Timeout Prevent hung connections Responsiveness ↔ False positives 📄 Docs

Data Patterns

Pattern When to Use Trade-offs Link
CQRS Separate read/write scaling Performance ↔ Complexity 📄 Docs
Event Sourcing Audit trails, temporal queries Complete history ↔ Storage costs 📄 Docs
Saga Pattern Distributed transactions Eventual consistency ↔ Coordination 📄 Docs
Outbox Pattern Reliable event publishing Guaranteed delivery ↔ At-least-once 📄 Docs
Two-Phase Commit Strong consistency needed ACID guarantees ↔ Availability 📄 Docs

Messaging Patterns

Pattern When to Use Trade-offs Link
Pub/Sub Fan-out notifications Decoupling ↔ Message ordering 📄 Docs
Message Queue Work distribution Reliability ↔ Latency 📄 Docs
Event-Driven Architecture Reactive systems Flexibility ↔ Debugging complexity 📄 Docs

Service Discovery & Mesh

Pattern When to Use Trade-offs Link
Service Registry Dynamic service discovery Flexibility ↔ Additional infrastructure 📄 Docs
Sidecar Cross-cutting concerns Separation of concerns ↔ Resource overhead 📄 Docs
Service Mesh Complex microservices Full observability ↔ Operational complexity 📄 Docs

Deployment & Infrastructure

Pattern When to Use Trade-offs Link
Blue-Green Deployment Zero-downtime releases Instant rollback ↔ 2x infrastructure 📄 Docs
Canary Deployment Gradual rollouts Lower risk ↔ Complexity 📄 Docs
Rolling Deployment Resource-efficient updates Simple ↔ Slower rollback 📄 Docs
Feature Flags Runtime feature control Flexibility ↔ Tech debt 📄 Docs
Strangler Fig Legacy migration Incremental ↔ Longer timeline 📄 Docs
Database Per Service Microservices data isolation Autonomy ↔ Distributed complexity 📄 Docs

🔧 Production Implementations

URL Shortener

Full-stack URL shortener scaling from local to 500M URLs/month globally

Tier Scale Architecture
1 Local SQLite + Single binary
2 Startup (100K/mo) PostgreSQL + Redis
3 Growth (10M/mo) Multi-instance + Replicas
4 Scale (100M/mo) Multi-region + DynamoDB
5 Global (500M/mo) Edge computing + Sharded

Stack: Rust (Axum) • DynamoDB Global Tables • CloudFront • Terraform • Kubernetes

Resource Link
Rust Version 📘 README
Java Version 📘 README
Architecture 🏛️ Docs
Security & Compliance 🔒 GDPR/SOC2

Distributed Rate Limiter

High-performance rate limiter for API Gateway (100K-1M RPS)

Features: Sliding window counter • Composite keys (user + endpoint) • Fail-open/closed modes • Circuit breaker integration

Stack: Java 21 (Spring Boot) • Redis Cluster • Resilience4j • Prometheus

Resource Link
Overview 📘 README
Architecture 🏛️ Docs
Algorithms 🧮 Docs

Real-Time Leaderboard

Gaming leaderboard for 100M users with 50M DAU, supporting global/regional/friend rankings

Features: O(log N) Redis Sorted Sets • WebSocket push notifications • Multiple time windows • Circuit breakers

Stack: Java 21 (Spring Boot) • Redis Cluster • Kafka • PostgreSQL • WebSocket

Resource Link
Overview 📘 README
Architecture 🏛️ Docs
Redis Deep Dive 📊 Docs
Demo Scripts 🎮 Scripts

OAuth 2.0 Demo

Complete OAuth 2.0 implementation with Authorization Server and Resource Server

Features: Authorization Code + PKCE • Client Credentials • Refresh Tokens • JWT with custom claims • PostgreSQL persistence

Stack: Java (Spring Boot 3.2) • Spring Authorization Server • Spring Security • PostgreSQL

Resource Link
Overview 📘 README
Postman Collection 📬 Collection

JWT Authentication

Simple JWT auth system with access/refresh tokens

Features: Token rotation • Secure refresh flow • Spring Security integration

Stack: Java (Spring Boot 3.2) • Spring Security • MySQL • jjwt

Resource Link
Overview 📘 README
Architecture 🏛️ Docs
Postman Collection 📬 Collection

Products API (Cassandra/ScyllaDB)

RESTful CRUD API demonstrating Cassandra/ScyllaDB patterns

Features: CQL operations • Docker Compose setup • Seed data

Stack: Java (Spring Boot) • Apache Cassandra 4.1 • Docker

Resource Link
Overview 📘 README

Codec Library

MySQL column type codecs with zero-copy decoding (Go)

Features: Text/Binary protocol • Temporal types with timezone • DECIMAL precision • database/sql helpers

Resource Link
Overview 📘 README
Source 📦 Go Package

🎓 Interview & Career Resources

System Design Interview Guide

📚 Complete Guide — 12-part comprehensive preparation resource

# Topic Description
01 Interview Framework Step-by-step approach for any interview
02 Requirements & Estimation Capacity planning basics
02a Back-of-Envelope (Detailed) Mental math tricks & calculations
03 Core Building Blocks DBs, caching, load balancers
04 Scalability Patterns Sharding, replication, scaling
05 Distributed Concepts CAP, consistency, consensus
06 Data Storage SQL vs NoSQL, partitioning
07 Caching Strategies Patterns, invalidation, CDNs
08 Messaging & Async Queues, event-driven
09 API Design REST, GraphQL, gRPC
10 Observability Monitoring, fault tolerance
11 Common Problems URL shortener, chat, feed
12 Quick Reference One-page cheatsheet

Job Search HQ

Complete job search framework with trackers, templates, and guides

Category Topics Link
Resume Quantified achievements, LinkedIn optimization 📄 Resume Guide
Behavioral STAR stories, EM philosophy 📄 STAR Bank
System Design Quick reference sheets 📄 Cheat Sheets
LLD Patterns, problem bank 📄 LLD Guide
Coding Pattern-based approach 📄 Coding Patterns
Negotiation Compensation strategy 📄 Negotiation
Tracker Company research template 📄 Tracker

📚 Full Job Search Guide

Interview Experiences

Company Type Link
Agoda System Design + LLD 📁 Folder
Kuvera System Design 📁 Folder
Fintech Org Architecture Review 📁 Folder

📋 Compliance & Regulations

Global Financial Compliance Guide

📚 Complete Guide — 42 compliance frameworks across 6 regions

Comprehensive reference covering:

Region Key Regulations
Global Basel III/IV, FATF, PCI DSS, ISO 27001
North America SOX, GLBA, BSA/AML, Dodd-Frank, CCPA, NYDFS
Europe GDPR, PSD2/PSD3, MiFID II, DORA, AMLD 5/6
Asia Pacific RBI Master Directions, DPDP Act, PIPL, MAS TRM, CPS 234
Middle East CBUAE, SAMA Cybersecurity, PDPL
Latin America LGPD, BCB Resolution 4893
Africa POPIA, SARB, NDPR

🛠️ Tools & Workflow

Apache Airflow

Workflow orchestration with practical DAG examples

Use Cases: ETL pipelines • ML orchestration • Data quality • Report generation

Resource Link
Getting Started 📘 README
Core Concepts 📄 Concepts
Best Practices 📄 Guide
Example DAGs 📦 dags/

🗺️ Learning Paths

Path 1: System Design Fundamentals

flowchart LR
    A[Interview Guide] --> B[Patterns Reference]
    B --> C[URL Shortener]
    C --> D[Rate Limiter]
    D --> E[Leaderboard]
Loading
  1. Foundation: System Design Interview Guide
  2. Patterns: Distributed Patterns
  3. Build: URL Shortener
  4. Scale: Rate Limiter
  5. Real-time: Leaderboard

Path 2: Authentication & Security

flowchart LR
    A[JWT Auth] --> B[OAuth 2.0]
    B --> C[Compliance Guide]
    C --> D[Seller Payments]
Loading
  1. Basics: JWT Authentication
  2. OAuth: OAuth 2.0 Demo
  3. Compliance: Financial Compliance Guide
  4. Apply: Seller Payment System

Path 3: Real-Time Systems

flowchart LR
    A[Event-Driven Patterns] --> B[Collaborative Editor]
    B --> C[Uber Eats Feed]
    C --> D[Crash Detection]
Loading
  1. Foundation: Messaging Patterns
  2. Collaboration: Collaborative Editor
  3. Geo-Spatial: Uber Eats Feed
  4. IoT Streaming: Crash Detection

Path 4: Multi-Tenant Systems

flowchart LR
    A[Data Patterns] --> B[Issue Tracker]
    B --> C[Seller Payments]
    C --> D[Clearing House]
Loading
  1. Patterns: Data Patterns
  2. Multi-Tenant: Issue Tracking System
  3. Payments: Seller Payment System
  4. Finance: Clearing House

Path 5: Interview Preparation

flowchart LR
    A[Interview Guide] --> B[Quick Reference]
    B --> C[Case Studies]
    C --> D[Mock Practice]
Loading
  1. Guide: Interview Framework
  2. Reference: Cheatsheet
  3. Study: Any case study from above
  4. Review: Interview Experiences

📊 Pattern Cross-Reference

Pattern Used In
Event Sourcing / CDC Fintech Data Platform, E-Commerce, Collaborative Editor
CQRS E-Commerce, Uber Eats Feed, Issue Tracking
Saga Pattern Financial Clearing House, Seller Payments
Exactly-Once Semantics Clearing House, Seller Payments, Leaderboard
CRDT Collaborative Editor
Redis Sorted Sets Leaderboard, Rate Limiter
Batch + Real-time (Lambda) E-Commerce, Crash Detection
H3 Spatial Indexing Uber Eats Feed
Circuit Breaker Rate Limiter, Seller Payments, Leaderboard
Multi-Tenancy (RLS) Issue Tracking System
WebSocket Collaborative Editor, Leaderboard
OAuth 2.0 / JWT OAuth 2.0 Demo, JWT Auth
Sharding / Partitioning All case studies

🚀 Quick Start

Run OAuth 2.0 Demo

cd oauth2-demo && ./run.sh
# Auth Server: http://localhost:9001
# Resource Server: http://localhost:8080

Run Leaderboard Demo

cd leaderboard
docker-compose up -d redis zookeeper kafka postgres
./mvnw spring-boot:run
./scripts/demo-data.sh

Run Financial Clearing House Demo

# Python
cd financial-clearing-house/src/python && python3 demo.py

# Java
cd financial-clearing-house
mkdir -p target && find src/java -name "*.java" | xargs javac -d target
java -cp target com.clearinghouse.SettlementApp

Run URL Shortener

cd url-shortener && docker-compose up -d
# API available at http://localhost:8080

Run Rate Limiter

cd rate-limiter && docker-compose up -d redis && ./mvnw spring-boot:run

Run JWT Auth

cd jwt-auth && docker-compose up -d --build
# API available at http://localhost:8080

Run Products API (Cassandra)

cd products-api && docker-compose up -d --build
# API available at http://localhost:8080

Run Airflow Examples

cd apache-airflow && docker-compose up -d
# UI at http://localhost:8080 (admin/admin)

📝 License

MIT — See LICENSE for details.


Built for engineers who want depth over breadth in system design.

About

Consolidating open repo for system design problems I faced in or studied for the interviews

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published