TL;DR
One backend per client experience: one call per screen, owned by the team shipping the UI. When a BFF pays off, what it costs, and the 2026 security case.
One generic API serving every client sounds efficient until you watch what it does to a phone. The web app, the iOS app, and the Android app all call the same endpoints, and because those endpoints are designed to serve everyone, they serve no one well: a single screen on mobile assembles itself from a dozen fine-grained calls over a slow network, each one draining battery and data, while every change to the shared contract needs a negotiation between teams that ship on different schedules. That was the situation at SoundCloud in 2015, and the fix they landed on is still the clearest statement of the pattern: give each client its own backend, owned by the team that builds the client.
The pattern is the Backend for Frontend, or BFF. Phil Calçado described it in September 2015, writing from SoundCloud, where the term had been coined by the web tech lead, Nick Fisher. Sam Newman catalogued it two months later, in "Backends For Frontends" (18 November 2015), drawing on what he had seen at REA as well as SoundCloud. A decade later the pattern got a second life for a completely different reason: in August 2026 the IETF published RFC 10017, OAuth 2.0 for Browser-Based Applications, which ranks a BFF as the most secure architecture for a browser app — not because of screen shaping, but because it keeps tokens off the browser entirely.
This article covers what a BFF actually is, where it sits relative to an API gateway, the options it competes with, what running several of them costs, and the decision rule that keeps you from building one you do not need.
What a BFF actually is
A BFF is a small server-side service built for exactly one user experience — the web app, the mobile app, a partner integration — and owned by the team that builds that experience. It sits between one client and the domain services behind it, receives one coarse request per screen or interaction, fans out to the services that hold the data, and returns a single response shaped exactly for that screen. The domain services stay general-purpose and know nothing about screens; the BFF is where the screen's needs live.
Two words carry the whole definition, and they are what separate a BFF from a gateway or a shared API. The first is one experience. Sam Newman passes on the rule he likes, from Stewart Gleadow (who credited Calçado and Mustafa Sezgin): one experience, one BFF. iOS and Android may share a BFF when they present the same experience and one team owns both apps — SoundCloud did exactly that — but the web app and the mobile app do not, because their screens, networks, and release cadences differ. The second word is owned. The BFF is typically built, deployed, and operated by the same team that ships the client, in whatever language and on whatever cadence fits that team. That is what removes the cross-team queue: the team that owns a screen changes the endpoint behind it in the same release, without asking another team to change a shared contract.
Calçado's SoundCloud account makes the origin concrete. After SoundCloud broke its monolith into services, the web app and the new iOS app both talked to one generic public API. Rendering a single profile page meant many calls to different endpoints — GET /tracks/1234.json for the author of a track, and more after that — which hurt on slow mobile networks, and every change to the shared API needed coordination across teams. The first version of the fix still looked like the public API: generic endpoints, many calls per screen. The real fix was moving the screen's object into an API the client team owned, so a profile the app had assembled from several calls became one resource, GET /user-profile/123.json. His conclusion is the sentence that defines the pattern: the BFF is part of the application. It is the server half of the client, not an API the client calls from the outside.
The pattern has since spread well beyond SoundCloud. AWS's write-up of the pattern notes that Netflix's Android team swapped the API backend of its Android app for a BFF, gaining closer scrutiny, observability, and integration with Netflix's microservice ecosystem — the same autonomy argument, at a much larger scale.
What a BFF does — and what it must not
The work that belongs in a BFF is the work that only one client cares about:
Newman's own example is a wishlist screen assembled from three services — a Wishlist service that holds the item ids, a Catalog service that holds names and prices, and an Inventory service that holds stock levels. The BFF exposes one method for the list the screen shows, calls the services downstream once the ids are known, and returns one payload. A short sketch in TypeScript shows the shape:
// Mobile BFF: GET /wishlist — one call from the client, three downstream
export async function getWishlist(userId: string) {
const items = await wishlistService.list(userId); // critical: let it throw
const [catalog, stock] = await Promise.all([
catalogService.getMany(items.map((i) => i.productId)),
inventoryService.getMany(items.map((i) => i.productId)),
]);
return items.map((item) => ({
id: item.productId,
name: catalog[item.productId].name,
price: catalog[item.productId].price,
inStock: stock[item.productId].available > 0,
}));
}The list of what a BFF must not do is just as important, because every one of these is a BFF quietly turning back into a monolith:
BFF vs API gateway — they compose, they do not compete
The confusion between a BFF and an API gateway is the most common one in this area, and it comes from the fact that both sit in front of your services and both can aggregate. The difference is who they serve. A gateway is shared and client-agnostic: it handles the concerns that are the same for every client — TLS termination, routing, rate limits, authentication at the edge, logging — and it does them once, for all traffic. A BFF is per-client and changes with the screen. The gateway routes to the right BFF; the BFF shapes the response for the right client. Our API gateway patterns guide covers the gateway side in detail, and our service mesh vs API gateway comparison draws the line between the edge and the internal traffic plane.
In practice the two layers stack, with the gateway at the edge and one BFF per experience behind it:
The boundary that matters is ownership, not the network hop. Everything above the BFF layer changes with the user interface; everything below it changes with the business. When a team asks whether a piece of logic belongs in the gateway or in a BFF, the test is whether every client needs it identically. If yes, it is gateway work. If it exists because one screen renders data a particular way, it is BFF work. A gateway that starts shaping responses per client has become a shared BFF, which is the worst of both: one deployable, many owners, and every client change is a negotiation again.
The 2026 reason to build one: the browser BFF
For ten years the argument for a BFF was about screens and networks. In August 2026 it became an argument about security, and it is now the strongest reason to build one even if your API is already well shaped.
RFC 10017, OAuth 2.0 for Browser-Based Applications, published as Best Current Practice BCP 212, describes three architectures for single-page applications that rely on OAuth, and ranks the Backend for Frontend first. In that architecture the BFF is a confidential OAuth client: it holds client credentials registered with the authorisation server, runs the authorisation code flow with PKCE, and keeps the access and refresh tokens on the server, bound to the user's session. The browser receives only a session cookie — HttpOnly, Secure, SameSite — and never sees a token. When the app calls an API, it calls the BFF with the cookie; the BFF looks up the session, attaches the access token, refreshes it when needed, and forwards the call.
The RFC gives the BFF three core responsibilities: interact with the authorisation server as a confidential client, manage access and refresh tokens in the context of a cookie-based session so no token is exposed to the browser, and forward requests to the resource server with the correct access token. It also states the obligations that come with the design: the BFF must act as a confidential client with credentials registered at the authorisation server, must implement a proper CSRF defence (the browser now authenticates with a cookie), and must forward only to an allowlist of API destinations — otherwise it becomes an open proxy that attaches a user's token to requests for arbitrary hosts.
The middle design in the RFC, the token-mediating backend, runs the code flow on a server but hands the access token to the browser, which then calls APIs directly. It protects the refresh token but leaves the access token readable by any injected script, and the RFC recommends it only when a proxying BFF is not possible. The third design, a browser-based OAuth client that handles everything in the browser, is the one the RFC does not recommend for business applications, sensitive applications, or applications handling personal data. The practical consequence is blunt: if you ship a browser SPA that calls APIs with OAuth, the standards body now expects a BFF in front of it, and "tokens in localStorage" is a design the current best practice explicitly moves away from.
Note what this does to the definition. The browser BFF is still one backend per experience — it serves one SPA — but its primary job is token custody, not screen shaping. A team that builds one for security reasons should not then load it with screen-shaping logic for other clients. One BFF, one experience, one job: the browser app's backend, holding its tokens.
The options head-to-head
A BFF is one of four ways to put a client-shaped API in front of domain services. The right choice depends on how many clients you ship and how different they are.
| Option | What the client gets | Team autonomy | Cost you pay |
|---|---|---|---|
| One shared general-purpose API | Fine-grained endpoints; the client assembles each screen | Low — every change is a shared-contract negotiation | Chatty clients, over-fetching, slow mobile screens |
| One BFF per experience | One call per screen, shaped for that client | High — the client team owns its backend and ships with the UI | Duplicated integration logic, more services to operate, one extra hop |
| Single GraphQL gateway | The client asks for exactly the fields it needs, one endpoint | Medium — schema changes are shared, but clients query independently | Schema governance, query complexity, caching is harder; one gateway serving all clients can recreate the shared-contract problem |
| Federated GraphQL (subgraphs per domain) | One endpoint, composed from domain subgraphs | Medium-high — domains own their subgraphs | The most moving parts: gateway, subgraphs, schema composition, and the same client-shaping question pushed into resolvers |
GraphQL deserves a sentence because it is the option people reach for instead of a BFF, and the two are not substitutes. A single GraphQL gateway solves over-fetching — the client asks for the fields it needs — but it does not solve ownership: the schema is still shared, and a change that serves one client is a change to a contract every client reads. Multiple BFF GraphQL servers, one per client, are the combination that actually works: each client gets its own schema, owned by its own team. Our REST vs GraphQL vs gRPC decision guide covers the API-style choice itself, including when a single GraphQL endpoint is the right call and when it is not.
The honest comparison is that a BFF trades deliberate duplication for independent evolution. Each experience changes its contract at its own pace; the general-purpose API stops being the place where every client's needs collide. That trade is worth it exactly when the clients genuinely differ — and it is waste when they do not.
What it costs you
The costs are real, and SoundCloud paid all of them. Calçado records that the team reached about five BFFs, and each one fetched and merged the same user-profile data in slightly different shapes — duplicated integration logic across services, written five times, drifting five ways. That is the first cost: duplication. Every BFF re-implements the calls to the services its screens need, and the shared parts — auth, alerting, monitoring, rate limiting, header sanitisation — either get duplicated too or get extracted into a shared framework, which is a platform team by another name. SoundCloud's Core Engineering team built exactly such a shared BFF framework; the duplication did not disappear, it moved.
The second cost is operational surface. Five BFFs are five deployables, five dashboards, five on-call rotations (or five services sharing one rotation, which is how a team ends up on call for a service it did not write). Each one needs its own scaling, its own timeouts, and its own failure modes. A single shared API has one of each. The third cost is the extra network hop: every request now passes through the BFF before reaching a service, which adds latency — small on a fast internal network, but real, and worth measuring rather than assuming away. The fourth is drift: BFFs that start identical diverge as their clients diverge, and after a year the web BFF and the mobile BFF may implement the same screen differently, with different bugs.
There is also a failure mode worth naming: the BFF that grows business logic. It starts as a formatting helper — "just compute the discount here, the service doesn't expose it" — and a year later it is a second implementation of pricing that no one tests. The guardrail is the rule from the earlier section: if two clients need it, it belongs in a domain service. Enforce that in review, because no linter will catch it.
Recommendation
Default to one BFF per experience once you ship a second client whose needs differ. If you have a web app and a mobile app, and the mobile app's screens, network budget, and release pace are not the web app's, give each its own backend, owned by the team that ships the client. That is the pattern's home territory, and it is where the autonomy pays for the duplication.
Build a browser BFF for security even if you have one client. If your browser SPA calls APIs with OAuth, the RFC 10017 architecture is now the expected one: a BFF as the confidential client, tokens on the server, a cookie to the browser. This is not a screen-shaping decision; it is a token-custody decision, and it applies to a single SPA.
Keep a shared API while you have one client, or while your clients are genuinely the same experience. A product with only a web UI does not need a BFF — Newman is specific about this. Neither does a product whose iOS and Android apps present the same screens and are owned by one team; that is one experience, and it gets one BFF. The pattern earns its cost when clients differ. Until then, a shared API with careful versioning is simpler, cheaper, and easier to operate.
Architecture Decision
>
Decision: Adopt one Backend for Frontend per distinct user experience (web BFF, mobile BFF, partner BFF), behind a shared edge gateway; and build a browser BFF as the confidential OAuth client for any SPA that calls APIs with OAuth, per RFC 10017.
>
Context: The product ships a web app and mobile apps against a growing set of domain services. The shared general-purpose API forces mobile clients into many calls per screen over slow networks, and every contract change needs cross-team coordination. Separately, the browser SPA currently handles OAuth tokens in the browser. The team can operate a handful of small services, but has no platform team to run a shared BFF framework.
>
Options considered: (a) One shared general-purpose API for all clients. (b) One BFF per experience, owned by the client teams. (c) A single GraphQL gateway for all clients. (d) Federated GraphQL with domain subgraphs. (e) BFFs plus a shared internal library for the duplicated integration code.
>
Why this one: Option (b) is the only one that removes the cross-team queue — the client team changes its endpoint in the same release as its screen — and it is the only option that also satisfies the RFC 10017 browser-token requirement. Option (a) is right while there is one client, but it is the bottleneck we are fixing. Option (c) solves over-fetching but leaves the shared schema as the negotiation point, and it does not keep tokens off the browser. Option (d) is the right shape for a large organisation with domain teams, but it is more machinery than a team without a platform function should operate. Option (e) is adopted in a limited form: the shared parts (auth, telemetry, rate limiting) go into a thin internal library, but the screen-shaping code stays duplicated per BFF, because that duplication is the price of independent evolution.
>
What it costs you: Duplicated integration logic across BFFs, with the profile-fetching pattern likely written three times; more deployables to operate and monitor; one extra network hop per request; and the ongoing discipline of keeping business logic out of the BFFs. The shared library needs an owner, or it rots and the BFFs quietly re-duplicate it.
>
When to reverse it: If the clients converge — the mobile app becomes a thin wrapper around the web app, or a single team takes over all clients — merge the BFFs back into one shared API and delete the duplication. If the team shrinks to the point where operating five services is the constraint, consolidate to a shared API plus a single GraphQL gateway and accept the negotiation cost. If a future RFC or framework makes token custody a solved commodity (for example, a managed BFF), retire the hand-rolled browser BFF and keep only the screen-shaping ones.
When not to use a BFF
Do not build a BFF because you have microservices. The number of services behind your API is not the trigger; the number of genuinely different clients is. A single web app calling twenty services is well served by a shared API, or by the server-side rendering layer it already has. Our modular monolith vs microservices guide covers the prior decision — whether the services should exist at all — and a BFF does not fix a decomposition that is wrong.
Do not build one BFF per device. "One experience, one BFF" is about the experience, not the hardware: iOS and Android apps that show the same screens, owned by one team, share a BFF. Splitting them buys nothing but a second copy of the same integration code. And do not build a BFF for a third-party API you do not own — a partner integration is a client, and it gets a BFF when its needs differ from your own apps, not because it is external.
Do not use a BFF as a place to hide a service boundary you got wrong. If two BFFs both need the same aggregation — the same "user with their orders and their profile" shape — that aggregation is a domain capability, and it belongs in a service behind them. The BFF is the last place in the architecture where duplication is acceptable, and it is acceptable only because the thing being duplicated is screen-specific.
Conclusion
The BFF is a small pattern with a large consequence: it moves the question "who owns this API?" from the backend team to the team that ships the screen. At SoundCloud that meant a profile page went from many calls against a generic public API to one call against a backend the client team owned, and the release queue for API changes disappeared with it. A decade later the same shape answers a different question — where OAuth tokens live for a browser app — and the IETF's answer, published in August 2026, is that they live in a BFF, on the server, behind a cookie.
The discipline is the same in both eras. One experience, one BFF. The BFF aggregates, reshapes, and guards the perimeter; it does not hold business logic, read a database, or serve a second client. The duplication is deliberate and bounded, the gateway stays shared and client-agnostic, and the decision is revisited the day the clients converge. Build it when you can name the client difference it serves — the screen, the network, the release pace, or the tokens. Until then, the shared API is the simpler answer, and simpler is a feature.
For the surrounding decisions, our frontend architecture guide covers how the client side is rendered and where a BFF fits into SSR and server components, and the API gateway patterns guide covers the edge layer that routes to the BFFs. The REST vs GraphQL vs gRPC guide is the companion piece for choosing the API style each BFF exposes.
Why This Matters
Understanding the business and technical context helps you make informed decisions rather than blindly following patterns.
Trade-offs to Consider
Every architectural decision involves trade-offs. Consider your specific requirements, team expertise, and scale when evaluating options.
When NOT to Use This
Knowing when a solution doesn't apply is as valuable as knowing when it does. Consider alternatives for your specific situation.
Decision Framework
Use this framework to evaluate whether this approach is right for your use case based on your specific constraints and requirements.