Serksa
All Concepts
DevOps & Infrastructure

API Gateway

1

What is it?

<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.

2

Think of it like...

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

3

Visual Flow

📱Client

Makes Request

🚪API Gateway

Routes & Transforms

🔧Microservices

Process Request

4

Where you see it

1

Client calls gateway

GET /api/user/profile

2

Gateway authenticates

Verify JWT token

3

Gateway routes

Forward to User Service

4

Gateway aggregates

Combine responses from multiple services

5

Gateway transforms

Convert internal format to client-friendly JSON

5

Common Mistake

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.

💡 Real-World Example

Mobile app with microservices:

1

Without gateway: App calls 5 different services (complex)

2

With gateway: App calls one endpoint /api/dashboard

3

Gateway calls User, Orders, Recommendations, Notifications services

4

Gateway combines responses into single JSON

5

App gets everything in one request (simple, fast)