API Gateway
Definition
An API management tool that sits between a client and a collection of backend services. It acts as a reverse proxy to accept all API calls, aggregate the various services required to fulfill them, and return the appropriate result.
Explain Like I'm New
The front desk receptionist at a massive hotel. If the hotel has 50 different departments (Microservices), you don't want the customer (React App) wandering the halls trying to find the Kitchen server, the Billing server, and the Cleaning server. The customer talks ONLY to the Receptionist (API Gateway). The Receptionist figures out exactly which department to call, gathers the info, and hands it to the customer.
Real World Example
AWS API Gateway or Kong. The mobile app only knows one URL: `api.mycompany.com`. When it requests `/users`, the Gateway secretly routes it to Microservice A (Internal IP 10.0.0.1). When it requests `/products`, the Gateway routes it to Microservice B (Internal IP 10.0.0.2).
Common Use Cases
- •Microservice routing
- •Centralized Authentication (Gateway checks JWT before letting it into the internal network)
- •Rate Limiting
Interactive Example
Interview Questions
basic
- Does the frontend application need to know the IP addresses of all the underlying microservices?
intermediate
- Why is Centralized Authentication a major benefit of an API Gateway?