How do I design a scalable web architecture?
A representative scalable web workload, top to bottom:
- DNS → CDN + DDoS protection + WAF + TLS termination
- Reverse proxy / load balancer to a stateless web/API tier (so you can add instances)
- Identity provider for authentication
- Managed relational database (primary, optional read replica) with connection pooling
- Redis for hot reads and rate-limit counters — only when measured
- Transactional outbox → queue → workers + dead-letter queue for email, media and notifications
- Private object storage → signed URLs, with the CDN for public assets only
- Observability: logs, metrics, traces
- Search index only if SQL search can no longer cope
Trust boundaries to enforce: internet vs origin, app vs identity/authorization, app vs database (least privilege), app vs workers (authenticated events, idempotent processing), private files vs public CDN, and CI/CD vs production (separate secrets, human approval for destructive steps). Use managed versions where possible — the diagram is not a directive to deploy every box on day one.