All the basics

What is an API gateway?

Put one front door before your services. It checks who is knocking, limits how often, and sends each request where it belongs.

A doorman at the gate. He checks every ticket and counts how often you come, so the people inside can just do their jobs.

Press Play to watch it run · 4 steps

Without a gateway each service checks logins itself. With one, a single door checks, limits and routes.

Every service on its own, or one front doorWithout a gateway each service checks logins itself. With one, a single door checks, limits and routes.Mobile appFront doorOrdersPayments

Tap any box to see what it is and what it talks to.

  • Client
  • API gateway
  • Service
Open in playground
Text description
  1. The app calls Orders. Orders checks the login itself.
  2. Fine, but that check is now Orders' job.
  3. Then the app calls Payments. Payments checks the login again.
  4. Each team wrote its own check. Payments has a bug and lets a bad request in.
  • One front door handles login, limits and routing for everyone.
  • Services stay simple because the shared chores live at the door.
  • It is a single point of failure unless you run several.

Reach for it when

When ten services each need login checks and rate limits, do it once at a front door. With two, skip it.

The catch

Every request passes through it, so a slow or crashed gateway hurts all ten services at once, even if each is healthy.

Say it in an interview“I would put a gateway in front for login checks, rate limits and routing, and run several copies behind a load balancer so it never fails alone.”