- The requirements are significantly different for serving different frontends.
- One generic backend has too much logic.
- One generic backend needs to be managed by separate teams.
- Restricts the use of backends (BFFs) to one specific user interface or application.
- A single call in to a BFF results in multiple downstream calls to microservices.
- Number of BFFs
- Options
- One BFF per type of client. For example, Android and iOS will have different BFFs.
- One BFF per type of user interface. For example, Android and iOS will have the single mobile BFF.
- Recommendation
- BFFs should align around team boundaries. Team structure should drive how many BFFs you have. It can reduce the chance of cross-team coordination.
- Options
- BFFs should only contain client-specific logic and behavior. General business logic and other global features should be managed elsewhere in your application.
- Each BFF is smaller, less complex and faster than one generic backend.
- Each BFF is isolated from others.
- Each BFF can have different processes.
- Each BFF is independently scalable.
- Each BFF can be released independently.
Topic | Consideration | Possible Solution Options |
---|---|---|
Code Reusability | Code duplication across BFFs is highly likely |
The application needs to provide specific functionality for a mobile UI or third party.
- Book: Chris R.(2018). Chapter 8 External API patterns, Microservices Patterns (pp. 253-291). Manning Publications
- Book: Sam N.(2015). CHAPTER 4 Integration, Building Microservices (pp. 39-78). O'Reilly Media
- Web Article: The Back-end for Front-end Pattern (BFF) | https://philcalcado.com/2015/09/18/the_back_end_for_front_end_pattern_bff.html
- Web Article: Backends for Frontends pattern | https://docs.microsoft.com/en-us/azure/architecture/patterns/backends-for-frontends
- Web Article: Pattern: Backends For Frontends | https://samnewman.io/patterns/architectural/bff/#
- Web Article: BFF @ SoundCloud | https://www.thoughtworks.com/insights/blog/bff-soundcloud