What is an API Gateway?

Last updated: July 2026

An API gateway is a managed front door for your APIs — one entry point that routes, authenticates, and rate-limits every request. The idea is centralization: the cross-cutting work every endpoint needs (who are you, how fast may you call, where does this go, what happened) moves out of N services and into one policy layer that clients can’t walk around.

Key takeaways

QuestionAnswer
What it isOne entry point: route, authenticate, limit, transform, observe
vs. load balancerLB picks an instance; gateway makes API-aware policy decisions
vs. reverse proxyA gateway is one — with an API policy brain attached
vs. service meshGateway = north-south (clients in); mesh = east-west (service to service)
The honest questionWhether you need one at all — many systems don’t yet

What the front door does

A gateway’s job list, as configuration rather than N copies of middleware — a typical declarative route:

# gateway route: one entry, policy attached
route: /orders/**
  service: orders-api:8080          # routing — topology stays private
  auth: bearer-jwt                  # authentication at the door
  rate_limit: 100/min per key       # budgets before backends
  transform:
    strip_headers: [X-Internal-*]   # translate between edge and inside
  timeout: 5s
  observe: log + trace + metrics    # one place to watch everything

From the client’s side, a managed gateway disappears into the SDK — one call, with the door’s checks applied before any code of yours runs:

// JavaScript / Node.js — Back4app JS SDK
// One managed entry point: auth, rate limits, and routing applied per call
const receipt = await Parse.Cloud.run('placeOrder', { cartId: 'crt_812' });
// The platform's gateway verified the session, applied limits,
// and routed to the function — none of it in your code.
console.log(`Order ${receipt.orderId} confirmed`);

The four look-alikes, separated

Reverse proxyLoad balancerAPI gatewayService mesh
Question answered”Forward this inward""Which instance?""Which service, may you, how fast?""How do services talk safely?”
TrafficNorth-southNorth-southNorth-southEast-west
Decision basisHost/pathHealth + algorithmAPI policy: auth, limits, shapeService identity
Typical layerL7 basicL4/L7L7, API-awareSidecars everywhere
RelationshipGateway’s parent classUsually in front of the gatewayCoexists behind it
API gateway architectureWeb, mobile, and partner clients send requests to a load balancer fronting a clustered API gateway, which authenticates, rate limits, and routes to internal services; the services and their topology stay private behind it.

Web

Load balancer

Mobile

Partners

API gateway (clustered)
auth · limits · routing ·
transform · observe

Orders service

Users service

Search service

Web, mobile, and partner clients send requests to a load balancer fronting a clustered API gateway, which authenticates, rate limits, and routes to internal services; the services and their topology stay private behind it.

The canonical pattern description adds the variation worth knowing: the Backend-for-Frontend — one thin gateway per client type, each shaping responses for its client — which trades deployables for the end of one-size-fits-none APIs.

The drawbacks, stated plainly

The gateway centralizes power, and centralization bills you four ways. Single point of failure: everything flows through it — run it clustered behind a load balancer or accept that its outage is the outage. The new bottleneck: every feature team now files config changes against one shared component; governance and self-service tooling are part of adoption, not extras. The monolith reborn: aggregation logic accumulating in the gateway quietly rebuilds the centralized app you decomposed — keep it policy-thick and logic-thin. Config sprawl: hundreds of routes with per-route policies is a codebase; review it like one. None of these argue against gateways; all of them argue against casual ones.

Common use cases

  • Microservices front doors — the origin story: many services, one coherent API, topology free to evolve behind it.
  • Multi-client products — web, mobile, and partners with different auth, shapes, and limits — the BFF’s home turf.
  • API monetization — keys, plans, quotas, and usage metering enforced at one point.
  • Migrations — the strangler pattern: the gateway routes old paths to the legacy system and new paths to its replacement, invisibly.
  • Edge policyCORS, TLS, header hygiene, and rate limiting applied once instead of N times.

Do you need one? A decision matrix

A gateway earns its keep when…Skip (or defer) it when…
Many services sit behind one APIOne service serves one client type
Clients differ in auth, shape, or limitsA reverse proxy already covers TLS + routing
Policy must be enforced centrallyPolicy is a middleware import away
Topology changes faster than clientsThe topology is one box
Someone owns the gateway as a productNobody would operate it

The unowned answer on most comparison pages: not yet is a legitimate architecture. Add the door when there’s a building behind it.

Limitations and trade-offs

  • Availability is now the gateway’s availability. Cluster it, health-check it, and rehearse its failure — the mitigation is standard and non-optional.
  • One hop of latency, honestly netted against the round trips and duplicated middleware it removes; measure, don’t assume either way.
  • Aggregation is a slope. Composing responses is legitimate; business logic in the gateway is the ESB pattern wearing a new badge.
  • Open-source options carry ops. Excellent gateways exist as open source (Envoy-based stacks and peers) — each a distributed system you now run, upgrade, and secure.
  • Managed gateways trade control for silence. The platform-operated door is the right answer exactly when gateway ops would be undifferentiated toil.

The gateway on Back4app

Back4app is an open-source Backend-as-a-Service (BaaS) platform that combines a managed database, auto-generated REST and GraphQL APIs, authentication, file storage, and Cloud Code serverless functions. The gateway layer comes with the platform: every request — REST, GraphQL, SDK, or Cloud Code call, as in the code tabs above — enters through a managed edge that authenticates sessions and keys, applies per-app rate limits, and routes to the generated APIs or your functions, with the platform operating the clustering and scaling that make a front door safe. The decision matrix collapses: you get the gateway’s guarantees on day one, and skip owning the door entirely.

Frequently asked questions

What is an API gateway and how does it work?

A single entry point sitting in front of your backend services. Every request arrives at the gateway, which authenticates the caller, applies rate limits, routes to the right service, optionally transforms or aggregates responses, and records observability data — then returns the result. Clients see one coherent API; the topology behind it stays private and changeable.

What is the difference between an API gateway and a load balancer?

Layer and intent. A load balancer distributes traffic across identical copies of a service for capacity and availability — it asks "which instance?" A gateway makes API-aware decisions — "which service, is this caller allowed, at what rate, with what transformation?" They are complementary: the classic arrangement runs a load balancer in front of gateway instances, and services behind both.

Is an API gateway just a reverse proxy?

It is a specialized one. Every gateway is a reverse proxy — it terminates client requests and forwards them inward — but with an API-shaped policy brain: authentication, per-key rate limits, request transformation, aggregation, and API-level observability. If you only need forwarding and TLS, a plain reverse proxy is enough; the gateway earns its keep when policy enters.

What is the difference between an API gateway and a service mesh?

Traffic direction. The gateway governs north-south traffic — clients entering the system. A service mesh governs east-west traffic — services talking to each other inside, via sidecars handling mTLS, retries, and routing. Large systems run both; small ones usually need neither the mesh nor, sometimes, the gateway.

What is the Backend-for-Frontend (BFF) pattern?

A gateway variation: instead of one gateway serving every client, each client type — web, mobile, partner — gets its own thin gateway shaping responses for its needs. It resolves the tug-of-war where one generic API serves everyone poorly, at the cost of more deployables. The BFF is the gateway pattern admitting that clients differ.

Is an API gateway a single point of failure?

Architecturally yes — everything passes through it — which is why production gateways run as clustered, horizontally scaled fleets behind a load balancer, with health checks and failover. The mitigation is standard; the sin is running the everything-door as a single instance because it worked fine in staging.

Does an API gateway add latency?

One hop, typically single-digit milliseconds — and often a net win: aggregation collapses multiple client round trips into one, caching answers repeats at the edge, and connection reuse to backends is faster than cold client connections. The honest accounting compares the hop against the round trips and duplicated policy code it eliminates.

When do you NOT need an API gateway?

More often than vendors say: a single service with one client type, a server-rendered app calling its own backend, internal APIs behind a VPN, or anywhere an existing reverse proxy already covers TLS and routing. A gateway earns its operational cost when there are many services, many clients, or real policy to centralize — not before.

Related terms

Compare with

Further reading

Ready to build your backend?

Start your project on Back4app in minutes — database, auth, APIs, and Cloud Code included. No credit card required.

Written and reviewed by Back4app Engineering, Back4app Engineering · Published 2026-07-27