Architecturebffbackends for frontendsexperience api

Backend for frontend

Definition

A backend for frontend is a dedicated backend per client type, usually owned by the team building that client, which aggregates and shapes data from general-purpose services for that client.

In practice

A single general API forces one response shape and one release queue on web, mobile and partner clients with different needs. A BFF composes the calls a screen needs in parallel close to the services, trims payloads for slow mobile networks, and releases with its client. Separate BFFs are also separate failure domains.

Each BFF duplicates some logic, and shared business rules in BFFs make clients drift apart; keep them thin and put rules in services. Too many BFFs multiply operational work, and a BFF that grows its own domain logic becomes another backend to own.

Example

The mobile BFF serves GET /home by calling profile, recommendations and orders services in parallel and returning a 6 KB payload, where the web client's shared API would return 80 KB across three calls.