Overview
A Backend for Frontend is a server-side component dedicated to one user experience. Instead of forcing mobile, web and partner clients through one generic API, each gets a backend shaped for its screens. The BFF is typically owned by the frontend team, which removes the cross-team queue for API changes.
How it works
The client calls only its BFF. The BFF fans out to domain services, merges and trims the results, and returns a response that maps one-to-one to a screen.
Mobile app --> mobile-bff --+--> orders-service
+--> catalog-service
Web app --> web-bff ---+--> profile-service
A typical mobile endpoint, GET /home, might call three services in parallel, drop fields the phone never shows, and return one compact JSON document. The web BFF calls the same services but returns richer data and supports server-side rendering. Cross-cutting concerns such as token exchange and rate limits are handled here or in a gateway in front of the BFFs.
Pitfalls
- Business rules migrating into the BFF. Keep it a translation and aggregation layer; domain decisions belong in domain services.
- Copy-pasted client code across BFFs. Extract shared libraries only for truly generic concerns like auth.
- Serial downstream calls. Parallelise calls and set timeouts so one slow service does not stall the screen.
- One BFF per team rather than per experience, which recreates the shared-API problem.
Key takeaways
- One backend per client experience, owned by the frontend team.
- Keep BFFs thin: aggregate and reshape, do not decide.
- Accept some duplication in exchange for client fit and team autonomy.
- Pair with a gateway for shared edge concerns.