GateKeep is building a centralized API gateway for a platform that runs 50 microservices. The gateway is the single entry point for all client traffic. It must handle:
- Request routing - route incoming requests to the correct microservice based on URL path, HTTP method, and headers. Support versioned APIs (/v1/, /v2/).•Authentication - validate JWT tokens, API keys, or OAuth2 tokens on every request. Reject unauthorized requests before they reach backend services.•Rate limiting - enforce per-client rate limits with multiple strategies: fixed window, sliding window, and token bucket. Limits differ per plan (free: 100/min, pro: 1,000/min, enterprise: 10,000/min).•Request/response transformation - add headers, remove sensitive fields from responses, transform XML to JSON, gzip compression.•Circuit breaker - if a backend service is failing (> 50% error rate), stop forwarding traffic and return a cached fallback response.•Observability - log every request (method, path, status, latency), export metrics (Prometheus), and support distributed tracing (trace ID propagation).
Handle 100,000 requests per second at peak with < 10 ms gateway overhead.
Design an API gateway that handles routing, authentication, rate limiting, and request transformation for 50 microservices. Build this architecture under realistic production constraints, then validate tradeoffs in the design lab simulation.
Request path: The solution keeps ingress, service logic, and stateful dependencies separated so each layer can scale independently.
Reference flow: Web Clients -> Load Balancer -> API Gateway -> Rate Limiter -> API Service -> Auth Service -> Redis Cache -> Monitoring