liveBook · Manning

Backend-for-frontend pattern

As explained in The Design of Web APIs, Second Edition

A backend-for-frontend is a consumer-specific backend API that aggregates and optimizes one or more underlying APIs for a particular frontend application or channel.

A backend-for-frontend (BFF) is an experience API that aggregates and optimizes business APIs for a particular consumer, such as a mobile app or website. The consumer team usually manages it, and it may use GraphQL rather than REST. section 13.8

A BFF can sit between business APIs and a frontend in a layered architecture. Layers need clear responsibilities and disciplined organization: too many components or duplicated work can make a system inefficient and difficult to maintain. section 13.8

Adapting a legacy client

An old banking app can send POST requests but not PATCH requests to update transfers. A BFF could transform its request; if many consumers share the limitation, address it centrally instead. One suggested alternative is POST with the X-HTTP-Method-Override: PATCH header. section 14.2.1

How The Design of Web APIs, Second Edition covers it

How deep it goes
Explains its experience-API role, consumers, ownership, and the organizational risks of adding layers.
Examples
Uses a POST-only banking app that needs to update transfers as an example of adapting consumer requests.
What you can do after
Apply it to aggregate and optimize APIs for a frontend or adapt requests to that consumer’s constraints.
How it connects
Connects experience APIs to business APIs and distinguishes both from system APIs; also considers REST and GraphQL.

Also explained in

Compare how 4 books explain backend-for-frontend pattern →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of The Design of Web APIs, Second Edition. The section links point to the parts of the book it draws on.