Backend for Frontend
BFF
A server-side layer that gives a specific client, such as a website or mobile app, data in the form it needs. It can combine several internal API calls into one response.
What is a Backend for Frontend?
A Backend for Frontend (BFF) is an architectural pattern in which a server-side API is designed around the needs of a particular client. A website and a mobile app might use the same catalog, pricing, and shipping services but display different information. Instead of making each client coordinate those services itself, a BFF gives it a contract suited to what it needs to display and do.
How it works
A BFF receives a client request, calls the internal APIs it needs, and shapes the results into a response. It can run independent calls in parallel, omit unused fields, and turn internal failures into states the client knows how to handle. It owns the client-facing contract, not the underlying business rules. For example, the pricing service decides which discounts apply; the BFF decides how much pricing detail to return.
Example: a mobile product page
The mobile app calls GET /mobile/products/42. The BFF fetches the title and image from the catalog service, the current price from pricing, and the delivery estimate from shipping. The app gets a single response instead of managing three calls over a mobile connection. The desktop site might use a different contract that also includes pickup locations. If shipping times out, the mobile BFF can still return the product and mark the estimate as unavailable, provided the app is designed to handle that state.
When to use it
A BFF pays off when clients have meaningfully different workflows, payload needs, or release schedules. It lets teams change one client's API contract without redesigning the shared services around it. If clients need essentially the same data and operations, start with a shared API. There is no reason to add a separate BFF for every screen or to split iOS and Android simply because they run on different platforms.
An API gateway typically handles shared concerns such as routing and rate limiting. A BFF owns client-specific behavior. The roles can coexist: a gateway can route requests to a mobile BFF or a web BFF. Fewer client requests do not automatically mean lower latency, though. The BFF adds a network hop, and a slow downstream service can still delay the whole response.
In a system design interview
Explain why a shared API is or isn't enough before drawing separate BFFs. Then walk through one request: which calls can run in parallel, which data is required, and what the user sees when a dependency fails. On the product page, a missing estimate can be an explicit partial result; a missing price should not silently become zero.