Conceptly
← All Concepts
πŸšͺ

API Gateway

IntegrationA common front door placed in front of many backend services

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

πŸ”— Relationship

Dashed line animations indicate the flow direction of data or requests

Why do you need it?

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.

Why did this approach emerge?

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.

How does it work inside?

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.

What is it often confused with?

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.

When should you use it?

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.

API platforms exposing many microservices to external clientsSystems where web and mobile clients need different response compositionPlatforms that need centralized auth, rate limits, and loggingSystems that want to hide backend changes behind a stable external contract