Why API gateway?

One client, one checkout call, three backend services. Watch what changes when a gateway sits in front of them.

1
Part 1 · Watch the concept

The idea in 15 seconds

A fixed animation — no controls, nothing to configure. It shows the shape of the problem and the shape of the fix, with the walkthrough written out underneath.

Loading player…

~15s animated walkthrough: duplicated auth/rate-limit/logging logic across services vs. one gateway.

The story the animation tells

A checkout screen needs four things to render: who you are, what's in your cart, whether your card is good, and whether the item is still in stock. So the frontend does the obvious thing — it calls Auth, Orders, Payments, and Inventory itself. Four addresses baked into the client, four round trips, and it works. On day one it always works.

Then every one of those four teams realises it can't trust the caller. Each one writes its own token check. Each one adds its own rate limit so a runaway script can't bury it. Each one logs requests in whatever format its own dashboard wanted. The same three concerns, implemented four times by four teams who never spoke — and from this moment they begin to drift apart. The team that shipped its token check in a hurry is now the weakest lock on the building, and nobody is looking at it.

The real bill arrives later. A fifth service means a new client release, because the addresses live in the app and some of your users will never update it. An abusive client can't be throttled in one place, only in four. And a security fix has to land four times, correctly, in four codebases.

So the video flips: one gateway slides in between the client and the fleet. The frontend now makes a single call and stops knowing the topology entirely. The fan-out didn't go away — watch the arrows, it's still four calls — it just moved behind the door, where it's a routing config instead of a client release. Auth, rate limiting, routing, and logging light up inside the gateway, and the duplicated badges on the four services go dark.

The point. A gateway doesn't delete complexity, it relocates it. You trade one extra hop and a component every request now depends on for a single place to enforce auth, throttling, and logging — which is usually the better trade, right up until that one place goes down.

2
Part 2 · Run the numbers

Interactive traffic simulator

Now drive it yourself. Pick a mode, set the traffic rate and capacities, then run or spike the load and watch real counters — queue depth, drops, 429s, auth checks per request — respond to your settings.

Direct fan-out
Each checkout call fans out to 3 services, and Orders/Inventory each re-check the token themselves.
sent
0
success
—
overloaded drops
0
gateway 429s
—
Authhealthy
queue 0.0 / drains 8/s
Ordershealthy
queue 0.0 / drains 8/s
Inventoryhealthy
queue 0.0 / drains 8/s
Auth checks performed
0
≈ — checks per request (client + 2 services re-check)
Last decisions
Run traffic to see decisions.
Why this matters
  • Cross-cutting concerns move to one place. Direct mode re-validates the token 3 times per request across 3 services; the gateway validates it once and forwards trust downstream.
  • Backpressure protects the fleet. Trigger a burst in Direct mode and watch services turn amber/red with no protection. Switch to Gateway and the same burst gets absorbed as fast, cheap 429s before it ever reaches a service.
  • The client gets simpler, not the system. The gateway still has to know how to route, retry, and aggregate — that complexity doesn't vanish, it centralizes.
Traffic console
Run steady traffic or fire a spike and compare modes.
Try this
Hit “Send spike” and watch Auth turn red first — it's taking 3 hits per request while Orders and Inventory only take 1. Then switch to Gateway and repeat.