API Gateway Concepts
What an API gateway does
- Sits at the edge in front of services: routing, TLS termination, auth, quotas, observability.
- Can compose multiple backends behind one hostname or path prefix.
- Offloads cross-cutting work so services stay focused on domain logic.
Routing, authentication, rate limiting
- Route by path, host, header, or weight for blue/green and canary deploys.
- Validate JWT/OAuth centrally; forward trusted identity headers to upstreams (carefully).
- Enforce rate limits and WAF rules before traffic hits fragile services.
Aggregation of services
- BFF (backend-for-frontend) pattern aggregates calls for one client type to reduce chattiness.
- Watch latency stacks: one slow dependency blocks the whole aggregate unless you parallelize or degrade gracefully.
- Avoid turning the gateway into a god service with business rules that belong downstream.
Examples in cloud architectures
- AWS API Gateway, Azure API Management, Google Apigee, Kong, Traefik, Envoy-based ingress.
- Often paired with service mesh (mTLS, retries) inside the cluster while the gateway handles north-south.
- Use stage/prod separation and infrastructure-as-code for gateway config.