Dissecting the Backend for Frontend (BFF) pattern
Creating a BFF service for each user activity does result in more services, so it is important that they all have a similar feel and structure. This will allow developers to easily work on different services. To help achieve this, it is a good practice to seed a new service with a skeleton from a standard template, stand it up, and then add the specific functionality. Figure 6.1 depicts the resources that make up the typical BFF service.
The first thing to notice is that the typical BFF service provides a Trilateral API:
- It has a synchronous command and query interface that supports its frontend.
- It has an asynchronous listener interface that consumes domain events from upstream services via the event hub.
- It has an asynchronous trigger interface that produces domain events to the event hub for consumption by downstream services.
You can...