Skip to content

API gateway

Requirements

Auth, rate limit, routing, request IDs.

Capacity

Start at 100 QPS, 10× peak, 1 year of data. Size storage from payload bytes × QPS × retention.

API

REST plus idempotency keys on mutating endpoints.

Data model

Primary key, access pattern, retention, and the index that makes the hot query cheap.

Architecture

flowchart LR
  Client --> Gateway --> Service --> Store

Scaling

Stateless compute, shard the write path, cache the read path, queue work that can be async.

Failure modes

Dependency timeout, hot shard, cache stampede, poison message, regional outage.

Observability

RED on the edge, USE on hosts, traces across the queue, SLOs on availability and latency.

Security

Authn/z at the gateway, least privilege to data stores, no secrets in Git.

Trade-offs

Gateway vs service mesh; aggregation vs chatty clients.