Decision guide

API Gateway vs BFF vs Service Mesh

Where should cross-cutting concerns and client-specific logic live?

Side by side

CriterionAPI gatewayBackend for Frontend (BFF)Service mesh
TrafficNorth-south (edge)Client → backendsEast-west (internal)
Main jobsAuthN, quotas, routing, WAFAggregation, shaping, client auth flowsmTLS, retries, timeouts, telemetry
Owned byPlatform teamClient/product teamPlatform team
Business logicNonePresentation/aggregation onlyNone
ExamplesKong, Envoy Gateway, Apigee, AWS API GatewayNode/Go/Kotlin service per appIstio, Linkerd, Cilium

When to choose each

API gateway

Edge proxy for external traffic: TLS, auth, rate limits, routing.

Choose when

  • External/north-south traffic
  • Central rate limiting and key management
  • Routing and canaries

Avoid when

  • Client-specific aggregation
  • Business logic

Backend for Frontend (BFF)

A service per client type that aggregates and shapes data.

Choose when

  • Web and mobile need different payloads
  • Reducing chatty mobile calls
  • Keeping tokens server-side for browser apps

Avoid when

  • One generic client
  • Shared BFF for every client (defeats the purpose)

Service mesh

Sidecar/ambient proxies for internal traffic: mTLS, retries, telemetry.

Choose when

  • Many internal services needing mTLS and uniform telemetry
  • Zero-trust east-west traffic

Avoid when

  • Few services (operational overhead)
  • External API concerns like API keys and developer portals

Verdict

They're complementary: a gateway at the edge, BFFs owned by client teams behind it, and (if you have many services) a mesh for internal traffic. Avoid putting business logic in gateways or meshes, and avoid a single BFF shared by all clients.

Learn more

Sources