A curated reference of system design blueprints, architectural patterns, and scalability strategies. It combines patterns I apply in production (notably the AWS data lake architecture I designed and operated) with canonical large-scale designs I document to keep the reasoning and trade-offs sharp.
Note — this is a study & reference repository. Most of the content here (Netflix, Uber, WhatsApp, multi-region, etc.) is learning material and industry-canonical design, written to study patterns and practice system-design reasoning. It is not a claim that I personally built or operated each of these systems at scale. The exception I call out explicitly is the AWS data lake, which reflects a system I actually designed and ran in production. I keep this separation deliberate: what I lived vs. what I study.
This repository is a reference catalog of architectural patterns and system design templates. Some — like the data lake — come from systems I built and ran; others are canonical industry designs I document for study and reuse. Each entry includes capacity estimation, component deep-dives, failure scenarios, and infrastructure-as-code examples.
Target Audience: Senior Engineers, Solution Architects, Technical Leads, and Engineering Managers preparing for system design interviews or designing real systems.
- System Design Interview Templates
- Architectural Patterns
- Cloud Reference Architectures
- Data Engineering
- Observability & Reliability
- Infrastructure as Code
- Performance Engineering
Production-grade designs for common system design interview questions. Each template follows a structured approach: requirements gathering, capacity estimation, high-level design, deep-dive components, and failure analysis.
| System | Complexity | Key Technologies | Status |
|---|---|---|---|
| URL Shortener | Entry | DynamoDB, Redis, CloudFront | Complete |
| Rate Limiter | Entry | Redis, Token Bucket, Sliding Window | Complete |
| Distributed Cache | Intermediate | Consistent Hashing, Redis Cluster | Complete |
| Message Queue | Intermediate | Kafka, RabbitMQ, SQS | Complete |
| Real-time Messaging | Intermediate | WebSocket, Cassandra, Signal Protocol | Complete |
| News Feed | Intermediate | Fan-out, Timeline Service, Graph DB | Complete |
| Search Autocomplete | Intermediate | Trie, Elasticsearch, Prefix Trees | Complete |
| Video Streaming | Advanced | Adaptive Bitrate, CDN, Transcoding | Complete |
| Ride Sharing | Advanced | Geospatial Index, Real-time Matching | Complete |
| Distributed File System | Advanced | GFS, HDFS, Erasure Coding | Complete |
| Payment System | Advanced | ACID, Idempotency, Reconciliation | Complete |
| Ad Serving Platform | Expert | RTB, ML Inference, Sub-10ms Latency | Complete |
patterns/
├── communication/
│ ├── api-gateway.md # Request routing, auth, rate limiting
│ ├── service-mesh.md # Istio, Linkerd, mTLS
│ ├── async-messaging.md # Event-driven, pub/sub, queues
│ └── grpc-federation.md # Schema stitching, federation
│
├── data-management/
│ ├── cqrs.md # Command Query Responsibility Segregation
│ ├── event-sourcing.md # Append-only event log, projections
│ ├── saga-pattern.md # Distributed transaction coordination
│ ├── outbox-pattern.md # Reliable event publishing
│ └── change-data-capture.md # Debezium, database replication
│
├── resilience/
│ ├── circuit-breaker.md # Failure isolation, fallbacks
│ ├── bulkhead.md # Resource isolation
│ ├── retry-backoff.md # Exponential backoff, jitter
│ └── timeout-patterns.md # Cascading failure prevention
│
└── scaling/
├── horizontal-scaling.md # Stateless services, auto-scaling
├── database-sharding.md # Consistent hashing, range partitioning
├── read-replicas.md # Read scaling, replication lag
└── caching-strategies.md # Write-through, write-behind, cache-aside
WRITE PATH
┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Client │────>│ Command │────>│ Domain │────>│ Event │
│ │ │ Handler │ │ Model │ │ Store │
└─────────────┘ └─────────────┘ └─────────────┘ └──────┬──────┘
│
v
┌─────────────────────────────────────────────────────────────────────────┐
│ EVENT BUS (Kafka) │
└─────────────────────────────────────────────────────────────────────────┘
│
┌───────────────────────┼───────────────────────┐
v v v
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Projection │ │ Projection │ │ Projection │
│ (List View) │ │ (Analytics) │ │ (Search) │
└────────┬────────┘ └────────┬────────┘ └────────┬────────┘
│ │ │
v v v
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ PostgreSQL │ │ ClickHouse │ │ Elasticsearch │
│ (Read Model) │ │ (OLAP) │ │ (Full-text) │
└─────────────────┘ └─────────────────┘ └─────────────────┘
^
│
READ PATH
┌─────────────┐ ┌─────────────┐ │
│ Client │────>│ Query │─────┘
│ │ │ Handler │
└─────────────┘ └─────────────┘
GLOBAL
┌─────────────────────────────────────────────────────────────────────────┐
│ │
│ ┌─────────────┐ ┌─────────────┐ │
│ │ Route 53 │ │ CloudFront │ │
│ │ (Latency) │─────────────>│ (CDN) │ │
│ └─────────────┘ └──────┬──────┘ │
│ │ │
└─────────────────────────────────────────┼───────────────────────────────┘
│
┌───────────────────────────────┼───────────────────────────────┐
│ │ │
v v v
┌─────────────────────┐ ┌─────────────────────┐ ┌─────────────────────┐
│ US-EAST-1 │ │ EU-WEST-1 │ │ AP-SOUTH-1 │
│ │ │ │ │ │
│ ┌───────────────┐ │ │ ┌───────────────┐ │ │ ┌───────────────┐ │
│ │ ALB │ │ │ │ ALB │ │ │ │ ALB │ │
│ └───────┬───────┘ │ │ └───────┬───────┘ │ │ └───────┬───────┘ │
│ │ │ │ │ │ │ │ │
│ ┌───────┴───────┐ │ │ ┌───────┴───────┐ │ │ ┌───────┴───────┐ │
│ │ EKS │ │ │ │ EKS │ │ │ │ EKS │ │
│ │ Cluster │ │ │ │ Cluster │ │ │ │ Cluster │ │
│ └───────┬───────┘ │ │ └───────┬───────┘ │ │ └───────┬───────┘ │
│ │ │ │ │ │ │ │ │
│ ┌───────┴───────┐ │ │ ┌───────┴───────┐ │ │ ┌───────┴───────┐ │
│ │ Aurora │<─┼───────┼─>│ Aurora │<─┼───────┼─>│ Aurora │ │
│ │ Global DB │ │ │ │ Replica │ │ │ │ Replica │ │
│ └───────────────┘ │ │ └───────────────┘ │ │ └───────────────┘ │
│ │ │ │ │ │
│ ┌───────────────┐ │ │ ┌───────────────┐ │ │ ┌───────────────┐ │
│ │ ElastiCache │ │ │ │ ElastiCache │ │ │ │ ElastiCache │ │
│ │ (Redis) │ │ │ │ (Redis) │ │ │ │ (Redis) │ │
│ └───────────────┘ │ │ └───────────────┘ │ │ └───────────────┘ │
│ │ │ │ │ │
└─────────────────────┘ └─────────────────────┘ └─────────────────────┘
| Architecture | Use Case | Documentation | Terraform |
|---|---|---|---|
| 3-Tier Web Application | Standard web apps | Docs | Code |
| Serverless API | Event-driven APIs | Docs | Code |
| Event-Driven Microservices | Decoupled services | Docs | Code |
| Data Lake | Analytics platform | Docs | Code |
| Multi-Region Active-Active | Global availability | Docs | Code |
| Kubernetes Platform | Container orchestration | Docs | Code |
| ML Inference Pipeline | Real-time predictions | Docs | Code |
CONSISTENCY
Strong ◄─────────────► Eventual
│
Write │ ┌─────────────────┐ ┌─────────────────┐
Heavy │ │ CockroachDB │ │ Cassandra │
│ │ TiDB, Spanner │ │ ScyllaDB │
│ └─────────────────┘ └─────────────────┘
│
T │
H │
R │ ┌─────────────────┐ ┌─────────────────┐
O │ │ PostgreSQL │ │ MongoDB │
U │ │ MySQL │ │ DynamoDB │
G │ └─────────────────┘ └─────────────────┘
H │
P │
U │ ┌─────────────────┐ ┌─────────────────┐
T │ │ SQLite │ │ Redis │
│ │ (Embedded) │ │ Memcached │
Read │ └─────────────────┘ └─────────────────┘
Heavy │
│
DATA SOURCES INGESTION PROCESSING
───────────── ────────── ───────────
┌─────────────┐
│ Application │──┐
│ Logs │ │
└─────────────┘ │
│ ┌─────────────┐ ┌─────────────┐
┌─────────────┐ │ │ │ │ │
│ Database │──┼──────>│ Kafka │──────>│ Flink │
│ CDC │ │ │ Connect │ │ Spark │
└─────────────┘ │ │ │ │ │
│ └─────────────┘ └──────┬──────┘
┌─────────────┐ │ │
│ API │──┘ │
│ Events │ │
└─────────────┘ │
│
┌──────────────────────────────┴──────────────────────────────┐
│ │ │
v v v
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ S3 │ │ ClickHouse │ │Elasticsearch│
│ (Data Lake) │ │ (OLAP) │ │ (Search) │
└─────────────┘ └─────────────┘ └─────────────┘
CONSUMPTION
───────────
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Athena │ │ Grafana │ │ Kibana │
│ Presto │ │ Superset │ │ │
└─────────────┘ └─────────────┘ └─────────────┘
| Category | Metric | Target | Alert Threshold |
|---|---|---|---|
| Latency | P50 | < 50ms | - |
| Latency | P99 | < 200ms | > 500ms |
| Latency | P99.9 | < 1s | > 2s |
| Availability | Uptime | 99.99% | < 99.9% |
| Error Rate | 5xx | < 0.1% | > 1% |
| Saturation | CPU | < 70% | > 85% |
| Saturation | Memory | < 80% | > 90% |
| Saturation | Disk I/O | < 70% | > 85% |
SERVICE LEVEL OBJECTIVES
────────────────────────
┌─────────────────────────────────────────────────────────────────────────┐
│ │
│ SLI: Request Latency │
│ ─────────────────── │
│ Definition: Time from request received to response sent │
│ Measurement: Histogram at load balancer │
│ │
│ SLO: 99% of requests complete in < 200ms │
│ ─── │
│ Error Budget: 1% (432 minutes/month) │
│ │
│ Current Status: │
│ ┌────────────────────────────────────────────────────────────┐ │
│ │██████████████████████████████████████████████░░░░░░░░░░░░░░│ 78% │
│ └────────────────────────────────────────────────────────────┘ │
│ Error Budget Remaining: 95 minutes │
│ │
└─────────────────────────────────────────────────────────────────────────┘
terraform/
├── modules/
│ ├── networking/
│ │ ├── vpc/
│ │ ├── subnets/
│ │ └── security-groups/
│ │
│ ├── compute/
│ │ ├── eks/
│ │ ├── ecs/
│ │ └── lambda/
│ │
│ ├── database/
│ │ ├── aurora/
│ │ ├── dynamodb/
│ │ └── elasticache/
│ │
│ └── observability/
│ ├── cloudwatch/
│ ├── prometheus/
│ └── grafana/
│
├── environments/
│ ├── dev/
│ ├── staging/
│ └── production/
│
└── examples/
├── 3-tier-webapp/
├── serverless-api/
└── data-lake/
| Operation | Time | Notes |
|---|---|---|
| L1 cache reference | 0.5 ns | |
| Branch mispredict | 5 ns | |
| L2 cache reference | 7 ns | 14x L1 cache |
| Mutex lock/unlock | 25 ns | |
| Main memory reference | 100 ns | 20x L2 cache |
| Compress 1KB with Snappy | 3,000 ns | |
| Send 1KB over 1 Gbps | 10,000 ns | |
| Read 4KB randomly from SSD | 150,000 ns | 150 us |
| Read 1MB sequentially from memory | 250,000 ns | 250 us |
| Round trip within datacenter | 500,000 ns | 500 us |
| Read 1MB sequentially from SSD | 1,000,000 ns | 1 ms |
| Disk seek | 10,000,000 ns | 10 ms |
| Read 1MB sequentially from disk | 20,000,000 ns | 20 ms |
| Send packet CA to Netherlands | 150,000,000 ns | 150 ms |
Daily Active Users (DAU) = MAU * 0.2
Requests per Second = (DAU * avg_requests_per_user) / 86400
Peak RPS = Average RPS * 3 (rule of thumb)
Storage per Year = users * data_per_user * 365 * replication_factor
Bandwidth = RPS * average_response_size
Servers Required = Peak RPS / RPS_per_server * (1 + redundancy_factor)
Cache Size = Working Set * (1 / cache_hit_ratio - 1)
Contributions are welcome. Please review the contribution guidelines before submitting.
- Fork the repository
- Create a feature branch
- Make your changes with appropriate documentation
- Submit a pull request with a clear description
MIT License - see LICENSE for details.
Maintained by Richard
Richard Sakaguchi - Solution Architect & AI Engineer
- Website: sakaguchi.ia.br
- SEO Tools: seoexpress.com.br
- HuggingFace: yoshii-ai
- LinkedIn: richard-ms