<strong>API Gateway</strong> is a single entry point for all client requests that routes them to appropriate microservices. It handles authentication, rate limiting, caching, and request/response transformation.
The Hotel Concierge Analogy
API Gateway is like a hotel concierge—guests don't directly access rooms, restaurant, spa. They ask the concierge who routes requests and handles authentication.
Hotel (Your System)
Many services
Concierge (API Gateway)
Single point of contact
Rooms (Microservices)
Actual services
Makes Request
Routes & Transforms
Process Request
Client calls gateway
GET /api/user/profile
Gateway authenticates
Verify JWT token
Gateway routes
Forward to User Service
Gateway aggregates
Combine responses from multiple services
Gateway transforms
Convert internal format to client-friendly JSON
Wrong
"API Gateway is just a reverse proxy"
Correct
<strong>API Gateway does much more</strong>: authentication, rate limiting, request/response transformation, caching, monitoring, and service aggregation. Reverse proxy just forwards requests.
Mobile app with microservices:
Without gateway: App calls 5 different services (complex)
With gateway: App calls one endpoint /api/dashboard
Gateway calls User, Orders, Recommendations, Notifications services
Gateway combines responses into single JSON
App gets everything in one request (simple, fast)