One front door for all clients that routes, secures and limits requests to the services behind it.
An API gateway is one front door for all your backend services. Clients talk to the gateway, and the gateway routes each request to the right service.
With microservices, a single screen in an app might need data from Users, Orders, Payments and Shipping. If the app calls all of them directly it must know every address, make many slow calls over the internet, and every service must be exposed publicly and handle login, limits and HTTPS by itself.
The API Gateway pattern puts one server in front of all the services. It is the single entry point for outside traffic (sometimes called "north-south" traffic: from outside to inside). Inside, services talk to each other on a fast private network.
A gateway is a reverse proxy with extra skills. It looks at the request path, header or method, picks the target service, applies shared rules, forwards the call and returns the answer.
| Job | What it means | Example |
|---|---|---|
| Routing | Match path, host or header and forward to a service | /orders/* to the Orders service |
| Authentication | Verify the token or API key before the call goes in | Check a JWT signature and expiry |
| Authorization (coarse) | Allow or deny by role or scope | Only admins may use /admin/* |
| Rate limiting and quotas | Limit calls per client | 100 requests per minute per key |
| TLS termination | Handle HTTPS at the edge, plain or mTLS inside | One certificate for the domain |
| Aggregation | Call several services and merge the results | Home screen = users + orders + offers |
| Protocol translation | Convert between styles | Public REST in, internal gRPC out |
| Caching | Keep common responses for a short time | Product list for 30 seconds |
| Resilience | Timeouts, retries and circuit breakers toward services | Stop calling a failing service |
| Observability | Logs, metrics and a request ID on every call | Trace ID added at the edge |
| Kind | Examples |
|---|---|
| Managed cloud | Amazon API Gateway, Azure API Management, Google Cloud API Gateway / Apigee |
| Open source | Kong, NGINX, Envoy-based gateways, Traefik, Spring Cloud Gateway, Tyk |
| Kubernetes | Ingress controllers and the Gateway API, which is the newer standard |
A simplified model: each service takes 20 ms, an internal hop takes 2 ms, the gateway adds 5 ms, and the client network round trip is the slider. Real numbers depend on your system.
| Term | Meaning in easy words |
|---|---|
| API gateway | A single entry point that routes outside requests to backend services |
| Reverse proxy | A server that forwards client requests to other servers. A gateway is a reverse proxy with extra features. |
| Routing | Choosing the target service from the path, host, header or method |
| Aggregation | Calling several services and merging their answers into one response |
| TLS termination | Ending the HTTPS connection at the gateway |
| Rate limiting | Limiting how many requests a client can send in a time window |
| Edge | The outer boundary of your system, where outside traffic enters |
| North-south traffic | Traffic between outside clients and your system. East-west means service to service. |
| Cross-cutting concern | A need shared by many services, like auth, logging or limits |
| Protocol translation | Converting one protocol or format to another (REST to gRPC) |
| Ingress | In Kubernetes, the rules and component that let outside traffic reach services |
| Choice | We gain | We lose |
|---|---|---|
| One gateway for everything | Simple, one place for rules | Shared risk and a central team that can slow others down |
| Several gateways (per client or per domain) | Independent teams and smaller blast radius | Duplicated rules and more to run (see Backend for Frontend) |
| Aggregation in the gateway | Fewer client calls | Gateway grows business logic and becomes harder to change |
| Auth only at the gateway | Simple services | A mistake or bypass exposes everything inside |
| Managed gateway | No servers to run, scales by itself | Cost per request and less control |
| Self-hosted gateway | Full control and plug-ins | You run, patch and scale it |