BFF VS GRAPHQL

Sdílet
Vložit
  • čas přidán 30. 06. 2024
  • What is the best way to connect your back end to your microservices, One developer is saying we should use BFFs and another GraphQL is all we need. So which route should you go down for your MACH architecture design? Is it really a case of a backend for a front end being better or worse than GraphQL?
    See more of my articles on linkedin
    / jjwilliams
    Most of what I have learned in the MACH / #HeadlessArchitecture world has been while building Amplience headless CMS, DAM and dynamic media services take a look at the Amplience Website and see a MACH platform in action
    amplience.com
    00:00 Introduction to BFF vs GraphQL
    00:48 What is a BFF
    02:10 What is GraphQL
    03:03 Architecture considerations for GraphQL v BFF
    04:21 GraphQL v BFF
    05:41 pros and cons of GraphQL and BFFs
  • Věda a technologie

Komentáře • 17

  • @leonardoporto1584
    @leonardoporto1584 Před 5 měsíci +1

    Congratulations on this video!

  • @cookiechou830
    @cookiechou830 Před 2 lety +3

    Great video John,
    I'm wondering are there any best practice using BFF Architecture or GraphQL in E-Commerce Companies?

  • @mrabetrafik
    @mrabetrafik Před 2 lety +1

    thanks for sharing the insights.
    is my understanding correct, in the context of the video, that having a GQL sitting between the frontend app and the microservices means that the frontend still needs to make multiple microservice calls if data is needed from difference microservices. Whereas in the BFF approach, it's possible to make one call to the BFF, which then gets translated into multiple calls to various microservices

    • @GoingHeadlesswithJohn
      @GoingHeadlesswithJohn  Před 2 lety +2

      Hi Rafik thanks for the question. In a BFF you could create a very custom api for every possible request where the BFF will make all the MS calls and format it exactly the way you wNt.
      GraphQL allows you to make a single or multiple queries at once. Which act as a single request and then makes the relevant MS calls and formats the response in the schema that was defined.
      In this BFF gives you more freedom but you need one for every frontend. Plus the data definition is declared in the code GraphQL with work fir all frontends but you get a more generic response.

    • @mrabetrafik
      @mrabetrafik Před 2 lety

      @@GoingHeadlesswithJohn many thanks John for clarifying!

    • @mrabetrafik
      @mrabetrafik Před 2 lety

      @@GoingHeadlesswithJohn what sort of stack would you use for developing a GraphQL that sits between the frontend and the MS? and similarly for a BFF, which as i understand can also use GraphQL as its interface. trying to understand the practical side of things.
      My experience is developing REST APIs using Ruby on Rails to be consumed by a frontend app, so i'm just trying get examples related to this insightful video.
      thanks

    • @GoingHeadlesswithJohn
      @GoingHeadlesswithJohn  Před 2 lety +1

      @@mrabetrafik Hi Rafik, I would go down a JS/Node route but have you checked out this page graphql.org/code/#javascript.
      I personally would look at Apollo. I would also use NodeJS for a BFF, but that's my preferred language -it might also make sense if you are separating your frontend teams from the backend development. This way your frontend team can take control over the BFF and develop in what they prefer probably NodeJS - and your back end teams can continue to build MS in Ruby. If it's just you then I guess it is down to what you feel is most productive and comfortable with.

  • @lizel3324
    @lizel3324 Před rokem

    Thanks for your videos John, just also wondering if you could do a video about MiniApps (and how it works with GraphQL and/or BFF), thanks

  • @benc9765
    @benc9765 Před 2 lety +1

    I’m not sure this makes sense, GraphQL is basically a BFF in the case you are making here right? This is more a comparison of REST vs GraphQL .. If you choose GraphQL, you still need to build that API, so that in fact becomes a BFF right?

    • @GoingHeadlesswithJohn
      @GoingHeadlesswithJohn  Před 2 lety +1

      GraphQL is a protocol so it's moe about making it easier to talk to Apis as you can make queries and structure your responses with a schema. So one approach is to wrap your microservices with graphql and have a bettet api layer - which eliminates the underfetching a and overreaching, as well as a nice way to construct your data.
      This maybe all you need, but sometimes you may want to have more indepence in your frontend team to customise to data layer. In that case you can opt to build a BFF. As a BFF is specific to that frontend whereas a general API say in graphql is for all frontends.
      As BFFs are an api for you frontend you can use any api protocol including REST and GraphQL.
      What you have is basically a choice of how you want to architect your system. I used BFF v GraphQL as a title as that's what people ask me but the real question should be how should we architect our system.
      Thankyou Ben for the feedback

    • @GoingHeadlesswithJohn
      @GoingHeadlesswithJohn  Před 2 lety +1

      One thing I didn't cover in this video is you can use graphql for building your apis instead of using REST. We are working on that at Amplience as we get a richer API without increasing latency by having an additional layer This works for us really well as our customers have sophisticated cotent schemas and want to slice through the content in many different ways.

    • @abhishekkayal8955
      @abhishekkayal8955 Před rokem

      Ya am having same doubt

  • @bobby_J9
    @bobby_J9 Před 3 měsíci +1

    Thing is your BFF can also use GraphQL as a protocol. apples vs oranges, no?

  • @xelagaming1160
    @xelagaming1160 Před rokem

    Hello John, what is fanout ?

    • @yazanalaboudi1348
      @yazanalaboudi1348 Před 6 měsíci

      fanout is just another way of saying 1 API call to the BFF layer will call numerous APIs on the services layer. He is warning us of that multiplier and to take it under consideration when designing application resiliency

  • @xecor4450
    @xecor4450 Před 8 měsíci

    A place where i worked used bff layer for all microront ends and we used graphql to communicate. i didnt understand why we are comparing graphql vs bff ?