categories.api-design Intermediate
API Gateway: Role and Core Functions in Microservices
API Gateway
Core Functions
| Function | Description |
|---|---|
| Routing | Forward requests to microservices |
| Auth | Centralized JWT/API Key validation |
| Rate Limiting | Traffic control, DDoS protection |
| SSL Termination | Handle HTTPS at edge |
| Request Transform | Format conversion, field filtering |
| Load Balancing | Distribute traffic across instances |
| Caching | Cache frequent responses |
| Observability | Centralized logging/tracing/metrics |
Common Implementations
- Kong: Open-source, Nginx-based, rich plugins
- AWS API Gateway: Serverless-friendly
- Nginx / Traefik: Lightweight, self-hosted
- Envoy: High-performance, powers Istio
BFF (Backend for Frontend)
Different clients get dedicated BFFs that aggregate specific microservice data—more flexible than a single shared gateway.
Gotchas
- Gateway is a single point of failure—deploy with HA (multiple instances + health checks)
- Keep Gateway as a thin layer; avoid business logic here
Interview bonus: Distinguish API Gateway (north-south traffic) from Service Mesh (east-west, e.g., Istio).
✦ AI Mock Interview
Type your answer and get instant AI feedback
Sign in to use AI scoring
