Skip to main content
PreparationZone Logo
PrepZone

Zero to Millions of Users

Follow StreamHub from one server to CDN, cache, queues and sharded databases as traffic grows.

Pass checkpoint below
Stage 1EC2 + Postgres on one box
Stage 2RDS + separate EC2 app
Stage 3ALB + ASG + ElastiCache Redis
Stage 4CloudFront + S3 media origin
Stage 5MSK Kafka + EKS worker fleet
Stage 6Sharded RDS + multi-region EKS
Each stage adds one AWS building block when the previous bottleneck appears.

Stage 1: Single server

Every product starts here: one machine runs the web app, API, and database.

StreamHub at launch (2024)

  • Stack — Node.js monolith + Postgres on one VPS.
  • Users — ~500 DAU, friends and early creators.
  • Bottleneck signal — none yet; simplicity is the feature.
  • Ops — one deploy script, one backup cron.
Java
# Deploy v0 — literally one box
ssh streamhub-prod
git pull && npm run build && pm2 restart api
pg_dump streamhub > /backups/$(date +%F).sql

This is correct engineering for the stage. Premature distribution adds failure modes without users to justify them.

Stage 2: Separate web and database

When CPU contention appears, split the database onto its own host (or managed RDS). The app tier can still be one instance.

StreamHub hit this at ~5K DAU when nightly analytics queries slowed live uploads.

Stage 3: Load balancer + multiple app servers

Horizontal scaling begins when one app process cannot handle concurrent connections.

AWS ALB → EKS traffic path

TLSCLIENT
UsersHTTPS requests
NETWORK
Route 53alias → ALB
NETWORK
AWS ALBtarget group
COMPUTE
EKS pod 1streamhub-api
COMPUTE
EKS pod 2streamhub-api
COMPUTE
EKS pod NHPA scaled
L7 ALB terminates TLS, health-checks targets, and fans out to stateless pods.
  • Session state moves to Redis.
  • File uploads go to S3 (not local disk).
  • Health checks remove unhealthy instances automatically.
Java
POST /api/v1/videos
Authorization: Bearer <token>
Content-Type: application/json

{ "title": "Sunset timelapse", "s3_key": "uploads/tmp/abc123" }

At 50K DAU, StreamHub ran four API instances behind an ALB in one region.

The rest of this guide is part of Pro

Free covers every fresher guide in full. Pro unlocks Senior, Staff and Architect guides across every track.

Still to come · 5 sections

  • Stage 4: Database read replicas + cache
  • Stage 5: CDN + object storage
  • Stage 6: Async workers + message queue
  • Stage 7: Database sharding + multi-region
  • Evolution principles

Test yourself

Answer these before moving on — recall is what makes it stick.