mediumSystem Design

What is an API gateway?

808 views
01

Understand the problem

Explain the API gateway pattern.

api-gateway
02

Attempt it yourself

Sketch your approach before reading the solution — that's what interviews test.

Stuck? AI Nudge Available

Get a conceptual hint to guide your logic without spoiling the final implementation.

03

Study the solution

The solution is waiting

Give it an honest attempt first — then compare your thinking with the full walkthrough.

04

Read the code

Gateway routing table (concept)
// Match path -> upstream service. Cross-cutting policy applied centrally.
const routes = [
  { prefix: "/auth",   upstream: "http://auth-svc:8080" },
  { prefix: "/orders", upstream: "http://orders-svc:8080", auth: true, rateLimit: "100/min" },
  { prefix: "/users",  upstream: "http://users-svc:8080", auth: true },
];

// Every request flows through the same pipeline:
//   tls -> authenticate -> rateLimit -> route(prefix) -> proxy(upstream)
05

Join the discussion

Discussion (0)

Sign in to join the discussion.

No responses yet. Be the first to share what you think.