Architecture PatternsIntermediate13 min read1 questions

API Gateways, Service Mesh and BFF

Where cross-cutting concerns live once you have more than one service. What belongs in the gateway, what belongs in the mesh, and when a BFF earns its keep.

Covers: Gateway responsibilities, backend-for-frontend, service mesh and sidecars, service discovery, north-south vs east-west

The moment you have several services, the same questions appear in every one: who is this caller, are they allowed, are they over their rate limit, where do I send this, and what happens when the callee is down. An API gateway answers those for traffic entering the system; a service mesh answers them for traffic between services.

North-south and east-west traffic

The gateway handles traffic entering the system; the mesh handles traffic between services. Different problems, different tools.

ClientEdgeServiceTap a box for detail

Flow

  • ClientsAPI gateway
  • API gatewayBFF layer
  • BFF layerService mesh
  • Service meshOrder service
  • Service meshUser service
  • Order serviceUser service(via sidecars)
Filter
0/1 mastered
Intermediateapi gatewayservice mesharchitectureAsked at Netflix, Uber

30-second answer

The gateway owns edge concerns for untrusted external traffic: TLS termination, authentication, rate limiting per API key, request validation, routing and response caching. The mesh owns transport concerns between trusted internal services: mTLS, retries, timeouts, circuit breaking, load balancing and telemetry, implemented as a sidecar so it is uniform across languages. Business logic, authorisation decisions that depend on domain state, and data validation belong in the service - the classic failure is a gateway that accumulates business rules until it becomes an undeployable monolith nobody owns.

Showing 1 of 1 questions for api-gateway-and-service-communication.

Check your understanding

3 questions · no sign-up, nothing stored

0/3 answered
Question 1

1.Which concern should NOT live in the API gateway?

Question 2

2.What is the primary purpose of a BFF?

Question 3

3.When does a service mesh usually start to pay for itself?