Clients (web / mobile)
Outside AWS (reaches you via Route 53)
Browsers and mobile apps — the only part of the system you don’t control.
In a monolith
Same clients, one backend
A server-rendered site or an SPA talking to one backend on one domain, usually with a session cookie.
In a distributed system
Many clients, one front door
Web, iOS, Android and partners all hit a single entry point (gateway/BFF). Clients never learn how many services sit behind it.
On AWS
Outside AWS (reaches you via Route 53)
Users arrive through Route 53 → CloudFront / ALB / API Gateway. Mobile apps often sign in with Cognito and upload with presigned S3 URLs.
- Reach for it when
- Always there — the real question is what they’re allowed to talk to.
- What it costs you
- Untrusted: everything they send must be validated server-side
- Slow, flaky networks (mobile) — design for retries and offline
- Old app versions live for years, so APIs need versioning
- When it dies
- Clients don’t “die”, but they retry. Aggressive client retries during an outage can flatten your own recovery — use exponential backoff with jitter.
Interview follow-ups
Why shouldn’t a mobile app talk to the database directly?
It would need DB credentials inside the binary (extractable), and you lose the one place to enforce auth, validation, rate limits and schema evolution. The exception is BaaS with row-level security.
How do clients upload large files efficiently?
The backend issues a short-lived presigned URL; the client PUTs bytes straight to object storage, so app servers never proxy the file.
How do you push updates to clients?
Polling (simplest), long polling, Server-Sent Events, or WebSockets for two-way realtime; mobile push notifications when the app is closed.
Connection rules
It talks to
- DNS
- CDN
- Load balancer
- API gateway
- Identity provider
- App serverOnly when: There is exactly one instance (early stage: DNS points at the server). With two or more instances, put a load balancer or gateway in front so clients don’t need to know which server to hit.
- ServiceOnly when: There is exactly one instance (early stage: DNS points at the server). With two or more instances, put a load balancer or gateway in front so clients don’t need to know which server to hit.
- Realtime serverOnly when: There is exactly one instance (early stage: DNS points at the server). With two or more instances, put a load balancer or gateway in front so clients don’t need to know which server to hit.
- SQL databaseOnly when: BaaS-style setups (Supabase, Firebase) where row-level security or security rules enforce access inside the database itself.
- NoSQL storeOnly when: Fine-grained per-user access through an identity provider (e.g. Cognito identity pools with DynamoDB leading-key conditions) — rare, and only for simple per-user data.
- Object storageOnly when: Through presigned URLs issued by your backend — the recommended way to upload/download large files, because the bytes skip your servers entirely.
- Third-party APIOnly when: Provider SDKs built for it — e.g. hosted payment fields, where card details go straight to the payment provider and your servers never touch them (smaller PCI scope).
Gets traffic from
Never
- Clients → WorkerWorkers aren’t on the request path — they pull jobs from a queue.
- Clients → Read replicaSame as the database: clients get no DB credentials or direct DB access.
- Clients → CacheA cache has no auth layer of its own and holds data shaped for your backend.
- Clients → SearchSearch clusters aren’t public: queries go through your API for auth, rate limits and query shaping.
- Clients → DB proxySame as the database: clients get no DB credentials or direct DB access.
- Clients → QueueClients can’t be trusted to enqueue directly — there’s no validation or auth in between.
- Clients → DLQClients can’t be trusted to enqueue directly — there’s no validation or auth in between.
- Clients → Pub/sub topicClients can’t be trusted to enqueue directly — there’s no validation or auth in between.
- Clients → Event streamClients can’t be trusted to enqueue directly — there’s no validation or auth in between.