What is an API gateway and what responsibilities does it handle?

Answer

An API gateway is a server that acts as the single entry point for all client requests, routing them to appropriate backend services. It handles cross-cutting concerns so individual services do not have to: Authentication and authorization (validate JWTs or API keys before requests reach services), rate limiting (enforce per-client limits centrally), request routing (route /v1/users to the Users service, /v1/orders to the Orders service), SSL termination (handle HTTPS, forward as HTTP internally), load balancing (distribute traffic across service instances), request/response transformation (adapt legacy APIs to REST conventions), logging and tracing (add correlation IDs, emit metrics), and caching (cache common responses). Popular API gateways include AWS API Gateway, Kong, Nginx, and Apigee.