router

API
Gateways

The entry point for all client requests. An intelligent layer that acts as the protector and navigator of your microservices.

What is a Gateway?

Think of it as a Reverse Proxy on Steroids. While NGINX is great at L4/L7 routing, an API Gateway handles advanced application concerns like authentication, rate-limiting, and protocol translation.

Public Clients
API GATEWAY

Core Responsibilities

alt_route

Dynamic Routing

Maps /v1/users to the User microservice.

vpn_key

Auth Termination

Validates JWTs so your app servers don't have to.

translate

Transformation

Converts XML to JSON or gRPC-Web to internal gRPC.

heart_broken

Resilience

Circuit breaking for failing downstream services.

stacks

Aggregation

One request from mobile = 5 internal requests.

monitoring

Logging/Metric

Entry-point observability for all traffic.

3. Circuit Breaking

If a downstream service starts failing or timing out, the Gateway can "Trip the Circuit" and return a fast-fail response (503) immediately instead of letting the failure propagate.

ClosedTraffic flows normally
keyboard_double_arrow_right
OpenFast Failure Mode
keyboard_double_arrow_right
Half-OpenTesting with a few requests

The Toolset

Cloud Native

  • Envoy Proxy: Ultra-fast, the gold standard for CNCF.
  • Kong: Built on NGINX, very popular for enterprise.

Managed Services

  • AWS API Gateway: High cost, but scales to infinity.
  • Cloudflare Workers: Serverless edge compute.

Interview Guidance

"Why not use a Load Balancer?"

A standard Load Balancer (ELB) just moves packets. A Gateway knows your business rules (Auth, Rate Limits per User ID).

Mentioning Bottlenecks

"Single Point of Failure" Risk.

Explain that you'd run multiple instances of the Gateway behind an L4 Load Balancer to avoid the Gateway becoming a single failure point.