Technically, an API gateway is a reverse proxy with additional tasks. The HTTP standard RFC 9110 uses both words for the same role. What is meant is an intermediary that acts like the actual server toward the client and forwards the requests inward. An API gateway builds on that. It knows the APIs behind it, maps every call to an API and a calling application, and applies the rules that hold for this combination. The backend systems stay hidden from the clients and can evolve without the address of the API changing.
The API gateway pattern in microservices architectures
In a microservices architecture, the API gateway pattern describes a single entry point for all clients. A client addresses the gateway and does not need to know the individual services. The gateway forwards the call to the responsible service or calls several services and combines their responses. One variant is the Backend for Frontend (BFF) pattern, in which each type of client, such as a web application and a mobile app, gets its own gateway with a matching API.
Which tasks an API gateway bundles
The benefit lies in the bundling. TLS termination, authentication, rate limiting, response caching, and logging are solved once at the gateway and apply to every API behind it. The teams of the individual services concentrate on the business logic. A project for a lottery company shows how these tasks work together. There, the APIs for mobile apps and the online shop are secured with OAuth 2, and caching sits in front of the resource-intensive backend calls. The cache answers recurring queries when many customers retrieve their tickets at the same time as the results are announced. Details are in the case study.
API gateway architecture and where the gateway sits
An API gateway sits at the boundary between two zones, the clients outside and the services inside. A load balancer is often placed in front of it and distributes the calls across several gateway instances, so the failure of one instance does not interrupt traffic. We know this redundancy from operations. For a booking portal, the MuleSoft runtimes ran in HA mode, and we applied security patches instance by instance during ongoing operation. A gateway can run as a standalone service, in a container, on Kubernetes, or as a service of a cloud provider. Which form fits depends on where your APIs run and who operates the gateway.