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 specific consumer, such as a mobile application or website. The consumer team usually manages it, keeping consumer needs separate from system-level complexity. section 13.8

Adapting a banking API

A legacy banking application can send POST but not PATCH. A BFF can transform its POST-only request for transfer updates. Before adding a consumer-specific layer, compare broader solutions: PUT may replace PATCH, while X-HTTP-Method-Override can represent PATCH or DELETE through POST. section 14.2.1

Use the pattern deliberately:

  • Choose GraphQL when its specific capabilities provide value beyond a well-designed REST API over HTTP/2. section 14.8.2
  • Control layer boundaries and duplication; uncontrolled growth can make a distributed system inefficient, brittle, and difficult to maintain. section 13.8

How The Design of Web APIs, Second Edition covers it

How deep it goes
Explains aggregation, optimization, ownership, alternatives, and layering risks without detailing implementation internals.
Examples
Uses mobile and web consumers, a banking transfer API, unsupported HTTP methods, GraphQL, and method-override headers.
What it assumes
Assumes familiarity with consumers, business APIs, HTTP methods, and REST while distinguishing system, business, and experience layers.
What you can do after
Build it from scratch by designing a consumer-specific API and selecting adaptations or API types that fit its constraints.
How it connects
Connects experience APIs with business APIs, system APIs, REST, GraphQL, HTTP/2, and API layering.

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.