SD Core

API Gateway

Single entry point that routes, authenticates, rate-limits, and aggregates calls to internal microservices.

Interview tip Lead with a 30-second definition, then one real system example and name 2–3 designs where API Gateway is non-negotiable.

① What it is (30 seconds)

Single entry point that routes, authenticates, rate-limits, and aggregates calls to internal microservices.

② How it works in system design

Clients call one gateway URL. Gateway validates JWT, applies rate limits, routes to service mesh or direct HTTP. Can compose multiple backend calls into one response (BFF pattern).
Typical placement
ClientEdge / GatewayAPIServicesData stores

③ Concrete system design example

Scenario: Mobile app home screen needs user profile + notifications + feed snippet. API gateway fans out three internal calls, merges JSON, caches public fragments at edge.

④ Important interview Q&A

QuestionAnswer
Gateway vs load balancer?LB distributes to homogeneous servers; gateway is smart routing, auth, composition across different services.
Where put rate limiting?At gateway for coarse per-API-key limits; finer limits inside domain services.
Single point of failure?Run gateway cluster behind LB; cache auth tokens; circuit break on downstream failures.

⑤ Seen in these system designs

In interviews, after explaining the concept, say: "This shows up directly in …" and link two designs.

⑥ Revision checklist

  • Auth at edge
  • Rate limit
  • Routing table
  • BFF aggregation
  • Circuit breaker on downstream
api-gatewaymicroservicesedge