Backends for Frontends (BFF) Pattern: Architectural Patterns

The Backends for Frontends (BFF) pattern is an architectural pattern that involves creating a separate backend service for each frontend application. This pattern is often used in microservices architectures, where each service is responsible for a specific function.

Following the BFF pattern doesn’t mean you’re creating a new backend, but rather that you’re creating an abstraction, which will be known to your frontend.

The BFF Pattern proposes the creation of a layer that acts as an intermediary between frontends and underlying microservices, aggregating and transforming data to meet the specific requirements of each platform. The BFF pattern is best used in situations where there are multiple front-end applications that have different requirements.

For example, a company might have a mobile app, a web app, and a native desktop app. Each of these applications might have different requirements for data access, caching, and security. In this situation, the BFF pattern can be used to create a separate backend service for each front-end application. This can help to ensure that each frontend application gets the data it needs, in the format it needs, and in a way that is secure.

Traditional(Left) vs BFF Pattern(Right)

Advantages of the BFF Pattern:

  • Better alignment between frontend and backend teams: The BFF pattern can improve alignment between frontend and backend teams by giving each team ownership of a specific service. This can lead to better communication and collaboration between the teams, as well as a better understanding of the needs of each other. In addition, you can have independent releases per frontend and different API versions across different frontends.
  • Improved performance: The BFF pattern can improve performance by caching data and making it available to the front-end application without having to request the back-end service. In addition, the BFF layer can transform the data into the exact format the front end needs to prevent more processing on the front end.
  • Improved scalability: The BFF pattern can improve scalability by allowing each front-end application to connect to its own BFF service. This can reduce the load on the backend services, as well as improve the…
Pratik Pandey -

Senior Engineer with experience in designing and architecting large scale distributed systems.

Recommended from Medium