News for hackers. Stuff that matters.
Re:Don’t Build a General Purpose API to Power Your Own Front... by aatd86 on Sunday August 20, 2023 @07:09AM (#37198025)
Maybe for separation of concerns between data and UI? The browser is not going to be the only client?
Re:Don’t Build a General Purpose API to Power Your Own Front... by philderbeast on Sunday August 20, 2023 @07:21AM (#37198092)
you can have seperation of data and UI and still send the whole page.

The vast majority of the time, the browswer is infact going to be the only client.

once you reach the point where its not, then build the api to suit the new client rather then trying to build one that does both.

Re:Don’t Build a General Purpose API to Power Your Own Front... by aatd86 on Sunday August 20, 2023 @08:02AM (#37198304)
True, you could insert something in the middle, that generates a page depending on the user-agent. But then it requires extra SSR logic.

But on the other hand, you can have a iOS or Android based app that depends on the same data. So the browser is not the only client in general, especially nowadays, I think?

Re:Don’t Build a General Purpose API to Power Your Own Front... by regularfry on Sunday August 20, 2023 @01:48PM (#37201362)
That's the crux of the question. The BFF approach says that you remove logic from the client and put it in a server-side component. Not that you add extra logic. Then you might find that you need to copy that server-side component sideways for a new client, if the view layer in that client is sufficiently different to what you already have. The browser can be the only client of its BFF API; the mobile apps can either speak to the same API or have their own.

Dramatically more important than any theoretical, abstract consideration in deciding whether this can work is what your teams look like. The client team should almost certainly own the BFF API, which has implications for skillsets and maturity.

Re:Don’t Build a General Purpose API to Power Your Own Front... by aatd86 on Sunday August 20, 2023 @02:36PM (#37201797)
That's only for a react type of application if I'm not mistaken?

If so, that doesn't handle the general case (native apps for instance)

Re:Don’t Build a General Purpose API to Power Your Own Front... by regularfry on Monday August 21, 2023 @08:52AM (#37208867)
No, it's for everything.
Re:Don’t Build a General Purpose API to Power Your Own Front... by aatd86 on Saturday August 26, 2023 @08:32PM (#37278239)
Could you explain further? I don't understand.
Re:Don’t Build a General Purpose API to Power Your Own Front... by CharlieDigital on Sunday August 20, 2023 @11:20AM (#37199983)
That's what the database is, isn't it? The separation layer between the raw data and how it's projected into some interface (user or otherwise).
Re:Don’t Build a General Purpose API to Power Your Own Front... by aatd86 on Sunday August 20, 2023 @01:35PM (#37201252)
Yes in a way. There are a bit more layers in-between.

In fact, you can see it as 2 decoupled kinds of database:

- the storage database

- the working in-memory UI database that holds the data represented (e.g. on your screen (GUI)).

The goal in general is to modify the data contained in this UI database and then to push the changes to storage.

Re:Don’t Build a General Purpose API to Power Your Own Front... by nonethewiser on Sunday August 20, 2023 @12:37PM (#37200701)
Well now you’re building a general purpose API
Re:Don’t Build a General Purpose API to Power Your Own Front... by aatd86 on Sunday August 20, 2023 @01:44PM (#37201323)
I think there is a middle-ground concern here: avoiding request waterfalls.