API Gateway
API Gateway sits as a single entry layer in front of multiple backend services, receiving external requests and forwarding them to the right destination. Along the way it handles cross-cutting concerns like authentication and shared policies in one place, so individual services do not have to repeat them.
βΆArchitecture Diagram
π RelationshipDashed line animations indicate the flow direction of data or requests
Once a system contains many services, clients should not have to learn where every request belongs. Shared concerns like authentication, logging, and rate limiting also start getting duplicated across services. That creates stronger coupling between clients and backend internals, and internal changes leak into external contracts too easily. API Gateway exists to reduce that front-door chaos.
In simpler systems, the target server was obvious enough that clients could talk directly to it. But once service boundaries multiplied, external contracts needed to stay simpler while internal paths became more complex. Add authentication, rate limits, and trace correlation, and the cost of handling those concerns in every service grows quickly. API Gateway emerged because backend structure and frontend simplicity needed a cleaner separation.
Requests hit the gateway first, and the gateway applies policies and routes traffic to the right backend services. It can validate tokens, add shared headers, compose responses, and emit telemetry around the request path. The key is not replacing backend logic, but cleaning up the common entry point in front of many services.
API Gateway and Service Discovery both seem related to where requests go, but they solve different layers of the problem. API Gateway manages external entry, routing, and shared policies. Service Discovery resolves the current location of live service instances inside the system. One is a front door; the other is an internal address book.
API Gateway is especially useful when many clients interact with many backend services and you want one stable external contract. It is also valuable when shared policies should be applied consistently in one place. The main discipline is to keep the gateway focused on entry-point concerns rather than letting it absorb domain logic and become a second monolith.