Notes

Backend for Frontend (BFF)
Backend for Frontend with Microservices
Advantages of Backend for Frontend
Disadvantages of Backend for Frontend
When to introduce Backend For Frontend

09:37
Different types of clients may require different types of responses
10:07
BFF is a separate (proxy) backend, that talks to either monolythic backend or a microservice, that talks to your database
11:12
You don’t apply any logic. It is a presentation layer. It will filter our what is not required and will take care of a presentation layer (no business logic)
12:18
Each BFF is like a API Gateway for each type of client
13:17
BFF cares about

  • what it needs to fetch
  • how it needs to fetch
  • what it needs to send in a response
    There’s no business logic

BFF in Microservices
14:33
It works very well with microservices where BFF is just an API Gateway that picks and downstreams services to fetch data
Backend for Frontend Pattern in Microservices - 15:09 15:09

16:29
Advantages

  • Support for multiple isolated interfaces
  • Client specific tweaks are much faster
  • Hide sensitive information
  • You can pick right protocols and stacks for a client
    • If XML is needed, you can change it on BFF
  • Improved security that can be applied for specific platform
  • Backend can be generic and BFF can customise however you want/need
  • BFF acts as aggregator
    21:29
    Disactanves
  • BFF service have to do a large fanout to other services. Because of that, BFF has to be designed to be network heavy and stack should support it.
  • Code duplication - code across BFFs would be very similar because they interact with similar services.
  • Adding a new BFF layer, we have another moving part that needs to be managed
  • Small latency increase
    24:40
    When to introduce BFF
  • When interfaces are different across different clients
  • When communication format of clients is different
    • one requires JSON, the other XML
    • For example, you want to integrate some banking API, but that banking API has a legacy API and uses XML, while you are using gRPC or REST. For that reason, you can have XML BFF that transforms that XML into REST and the other way round.