A Backend for Frontend (BFF) is a server-side component built specifically for one kind of user interface or client, which aggregates and adapts calls to underlying services in the shape that client needs.

The pattern was described by Sam Newman, based on experience at SoundCloud.

The problem

A single general-purpose API serving a web app, a mobile app and a partner integration ends up serving none of them well. Mobile wants small payloads and few round trips; web wants rich data; partners want stable, versioned contracts. The shared API grows special cases for each, and every change needs every client team to agree. The API team becomes a bottleneck, which is Conway’s law at work.

The solution

Create a separate, thin backend per type of client:

Each BFF is owned by the team that builds its client, so it can change at the client’s pace. BFFs contain presentation and aggregation logic only. Business rules stay in the underlying services.

In the cloud, BFFs are often small serverless functions or containers behind an API gateway. GraphQL is sometimes used as an alternative that lets clients shape their own queries.

Backends for frontendsWeb appWeb BFFMobile appMobile BFFPartnersPartner APIeach client team owns its BFFOrders serviceCustomer serviceCatalogue service
Each client gets a backend shaped to its needs and owned by its team, over shared business services.

When to use it

Trade-offs

Like many patterns, BFF is as much about team structure as technology: organise backends around the teams and experiences they serve, and the architecture will follow.