API gateway

An API gateway is a single entry point that routes client requests to backend services and handles authentication, rate limiting and monitoring.

Summarize this

What is an API gateway?

An API gateway is a server that sits between client applications and your backend services. Instead of a mobile app or website calling ten different services directly, it sends every request to one address. The gateway checks who is calling, applies limits, routes the request to the right service and returns the response. It becomes the front door of your application programming interface layer.

The pattern became common with microservices, where a single screen may depend on many small services. Without a gateway, each client must know every service address, handle each authentication scheme and cope with each failure. The gateway removes that burden from the client.

‍

How an API gateway works

When a request arrives, the gateway runs it through a chain of steps before any backend code executes.

  • Authentication and authorisation: validate API keys, JWT tokens or OAuth access.
  • Rate limiting and throttling: cap requests per client to protect services from abuse.
  • Routing: map a public path to an internal service.
  • Transformation: rewrite headers, merge responses or convert formats.
  • Caching: serve repeated responses without hitting the backend.
  • Logging and metrics: record every call for monitoring and billing.

A simplified routing rule looks like this:

GET /api/orders/* → orders-service:8080
GET /api/users/* → users-service:8081
policy: require_jwt, rate_limit=100/min

‍

Main features and benefits

A gateway centralises concerns that would otherwise be repeated in every service. Security rules live in one place, which reduces the risk of a forgotten check. Clients get a stable contract even when services behind it change. Teams can version an API, retire old routes and roll out changes gradually. Observability improves because every call passes through one point that can log latency, errors and usage.

Cross-cutting concerns it handles

TLS termination, CORS headers, request validation, IP allow lists and response compression are typical examples. Handling them at the edge keeps the services themselves simple.

‍

API gateway vs reverse proxy vs load balancer

These components overlap, which causes confusion. A gateway is application-aware, while the others work at a lower level.

ComponentMain roleUnderstands the API?
API gatewayAuth, limits, routing, transformationYes
Reverse proxyForward traffic, hide servers, cachePartly
Load balancerSpread traffic across instancesNo

‍

When to use one, and when not to

A gateway pays off when you expose several services, serve multiple client types, need consistent security or sell API access. It is often unnecessary for a small application with a single backend, where it adds latency, cost and one more component to operate. Remember that a gateway is also a single point of failure, so it should run in a redundant setup.

  • Keep business logic out of the gateway.
  • Version your routes from day one.
  • Monitor latency added by each policy.
  • Document the public contract, for example with OpenAPI.

‍

Common options

Managed gateways exist at every major cloud provider, and open source gateways such as Kong run on your own infrastructure. For lighter needs, an edge platform like Cloudflare can enforce authentication and rate limits in front of any backend, and low-code backends such as Xano expose managed API endpoints with built-in access control.

‍

API gateways at BeBranded

When we build web applications that rely on several services, we decide early whether a gateway is justified, then design routing, security and monitoring so the product scales without rework. Learn more about our web app development service.

FAQ

An API gateway is a single entry point that receives client requests, applies security and limits, routes them to the right backend service and returns the response.
A reverse proxy forwards traffic and hides servers. An API gateway adds API-specific features such as authentication, rate limiting, request transformation and usage analytics.
Usually yes. With many services, a gateway gives clients one address and centralises security and monitoring instead of repeating them in each service.
No. A load balancer spreads traffic across instances of one service, while a gateway routes by path and applies policies. They are often used together.
It adds a small amount of latency, since each request passes through an extra hop and policy checks. Caching and keeping policies lean limit the impact.
It can be if run as a single instance. Deploy it redundantly across zones and monitor it closely to avoid that risk.

Ready to boost your conversions?

Our team is here to understand your needs & work with you to create your next projects.
Get news, infos and resources.
Actionable tips delivered straight to your inbox.
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.