improving end-user experience on User Interfaces by implementing the Backend for Frontend pattern
Gary Woodfine
10 June 2023
The backend for frontend (BFF) is a software architecture pattern relevant for microservices & domain-driven design to simplify the communication between the frontend and backend. The pattern was first introduced by Phil Calcado and colleagues at SoundCloud in 2011, and has also been discussed further by Sam Newman in his book Building Microservices and Chris Richardson in his book Microservices Patterns.
The BFF pattern has also been referred to as the API Gateway pattern, but this is not strictly correct. The API Gateway pattern is a more general pattern that can be used to aggregate multiple backend services into a single API. The BFF pattern is a specific type of API Gateway that is used to aggregate multiple backend services into a single API for a specific frontend application or client.
The BFF pattern has been widely adopted by companies such as Netflix, Spotify, SoundCloud, Zalando, Amazon, Uber, and Twitter, and is often regarded as a key pattern for implementing microservices.
The BFF pattern is a software architecture pattern that is used to simplify the communication between the frontend and backend. The (BFF) pattern refers to having one backend per user experience, instead of having only one general-purpose API backend. This is because the traditional approach to accommodating more than one type of UI is to provide a single, server-side API, and add more functionality as required over time to support new types of mobile interaction.
The BFF is typically tightly coupled to a specific frontend application or client, and will typically be implemented by a dedicated team that are responsible for both backend and frontend development, therefor making it easier to implement, maintain, define and adapt the API contract between the frontend and backend.
We have briefly discussed the Backends for Frontends pattern in relation to the API Template Pack and it is a fairly common pattern that is used in within the Enterprise API space.
threenine.co.uk can help you with your API Development. We have experience in building APIs for a range of clients, from small startups to large multi-national enterprises. We can help you with your API Development, whether you need a new API or need to improve an existing one.
Let's consider a simple example of a BFF pattern in action.
A Backend for Frontend (BFF) is a type of API gateway that is used to aggregate multiple backend services into a single API for a specific frontend applications or clients. For instance, a BFF can be used to aggregate multiple backend microservices into a single API for web and mobile applications.
A single BFF can be focused and targeted towards single User Interface (UI). As a result, it will help keep the codebase for the frontends simple and enabling a unified view of data through the BFF.
In the above example, we have a simple BFF that is used to aggregate data from two backend services. The BFF is used to aggregate data from the two backend services and provide a single API for the frontend application to consume.
Back-end software engineer
Experienced software developer, specialising in API Development, API Design API Strategy and Web Application Development. Helping companies thrive in the API economy by offering a range of consultancy services, training and mentoring.