DEV Community

Discussion on: Where Web UI Libraries are Heading

brokenthorn profile image
Paul-Sebastian Manole

What if there was no state management in the backend, and everything moved to the frontend? Sort of like a backend in the frontend. And the actual backend just streams modules of code, compiled or not, as needed by the frontend as soon as the frontend hits calls into those modules; or it streams preemptively in the background for "adjacent" modules?

And when you need something else besides frontend code, like actual data to display, I guess just go the normal way, like we do it now: hit an API endpoint but use some client-side caching mechanism (possibly with local persistance) like SWR or react-query.

Of course, for low power devices, SSR might still be needed... so maybe a solution would be having a mirrored frontend context in the backend, including all frontend platform features (like those that should be provided by a browser). So like having to delegate everything but the presentation layer (the actual UI rendering), to the backend.

This might have security issues that can't be tackled... I'm not sure, but I can't think of a better way.

Thread Thread
tombyrer profile image
Tom Byrer

You might be interested in CloudFlare Workers to pre-render the content:

Thread Thread
ryansolid profile image
Ryan Carniato Author

Definitely interested in this, serving from the edge seems really interesting.