Backend for Frontend Pattern
The Backend for Frontend (BFF) pattern introduces a dedicated API layer for each type of client — web, mobile, and third-party — so that each client gets a tailored interface without bloating the underlying microservices with client-specific logic.
The Backend for Frontend (BFF) pattern introduces a dedicated API layer for each type of client — web, mobile, and third-party — so that each client gets a tailored interface without bloating the underlying microservices with client-specific logic.
What the diagram shows
This flowchart illustrates three client types — Web App, Mobile App, and Third-Party API Consumer — each communicating with its own dedicated BFF service rather than directly with the shared backend microservices.
Each BFF: - Accepts the request from its specific client type - Aggregates data from multiple downstream microservices (User Service, Product Service, Order Service) in parallel or in sequence - Shapes the response to match the client's data requirements — the mobile BFF returns a compact payload optimized for bandwidth, while the web BFF returns richer data for a full-featured UI
The downstream microservices remain generic and client-agnostic. They expose simple, fine-grained APIs, and all client-specific aggregation logic lives in the BFF.
Why this matters
Without BFFs, a single generic API must satisfy the conflicting needs of every client type. Mobile apps on limited bandwidth need small payloads; web apps need rich data; third-party consumers need stable, versioned contracts. Trying to satisfy all three with one API leads to either over-fetching, under-fetching, or a bloated API surface.
BFFs solve this by giving each team ownership of their client's API contract. Changes to the web experience don't risk breaking the mobile app. The pattern pairs naturally with GraphQL Query Execution — some teams implement BFFs as GraphQL gateways. For the upstream routing layer, see API Gateway Request Flow.