News for hackers. Stuff that matters.
Re:Backend for Front-end by grose on Tuesday September 20, 2022 @11:27PM (#32920527)
BFF is perhaps the purest example of Conway's law. When the backend team cannot or will not make the necessary changes for the frontend team, another layer is introduced: the BFF. There is no particular reason why the real backend can't solve this problem; it is purely political.
Re:Backend for Front-end by makeitdouble on Tuesday September 20, 2022 @11:54PM (#32920674)
BFF can live on a different stack from the heavier backend, and bear a different development cycle.

I've worked in a few orgs where backend devs work on both the standard backend and the BFF, often adjusting both when adding new features. It's just convenient to have a separate layer closer to the frontend, dedicated to it.

Re:Backend for Front-end by warent on Wednesday September 21, 2022 @12:41AM (#32920859)
Indeed we see this even comes for free with some stacks like Next.js, in which you can define an api (BFF) to interface with the primary backend.

On the surface may sound weird but in practice has actually been pretty great when used mindfully.

Re:Backend for Front-end by gherkinnn on Wednesday September 21, 2022 @06:25AM (#32923043)
I wish Next.js talked about this some more and beefed up their API routes.

Writing your BFF in the same codebase, sharing types, and parsing incoming data on the server without filling up the client bundle is a fab experience.

Re:Backend for Front-end by roci89 on Wednesday September 21, 2022 @06:08AM (#32922912)
We use Remix in this way. Making calls to multiple endpoints on link prefetch is fantastic for speed
Re:Backend for Front-end by antifa on Wednesday September 21, 2022 @09:52PM (#32933979)
Nuxt3 will have this feature, they call it "nitro" and it uses the npm library called h3 (as opposed to expressjs) under the hood.
Re:Backend for Front-end by nfrankel on Wednesday September 21, 2022 @01:41AM (#32921189)
Author here. Yes, it's all about Conway's Law. Unfortunately, it's still a law that governs all companies. Fun fact: I stopped working in projects because I mostly had to find technical solutions to organizational issues.

PS: I wouldn't call it "political" (negatively connotated) but "organizational" (statement of fact)

Re:Backend for Front-end by grose on Wednesday September 21, 2022 @02:41AM (#32921525)
'Organizational' is indeed a better way to describe it. Poor choice of words on my part.
Re:Backend for Front-end by nfrankel on Wednesday September 21, 2022 @07:04AM (#32923335)
I know where it comes from, don't worry :-)
Re:Backend for Front-end by bradwood on Wednesday September 21, 2022 @03:10AM (#32921711)
Right. But you could avoid this whole BFF malarkey by having a team that owned and released the BE and FE themselves.
Re:Backend for Front-end by respondo2134 on Wednesday September 21, 2022 @10:04AM (#32925320)
This is the purest end goal though, if you've got a large monolith or you directly consume a shared backend with a large number of teams, how do you get there? BFF is just one attempt to decouple with another layer of abstraction. Eventually you can strangle the problem on the backend.
Re:Backend for Front-end by bradwood on Wednesday September 21, 2022 @01:39PM (#32928529)
CDC on that backend would be one way. You could stream the data out to the various teams who could then materialise a view of it within their application and then craft an API over that view.
Re:Backend for Front-end by jcparkyn on Wednesday September 21, 2022 @05:43AM (#32922707)
How do you do that when you have multiple teams working on separate FEs, which all need to talk to the same BE?
Re:Backend for Front-end by bradwood on Wednesday September 21, 2022 @01:31PM (#32928423)
You exploit Conway's Law by not having separate FE teams. I think this is called the Reverse Conway Manoeuvre if memory serves
Re:Backend for Front-end by mixedCase on Tuesday September 20, 2022 @11:33PM (#32920565)
It's not political that microservices owning well-defined slices of a pie can't cater to the frontend's every whim without creating a dependency spaghetti everywhere that you have cross-cutting concerns. It's just common sense.

If you're arguing that most microservice vs monolith decisions represent a political and not a technical decision, I'll grant you that.

Re:Backend for Front-end by grose on Tuesday September 20, 2022 @11:48PM (#32920646)
I don't think it's necessarily bad. In fact it is quite an elegant solution to issues between frontend and backend teams. I just think it's a great example of Conway's law. Conway's law (IMO) was never a negative thing, merely an observation of the realities of software development.

Your post brings up an interesting angle which is that the frontend and backend people can have different expectations of what the backend should actually do (perhaps leading to dependency spaghetti). In this case, introducing a BFF can be a way to isolate that from the rest of the architecture.

Re:Backend for Front-end by montanalow on Tuesday September 20, 2022 @11:42PM (#32920618)
Those well defined slices of pie you’re referring to are often exactly the political boundaries OP is referring to.

This is the degenerate form of Conways Law.

Re:Backend for Front-end by softveda on Tuesday September 20, 2022 @11:44PM (#32920623)
100%. A backend API can be used from multiple frontends. Just one from my experience working for an electricity provider, API from Desktop webapp, android mobile app, IOS mobile app all retail customer facing. Then from a Sales pipeline for new customers in a CRM app. From B2B customers (Electricians building new homes requesting connections) in a different web app.
Re:Backend for Front-end by btbuildem on Wednesday September 21, 2022 @10:11AM (#32925404)
Isn't the article suggesting that due to a different "front ends" (web app, mobile client, etc) there are different sets of requirements, which a backend should not deal with (for sake of simplicity and separation of concerns)?

The BFF layer seems like a natural next step, basically a code shim to abstract away the peculiarities of each FE platform from the (presumably) "pure" business logic / API platform of the BE.

Re:Backend for Front-end by danielheath on Wednesday September 21, 2022 @07:43AM (#32923639)
Ideally you wouldn't have (or need) microservices! I'd rather deal with a monolithic rails app any day.

However, assuming you've got them, BFF means only one group has to get the following right:

* User authentication

* Web performance analytics

* A/B testing

* More difficult bits of HTTP (fast TLS, prefetch, streaming responses)

If you have microservices but no BFF, you're pretty much stuck with your page being substantially rendered via js. Maybe that's okay for some things? I sure don't like it.

Re:Backend for Front-end by respondo2134 on Wednesday September 21, 2022 @10:06AM (#32925354)
>> I'd rather deal with a monolithic rails app any day.

if your app gets "bigger" this can work OK, but I've found they typically get "wider" and then any work on the monolith gets really painful and slow. My last two gigs have been at opposite ends of the spectrum and it's kind of a "pick your poison" situation.

Re:Backend for Front-end by Karrot_Kream on Wednesday September 21, 2022 @03:39AM (#32921881)
Comparing alternatives, BFFs add reliability that an API Gateway pattern doesn't have. One choice is to shard the API Gateway, but then the distinction between BFF and Gateway becomes more philosophical.
Re:Backend for Front-end by respondo2134 on Wednesday September 21, 2022 @10:00AM (#32925267)
You grossly over-simplify the problem though of when you're trying to consume part of a monolith without contributing to it. BFF can be a valid approach to making a break. We also have 4 back-end teams and a poor release process, so for net-new projects this pattern has given teams a lot of deployment flexibility. It's definitely not cost-free, but I'd argue it's far less political than your inferred recommendation of "change the organizational structure to have a 'real' backend team".
Re:Backend for Front-end by eurasiantiger on Wednesday September 21, 2022 @01:13AM (#32921034)
It is not purely political.

In the case of GraphQL Federation, the ”BFF” does solve the N+1 queries problem, which is an actual problem.

Re:Backend for Front-end by patrickthebold on Wednesday September 21, 2022 @07:01AM (#32923293)
Conway's law is neither good nor bad, it's reality.

Edit: Which I see you agree about.