Backend for Frontend: 7 Decisions Before You Add a BFF Layer
A backend for frontend is a service that shapes backend data and operations for one user interface or experience. A mobile field app may need a compact job summary, while an office dashboard needs a wide scheduling view. Giving each experience a suitable backend can reduce awkward compromises, but it also adds software that a team must run and keep.
This article explains seven decisions that determine whether the pattern is worthwhile: client needs, boundaries, data shaping, access, failure behavior, ownership, and proof of value. It also compares BFF architecture with a shared API and an API gateway using a practical field-service example.
How a backend for frontend works
A BFF sits between a client experience and the core business services. It can collect data from several services, shape the response for a screen, and reduce the number of calls a client must coordinate. It does not need to become the owner of every business rule.
Microsoft’s Backends for Frontends pattern describes tailoring backend services to different frontends. The business reason is key: different clients may need different response shapes, release schedules, or performance choices.
For example, a technician’s phone may need the next job, access notes, and a short asset list in one response. An office planner may need many jobs, staff availability, and filters. Those needs can justify different presentation services while both rely on the same authoritative scheduling rules.
1. Prove that the client experiences differ
Do not add a BFF merely because the app has both a website and a phone screen. A responsive interface may use the same API well. The pattern earns its cost when clients have materially different needs.
List the main journeys for each experience. Compare the data each screen needs, the number of calls it makes, and the network conditions it faces. Also compare who releases the client and how often users receive updates.
A mobile app used on weak connections may benefit from fewer, smaller responses. A desktop planner may need broad queries and live filters. However, if both clients ask for almost the same data, improving the shared API may be simpler than operating separate BFF services.
2. Keep core business rules in their proper home
A BFF should adapt an experience without creating competing versions of the business. Rules for pricing, job approval, invoice issue, and booking capacity often belong in authoritative business services.
For instance, the mobile BFF may format a job summary and choose which optional sections to request. It should not invent a different rule for whether a technician can complete that job. Otherwise, the same action may succeed on a phone and fail in the office.
Write the boundary down. Separate presentation logic, such as grouping fields for a card, from domain logic, such as approving a refund. If several BFFs repeat the same business decision, review whether the core service needs a clearer capability.
3. Shape data around useful tasks
A useful response gives the client enough data to complete a task without loading unrelated data. Start with the screen’s needs and find which backend service owns each fact.
The AWS discussion of the BFF pattern explains its role in serving frontend experiences through a dedicated layer. Use that idea to reduce client coordination, while keeping the data’s source and meaning clear.
For a technician’s next-job view, the BFF might combine appointment details, site instructions, and a short equipment summary. It should omit office-only margins and unrelated customer records. A smaller response can support both speed and clearer access boundaries.
Also define partial results. If an optional equipment image fails, the screen may still load. If the site access instruction fails, the user may need a clear warning before travelling. Shape the response to express those differences.
4. Enforce access throughout the request path
A BFF can centralize some checks for its client, but the core services still need suitable protection. Trusting any internal call without checking its authority can expose data through another route.
Decide how the user’s identity and permitted scope reach each service. A BFF that calls everything with broad service credentials must still enforce precise record and field access. Otherwise, one missed check can expose far more than a normal user should see.
Test with realistic roles. A technician may view assigned jobs but not every branch’s schedule. A customer may see their own booking but not internal notes. Include exports, search, and cached responses in the review, not just the first screen.
Our overview of identity management software explains how account lifecycle and access duties connect. The BFF must respect those changes as people move between roles or leave.
5. Set clear latency and failure behavior
Combining calls can reduce the work a client performs, but it does not remove slow dependencies. A BFF that waits for several services may make the whole screen wait for the slowest required response.
Define a response budget for the journey. Classify each dependency as vital or optional, then choose timeouts and fallback behavior accordingly. Do not silently replace missing current data with an old value unless the business accepts that policy.
Retry behavior needs care too. A repeated read may be acceptable, while repeating a write can create duplicate work unless the owning service handles it safely. The BFF should keep request references and the core operation’s contract.
Monitor the complete path. A fast BFF response that contains an error from a hidden dependency still represents a failed task for the user. Give support trace references and a way to find which component caused the problem.
6. Match service ownership to team ownership
A common benefit of BFF architecture is allowing an experience team to evolve its interface without waiting for every other client. That benefit depends on the team’s ability to own the extra service.
Agree who handles releases, monitoring, on-call support, security updates, and contract changes. If a mobile team can edit the BFF but another team must deploy every change, the expected independence may not appear.
Also avoid splitting too finely. A separate backend for every small screen can create needless duplication. Group related experiences where their needs and ownership align. Revisit the boundary as products and teams change.
Our guide to mobile backend as a service covers another set of backend capabilities. A managed backend product and a BFF solve different concerns, so assess which duties each would really take on.
7. Measure value against the added operating cost
Before build, record current client latency, payload size, call count, and failure rate for a few key journeys. Also note the coordination work needed to release a change.
Then compare the pilot using the same conditions. A BFF may reduce mobile calls but add another hop and service bill. It may also simplify client code while increasing backend support work. Include all those effects in the decision.
Avoid treating fewer requests as the only success measure. Users care whether they can open the job, understand its state, and save their work. The team cares whether it can diagnose and change the system safely.
Set a review point after the pilot. If the clients still need the same shape and schedule, a shared API may remain the better option. A pattern should earn its place through measured benefit.
BFF, API gateway, or shared API?
An API gateway commonly handles cross-cutting entry concerns such as routing, request limits, and some authentication controls. A BFF focuses on the needs of a particular experience. They can coexist, but their duties should remain clear.
A shared API offers capabilities to several consumers through one maintained contract. This is often a good fit when clients need similar data and behavior. It can also give the core services that several BFFs call.
Do not assume one product feature automatically covers every role. A gateway may support aggregation, but complex screen-specific behavior can still need its own owned service. Conversely, a small amount of response shaping may not justify a separate deployment.
Our article on API integration services offers useful context on connecting systems with clear contracts. Map the work first, then choose the layer that should own it.
A field-service journey from office to phone
Imagine a dispatcher assigns a visit through a desktop planning screen. The planning backend retrieves staff availability, existing jobs, and route context. The scheduling service still makes the final assignment decision.
The technician then opens the phone app. Its BFF retrieves the assigned visit, vital site instructions, and the latest job state in a compact response. It avoids sending the full planning dataset.
Now the technician loses connectivity. The BFF cannot solve offline work on its own because the phone cannot reach it. The mobile design needs local storage, clear pending states, and a later synchronization policy. The authoritative service must resolve any conflicting writes.
When the phone reconnects, the app submits the update with suitable duplicate protection and version context. The BFF passes that operation to the owning service. If the job has changed, it returns a clear conflict rather than making up a local success.
This example shows the boundary: the BFF improves the connected experience, while core services keep control of business decisions and offline conflict policy.
Test the boundary before a wide rollout
Pilot one screen that now needs several calls or excessive data. Keep the core service contracts stable where possible so you can isolate the effect of the new layer.
Test a normal user, a user with fewer permissions, and an expired session. Then slow one dependency and stop another. Confirm that required and optional data behave as documented.
Also compare client versions. An older mobile release may remain in use after the BFF changes. Keep supported contracts or give a clear version plan. A frontend-focused service still needs compatibility discipline.
Finally, give support a short operating guide. It should show the journey, dependencies, trace fields, deployment owner, and rollback path. These details make the added layer manageable after the launch team moves on.
Watch for signs the pattern needs revision
Review the design when BFFs start copying the same rules, calling each other in chains, or exposing broad generic endpoints. Those signs may mean the boundaries no longer match the clients.
Similarly, if every release needs all teams to deploy together, investigate the shared contracts. The architecture may show separate services while the operating process remains tightly coupled.
Make changes based on evidence. You may merge similar BFFs, move common rules into a domain service, or keep a small shared API. The goal is a reliable experience and a team that can keep it.
Often Asked Questions
Does every mobile app need a BFF?
No. A shared API may work well when clients have similar needs. Use a BFF when distinct journeys or constraints justify its added cost.
Can a BFF replace an API gateway?
They have different duties, though features can overlap. Define routing and shared entry controls separately from experience-specific data shaping.
Should business rules live in the BFF?
Keep authoritative rules in the service that owns the business capability. The BFF can adapt presentation without creating a competing approval or pricing policy.
Does a BFF make an app work offline?
No. Offline work needs client storage, pending states, and synchronization rules. The BFF helps only when the client can reach it.
Add a BFF when the experience earns the layer
A backend for frontend helps when clients need meaningfully different data and behavior. Keep business authority in core services, protect access across the full path, and measure the pilot against its operating cost. Start with one difficult journey and prove the benefit before adding more services.