A separate backend shaped for each kind of client, such as web and mobile.
Backend for Frontend (BFF) means building a separate backend for each type of client (phone app, website, smart TV), instead of one general API for all of them.
Different clients want different things. A phone on a slow network needs small images and short lists. A desktop website can show full specs, big photos and reviews. A TV app needs huge banners and simple navigation, controlled by a remote.
If one general API tries to serve all of them, it either sends too much data (wasting bandwidth on the phone) or forces clients to make many calls and glue the data together. And every time one client needs a change, the shared API becomes a place where the teams argue and wait for each other.
The BFF pattern (introduced by Sam Newman and used by SoundCloud, among others) gives each client its own small backend layer. The phone team owns the Mobile BFF, the web team owns the Web BFF. Each one speaks the language of its own screen and talks to the shared microservices behind it.
| Job | Example |
|---|---|
| Aggregate | Call Users, Orders and Offers, and return one /home response |
| Trim and reshape | Drop unused fields, rename them to match the UI, use smaller images |
| Translate | Turn internal gRPC or old SOAP into simple JSON for the client |
| Client-specific auth flow | Session cookies for the web, tokens in secure storage for mobile |
| Client-specific caching | Cache for short times for the TV, long for static web assets |
| Handle partial failure | If Recommendations is down, still return the page without them |
| Layout | How it works | Good for |
|---|---|---|
| One BFF per client type | Mobile BFF, Web BFF, TV BFF, each its own deployable | Clients that differ a lot, with separate teams |
| One BFF per experience | One BFF per product area, such as checkout or search | Large products with many teams |
| GraphQL as the BFF | One GraphQL schema, clients pick fields | Many clients with similar data but different field sets |
| Shared BFF library | Common code in a library, thin BFFs on top | Reducing duplicated logic between BFFs |
A simplified model. Load time = waiting rounds x round trip + data size / network speed. It ignores server work and caching. Sizes are made-up round numbers to show the idea.
| Term | Meaning in easy words |
|---|---|
| BFF | Backend for Frontend: a backend layer made for one type of client |
| Frontend / client | The user-facing app: website, phone app, TV app |
| Aggregation | Calling several services and merging the answers into one response |
| Over-fetching | Receiving more data than the screen uses |
| Under-fetching | Receiving too little, so the client must make more calls |
| Chatty client | A client that makes many small calls to build one screen |
| Payload | The data sent in a request or response |
| Fan-out | One incoming request causing several outgoing calls |
| Experience API | Another name for an API shaped around a user experience, like a BFF |
| Partial failure | Some of the services fail while others work |
| GraphQL | A query language where the client asks for the exact fields it wants |
| Choice | We gain | We lose |
|---|---|---|
| One general API | One thing to run, no duplication | Over-fetching, many calls, and a shared bottleneck between teams |
| A BFF per client | Best fit and team freedom | More services and some duplicated code |
| Shared library across BFFs | Less duplication | Teams must upgrade together, and coupling grows |
| GraphQL as a single BFF | Clients choose their fields | Complex server, query cost control and caching are harder |
| BFF owned by frontend team | Fast change | Frontend developers must run backend services |
| BFF owned by a platform team | Consistent practices | Slow requests, the same bottleneck as before |