API Gateway
An API Gateway is a tool that sits between the client and the set of backend services. It's the single entry point into the system: it hides how it's built inside and gives each client an API tailored to it. It also handles authentication, monitoring, load balancing, caching, request limiting and logging. It's like a hotel front desk: you don't go looking for housekeeping or the chef, you ask the front desk for everything and they handle it.
Microservices usually offer fine-grained APIs: each does something very small. But a client, like an order screen, needs data from several services at once. Without a gateway, the app would have to call 5 services on its own. The gateway gives 1 single entry, gathers the answers and adds management features. It's like a waiter: instead of you going to the kitchen, the bar and the till, you ask them for everything.
A good API Gateway usually has: authentication and authorization (who you are and what you can do), security, retries and circuit breaking, logging and tracing (following a request across every service), API composition (merging several answers into 1), API versions, routing and lists of allowed or blocked IPs. It's like airport security: it checks your ticket and luggage and sends you to the right gate.
The API Gateway has advantages: it hides the internal structure, gives a central view of the whole API, simplifies client code and adds monitoring, analytics and tracing in one place. If tomorrow you split 1 service into 3, the client changes nothing. It's like a company's customer service number: even if 5 areas are reorganized inside, you keep calling the same number.
