Skip to content
Optimal Lab

System design · interactive

API gateways

A gateway is the single front door to many services. It terminates TLS, checks auth, applies rate limits, serves cached responses and routes the rest, so each service doesn't have to. Send different requests and see where each one stops.

GET /products (valid token)

  1. TLS
  2. Auth
  3. Rate limit
  4. Cache
  5. Route
  6. Service

200

Passes every check; cache miss, routed to the catalog service.

Request

Step 1 of 4

  1. 1

    One front door

    Clients see one host. Behind it, routes map to many services that can move and change.

    /orders → orders service, /search → search.

  2. 2

    Auth and quotas in one place

    Validate tokens and scopes, enforce per-client rate limits, log every call, consistently.

    Services still check their own permissions.

  3. 3

    Cache and transform

    Serve repeat GETs from cache, compress, rewrite paths, translate protocols.

    A BFF tailors responses per client.

  4. 4

    Keep it thin

    It's on every request path: make it highly available, and keep business logic out of it.

    Kong, AWS API Gateway, Envoy.

In production

Tools and technologies

Most API platforms put a gateway in front of services.

Not tied to one language — use these names when you search docs or design a system.