Show HN: Brisa Framework – Unifying server and client using the Web Platform
brisa.build
brisa.build
By rule, reactivity is broken if you declare a variable using the getter (.value) outside the JSX. This is because the component is called once, and during the rendering of the DOM elements, effect wrappers are added to register the getters (.value) of any signals.
However, to make life easier for developers, we make some optimizations in build time, to:
1. Support early returns.
2. Not having to use .value in the props (well, “WC attributes”) and being able to define default values, do destructuring, etc. without losing reactivity.
Apart from these exceptions, it is as I said at the beginning.
Website: https://brisa.build GitHub: https://brisa.com/github Discord: https://brisa.build/discord X (formally Twitter): https://brisa.build/x
Nice stuff, looks very simple and cool in a lot of ways!
This was a great battle for us too. Let me reply slowly. - Currently web-components support attachInternals which let's you redefine the input validations and any input internal. - On the web-components you can attach a prop starting with the prefix on* which will be an event prop and can trigger an action outside the web-component, you can also connect a server action here. - The form onSubmit works as usual, so you could submit the form using onSumbit and handle it however you like. - We are still looking for new approaches to sending forms using web-components on the easiest posible way :) Brisa does not do any magic on web component form, we are providing the enablers (at least for now, good ideas are welcome).
While dynamic forms are possible to achieve, the easier way of handling a form on Brisa is a native form generated on the server. Join our discord server for more questions (https://discord.com/invite/MsE9RN3FU4).
My main hesitation is RPC event handlers. That's been the trend for a couple years now, for me its always a bit too much magic. I always prefer controlling the API URL being called, both for clarity and to ensure that URLs being called are always stable and more easily testable and reusable.
Why is this good, why not let the client hardware do the client logic?
transform: rotate(2deg);1. Prerender your pages have them static on a CDN and have them interact with your server (Laravel, etc).
2. Use the server actions or API endpoints as a Backend for Frontend to communicate with your other server.
Here's a recording in case it's helpful (Safari, macOS): https://img.notmyhostna.me/Sn347jhnsgVlFwc4PZWs
I understand if it was the early 2010s where mobile devices had limited power but today every user's phone and computer is going to be more than capable of handling whatever Javascript you throw at it.
API key secrecy, SEO, etc
80% of contents are texts, I can't understand why this whole internet become slower. I bet it would be slower even if we get personal quantum computer or whatever that has supercomputing power.
more animation, more effects, more popup, more crap ... that does not improve UX even 0.001%.
EDIT: for more detail even on my M1 Max MacBook Pro, it is still very noticeable how long it takes JS-heavy SPAs to become interactive. Clicking things doesn’t even work for several seconds often because downloading and executing JS takes that long.
Now take into account users around the world on crappy internet connections with slow business laptops or the cheapest Android phones ever trying to load your SPA… bad times.
Even putting device performance aside, doing fetches and computation on people’s browsers somewhere distant in the world on a crappy 3G connection, rather than between colocated servers on speedy networks, is a recipe for bad web performance.
And that’s putting aside the need to protect secrets, optimize SEO (to serialize webpages for robots that won’t run your JS), simplify your application (server rendering eliminates the need for 90% of frontend state management, no need to expose API endpoints just to expose data on pages), the list goes on.
SSR to help with page loading seems like a poor reason. I'm sure there are exceptions, but so many sites make gobs of requests for bazillions of elements (trackers, ads, etc.) anyway. Seems like there is lower hanging fruit we should check out first.
Doing it for SEO just makes me sad - a major architectural change just to try to keep up in the never-ending chase to make Google happy is depressing.
The big upside in moving dynamic rendering to the client for me was that it then made it far easier to have a cleaner separation of duties between a web designer and a developer. You take a graphical designer and have them master HTML/CSS and they can then create the initial design, make it into valid HTML/CSS files, be responsible for things like site responsiveness on different screen sizes, browser quirks, most of accessibility tasks, etc. The developer's job is to "wire it up" - things like populating the data, making the site react to user input, and so forth.
The big win was that this division of labor is not only enabled at the outset, but it is relatively easy to maintain through the entire life of the site. We had tons of sites where there were design refreshes with little (and in a few cases, no) developer work. When I see SSR tools now (as well as client frameworks that chop up the HTML into chunks and then intertwine them with code) my first impulse is to wonder how that gets maintained and updated. Like, when the UI is redesigned and reorganized, does all of that code have to be rewritten? When something doesn't work right on Safari, can the web designer help much or is it all on the shoulders of the dev?
Sad for me is also current state of responsiveness - we had 20 or maybe 200 times slower hardware and website felt faster than now. Maybe it’s how the stars are aligned, but maybe it’s building multiple virtual element trees and discard them every click or event that happens on webpage. I dream about feeling this 20x increase in responsiveness as hardware should allow.
https://github.com/brisa-build/brisa/blob/2e14f765f425c129a6...
However, is possible to change any response header including this one:
https://brisa.build/building-your-application/routing/pages-...
Other than this. We don't like to use cache, because a framework needing cache is a sign of a patch to cover a problem. We are fast by nature, we invite you to try it and you will see that the server takes 4-5ms to render.
However, an important part for the 1.0 routing is to do a lot of optimizations that we already have in mind.
How do you process events to server components?
Is this the same model as web forms / blazor (ss) where every interaction is streamed over a web socket to the sever?
https://github.com/brisa-build/brisa/tree/main/examples/with...
In build-time, each server action is converted to an API entry point.
Also, there are a few typos on your site you might want to fix: https://triplechecker.com/s/Nc9Gu4/brisa.build?v=NUtEc
If there are proposals on how to improve this, we are open to you to write them on GitHub and we will take them into account:
I am an old Polymer fan and so I love to see any developments in that space. The site is nice and worked well for me on mobile.
Brisa to other frameworks (or Vanilla.js): https://aralroca.com/blog/reactive-web-components-with-ssr
React to Brisa: https://brisa.build/building-your-application/components-det...
Is that a typo, or is there a joke I'm missing?