← Back to blog

Backend for Frontend (BFF): Pattern, Architecture, Use Cases

November 22, 2026
Backend for Frontend (BFF): Pattern, Architecture, Use Cases

A backend for frontend (BFF) is a server-side layer built for one specific user experience, such as your iOS app, your web dashboard or a partner portal, instead of one general-purpose API that every client has to share. The browser or phone talks to its own BFF, and the BFF talks to your internal services, shapes the data for that screen and keeps secrets out of the client. If you are planning a product with more than one interface, deciding where this layer lives early saves expensive rework later, and that is the kind of architecture decision we help product teams make at Requestum.

Requestum
Build a Backend That Fits Each Interface
Requestum creates tailored web and mobile applications, with software architecture expertise to help teams shape solutions around distinct user experiences.
Visit

TL;DR

  • A BFF is one backend per user experience, owned by the same team that owns the interface it serves.
  • It removes over-fetching, collapses many service calls into one and keeps tokens and secrets on the server.
  • An API gateway handles what is identical for every client (auth checks, rate limits, routing). The BFF handles what differs per client.
  • It pays off when clients need differently shaped data and different teams own them. With one interface or near-identical requests, skip it.
  • Keep BFFs thin: shared business logic belongs in downstream services, or you build a second monolith.

Table of Contents

What the backend for frontend pattern is

The classic definition comes from Sam Newman: one backend per user experience rather than a single general-purpose API backend. The user-facing application is really two parts. One is the client-side application running outside your perimeter. The other is a server-side BFF running inside it. The two are tightly coupled and maintained by the same team.

The problem it solves is organizational as much as technical. When a web app, an Android app and an iOS app all lean on one shared backend, every team competes for changes to it. Each new screen turns into a negotiation, and the backend slowly becomes a bottleneck. Limiting the number of consumers of each backend makes it easier to change and gives frontend teams more autonomy, which matters most in mobile development against microservices.

The term itself dates back to SoundCloud, where Nick Fisher coined BFF. Client teams moved an application-specific user-profile object into their own backend, replacing a string of calls with a single request. The result was simpler client code and better performance.

Microsoft's Azure Architecture Center describes the Backends for Frontends pattern in the same terms: a separate backend service for each frontend interface, sitting between the client and the backend services, smaller and less complex than a shared backend.

What the backend for frontend pattern is

The problem in practical terms

General-purpose endpoints return data for every possible consumer. A phone on a mobile connection then downloads fields it never displays, and a single screen may need calls to several services. KrakenD's documentation frames the BFF as the fix for over-fetching: the client makes one call and gets back only what it needs.

A GraphQL BFF goes further. Capital One's engineers describe a GraphQL BFF on AppSync as a UX-specific API and an anti-corruption layer between system APIs and the frontend. Frontend developers name the exact fields they want at a single endpoint, which avoids both over-fetching and under-fetching.

How BFF architecture works

The request path is simple to describe:

  1. The client (web, mobile, kiosk, partner app) sends a request to its own BFF.
  2. The BFF calls one or more downstream services, ideally in parallel.
  3. It aggregates, filters and reshapes the results into exactly what that screen needs.
  4. It returns one response to the client.

This matters most in microservice systems. Newman notes that BFFs are useful even with a small number of backend services but become essential in large microservice architectures, where one call into a BFF commonly fans out to several services. His example is an e-commerce wish-list page that aggregates items, stock levels and price.

Microsoft's reference architecture shows the full picture. Mobile and web requests pass through an API Management gateway that handles authorization, monitoring, caching and routing. Each client then has its own BFF, running as an Azure Function, which forwards requests to specialized microservices that hold the business logic. The mobile BFF is optimized for bandwidth, while the desktop BFF can retrieve several pages per request.

What a BFF should and should not do

Kenneth Lange's guide lists what a BFF is good for: calling backends in parallel, filtering out internal or sensitive data, translating internal codes into readable values, adding OAuth2 and single sign-on in front of unsecured backends, and shielding the client from backend API changes. It can also speak SOAP, FTP, REST or GraphQL to the systems behind it while exposing a single protocol to the client.

What it should not do is own your domain. AWS Prescriptive Guidance is explicit that in micro-frontend setups the BFF belongs to one micro-frontend and does not follow a domain model. Its jobs are authorization toward private APIs, aggregation from different sources and data transformation to reduce network load. It can run as a GraphQL API, a serverless function or a container.

Backend for frontend vs API gateway

Teams often confuse the two, and many run both. The cleanest boundary is a question: is this responsibility the same for every client, or does it change per frontend? Apidog's comparison puts it this way: shared concerns belong in the gateway, per-client concerns in the BFF.

ConcernAPI gatewayBFF
Token validation, rate limiting, loggingYes, once for all clientsNo, avoid duplicating
Routing to servicesYesCalls only the services its client needs
Payload shape per screenNoYes
Aggregating several service callsRarelyYes
Owned byPlatform or infrastructure teamThe frontend team
Number of instancesOne entry pointOne per client experience

The typical layered flow looks like this: the mobile client sends a request with its token, the gateway validates it, enforces limits, logs it and routes it to the mobile BFF. The BFF calls product, inventory and pricing services, trims the payload and returns one response. The same article warns about the most common mistake: putting auth and rate limiting inside the BFF. It also warns that a BFF stuffed with shared business logic becomes a second monolith, and that using gateway configuration for per-client transformation couples the wrong teams.

There is also a looser definition. microservices.io treats Backends for Frontends as a variation of the API Gateway pattern with a separate gateway for each kind of client, for example one each for a web app, a mobile app and a third-party app. Either way, the principle is the same: one entry point per kind of consumer.

If you are designing the architecture of a web product from scratch, the choice of website development services and of the frontend stack shapes how much of this layer you will need.

When a separate BFF makes sense

Microsoft's guidance gives a practical checklist. Use the pattern when:

  • a shared backend would need heavy development overhead to serve everyone;
  • you want to optimize the backend for the needs of specific client interfaces;
  • you keep customizing a general-purpose backend for several interfaces;
  • a particular language suits one interface's backend better than the others.

The benefits follow directly: a smaller service that is easier to manage, per-interface performance tuning, and frontend team autonomy over language, release cadence and prioritization.

A recent rule of thumb from OneEnv is that a BFF earns its cost when two conditions hold together: clients need differently shaped data (compact pre-joined mobile payloads versus dense web tables) and different teams own those clients.

The pattern is not suited to every system. Microsoft says to skip it when interfaces make the same or similar requests, or when only one interface exists. Vercel's implementation framework says the same: one interface talking to the backend does not justify a BFF.

Design costs to plan for

Every extra layer has a price, and good design accounts for it up front:

  • An extra network hop. It can add latency, so keep the BFF in the same region as downstream services and fan out requests in parallel, never sequentially.
  • Per-service overhead. Each BFF needs its own deployment, security review, and integration and load tests.
  • Duplication. Pagination, error mapping and auth glue can drift apart across BFFs unless shared libraries or a shared service carry the common parts.

A modern alternative is GraphQL. Microsoft notes that GraphQL can, in some systems, remove the need for a separate BFF layer because clients request exactly the data they need, and that an API gateway plus microservices may be enough in scenarios where BFFs are usually recommended. In practice many teams use GraphQL inside a BFF rather than instead of one, as the Capital One example shows.

Authentication and secrets in a BFF

The security argument for the pattern is often stronger than the performance one. A single-page app is a public client: it cannot keep a secret. Storing access tokens in the browser exposes them to anything running in that page.

In a BFF-based OAuth/OIDC setup, the BFF acts as a confidential client and manages tokens on the app's behalf. Auth0 describes how the browser holds only a Secure, HttpOnly session cookie while the backend proxies requests with the access token, so the SPA never stores tokens.

Duende's documentation spells out the same property for its ASP.NET Core BFF: the browser holds a session cookie and never sees tokens. The BFF exchanges the cookie for bearer tokens when forwarding requests, so tokens never cross the trust boundary. Server-side sessions also make forced logout and back-channel logout possible. Duende describes three ways to expose APIs: logic hosted inside the BFF process for the lowest latency, a direct remote API call with a bearer token, or a reverse proxy for complex routing.

A few habits keep this layer safe:

  • Do not simply forward the frontend's token to every downstream API. Give each hop its own audience and keep a trail of who called what.
  • Keep rate limiting and shared authorization in the gateway.
  • Filter internal or sensitive fields out before anything reaches the client.

For a wider checklist, see our guide to API security best practices.

Message queues and the BFF

Many searchers pair the BFF with queue questions, because a BFF that only polls downstream services can feel slow when data changes often. An event-driven design fixes that. In AWS's event-driven BFF implementation, microservices publish events asynchronously, so senders and receivers stay decoupled. BFF event consumers update denormalized, UI-ready projections in a database, and a stream handler pushes change notifications over WebSockets so connected clients refresh their screens in near real time.

The split of roles is worth remembering. A queue carries work or events between services, and a BFF serves one client. Use a queue when the BFF must trigger slow work (an export, a payment check, a notification) without making the user wait, and use events when the client view should update as the data changes. Failed messages should land in a dead letter queue so they can be inspected and replayed instead of silently lost.

Keeping a BFF lean

Most BFF failures come from drift, not from the idea itself. Three practices come up repeatedly in public engineering write-ups:

  1. Govern business logic. Decathlon's team, as reported by InfoQ, used an architecture committee and architecture decision records to catch duplicated or misplaced logic, and circuit breakers and bulkheads to isolate downstream failures and degrade gracefully.
  2. Centralize shared orchestration. SoundCloud found that with many small services and no intermediate layer, logic was duplicated across BFFs and drifted. It introduced a shared value-added service for common orchestration, and stressed that teams need a strategy for how many BFFs is too many.
  3. Decide ownership early. Pricing and eligibility decisions belong in downstream services. The BFF adapts data, handles protocol differences and authentication, and in some stacks server-side rendering.

For the contract between BFFs and the services behind them, an OpenAPI-first approach with agreed service-level objectives keeps teams aligned. We cover that in our API integration strategy article. If mobile is your main client, the mobile app backend guide covers budget and security for the first 90 days.

A worked example

Imagine a retail product with a web storefront and a mobile app. The product page needs the item, price, stock level and reviews. The web page shows a dense table with every attribute. The phone shows a compact card with an image, a price and an availability badge.

Without BFFs, both clients call the shared product API and then the inventory and review APIs, discard what they do not use and merge the rest on the device. With two BFFs, the web BFF returns the full structure in one call and the mobile BFF returns the compact card. Each team changes its own BFF when a screen changes, and neither waits for the other. The gateway in front still validates tokens and enforces rate limits once for both.

How Requestum can help

Choosing where a BFF sits, which team owns it and which stack runs it is easier with a clear picture of your product before code is written. Requestum offers web development services and mobile app development, along with a discovery phase, business analysis and QA, so the architecture, the interfaces and the testing plan are shaped together. Our teams also work with Node.js and Angular, which are common choices for BFF and frontend work. You can see the full range on our software development services page.

Requestum

If you are launching a product with several interfaces, or untangling a shared API that every team is waiting on, talk to us about a discovery phase.

Our perspective

We think of a BFF as a team decision first and a technical one second. The question we ask at the start of a project is who owns each screen and who has to wait for whom. If the answer is that the mobile team waits on the web team for every API change, a dedicated layer for each experience is usually the cleanest way out.

The second question is where shared logic lives. A BFF should shape and secure data for one interface, and pricing, eligibility and other domain rules should stay in the services behind it. Settling this during business analysis and discovery, before the first endpoint exists, is far cheaper than splitting a bloated layer later.

Quality assurance belongs in the same conversation. Each BFF is one more contract to test, and treating it as part of the product from the start keeps releases predictable. Web, mobile, design, analysis and QA are work we do together at Requestum, which is why we like to plan the interfaces and the layer behind them as one system.

Dmitry

FAQ

Is a BFF the same as an API gateway?

No. A gateway applies the same rules to every client, such as token validation, rate limiting and routing. A BFF serves one client experience and reshapes data for it. Many architectures put a gateway in front of several BFFs.

Do I need a BFF if I only have one web app?

Usually not. Microsoft's guidance advises against the pattern when only one interface exists or when interfaces make similar requests. It starts to pay off when a second client with different data needs, and often a different team, appears.

Can GraphQL replace a BFF?

Sometimes. GraphQL lets clients request exactly the fields they need, which removes much of the reshaping a BFF does. Teams often still keep a thin BFF for authentication, session handling and aggregating non-GraphQL services.

Who should own the BFF?

The team that owns the frontend it serves. That is the point of the pattern: the people who change the screen can change the API behind it without waiting on a shared backend team.

Sources