NodeBB + ReactJS
-
@youhosi Everything is available as an API endpoint already, e.g https://community.nodebb.org/api/topic/14371/nodebb-reactjs and then you have the write api to write to db. So it shouldn't be hard creating a client in React.
Any specifics why you think it would be better to go with react?
-
To give you a little bit of history...
@youhosi -- no, we explicitly made the decision to not use a framework for our frontend because we as developers were trained in an era when client-side frameworks did not exist.
However, in hindsight this decision ended up being quite advantageous for the following reasons:
-
Speed at the expense of convenience
- You will always find that framework-less websites and web apps are much faster than ones using frameworks. My belief is that this is the case because frameworks need to broadly apply to as many use cases as possible, and this necessitates a significant amount of excess code that slows down the application.
- NodeBB prioritises speed. You can see it in our time-to-first-paint and page transition speeds. The fact that we're a heavy (relatively, anyway) javascript app is already enough of a handicap. We have no intention of slowing things down further with additional client-side code to support a framework
- We use BenchpressJS for our front-end templates, which is highly optimized and efficient, against at the expense of more esoteric logic. However, we find this is a good balance of speed vs. convenience. Thanks to @PitaJ and @psychobunny for putting in the legwork to create our templating system!
- We also use jQuery to ease client-side development.
-
There will always be developers who can code in a framework-less style, and we do not see this going away any time soon.
-
Frameworks come and go, but our code will always be more-or-less up to date and supported.
- For example, could you imagine if we wrote our app in Angular 1 (which was all the rage at the time)? We also considered using MooTools instead of jQuery, which is pretty much defunct now. Every time a dependent framework goes, the developers leave for greener pastures (see point 2), and you'll be stuck with a codebase that needs rewriting.
All of the above points are open for debate (and I do encourage it here), but this is our thinking as of this moment
-
-
I am now wondering why frontend like React is even needed. Usually React is well-known to works well with node.js backend and allow us to experience smooth web performance because React doesn't re-render whole page newly like refresh since it only modifies virtual dom. But since Node.js itself seems like being able to modify virtual dom without completely re-rendering whole page like old forum softwares do (xenforo, phpbb and so on). I haven't seen nodebb re-render whole page per each page (url) change request, rather it re-render only the parts needed.
-
@noob111 the main benefit of React is not really performance. The benefit of React and other frameworks is that it separates your UI into individual composable components and allowed you to easily define them in a declarative fashion. Those features of that kind of framework allow for much easier development.
-
@julian this post is the reason I didn't use nodebb when I was evaluating frameworks last year, and I've linked other people to it.
This is a bad design decision with graybeard logic. DX is always the main pain point and driver of third party contributions, not premature optimization.
React, for example, has eaten the world and birthed many alternatives with similar ergonomics, smaller footprints and faster renders. Meanwhile nodebb is using... jQuery and BenchpressJS? Oof.
Lastly, I was also "trained in an era when client-side frameworks did not exist"; it is not a flex to refuse to grow with the times. This is like saying you were raised in a barn so don't know how to shower. These architectural decisions have surely been a deterrent for adoption for many others.
-
Thanks for commenting!
@Henryk said in NodeBB + ReactJS:
React, for example, has eaten the world and birthed many alternatives with similar ergonomics, smaller footprints and faster renders.
I'm going to have to ask for citations there.
Saying react is small footprint or faster than handwritten js and benchpress is ... a laudable claim. I'd love to see it backed up.
-
@Henryk said in NodeBB + ReactJS:
it is not a flex to refuse to grow with the times. This is like saying you were raised in a barn so don't know how to shower.
Never said this was a positive thing. Just stating facts. It provides context as to why I believe what I say, even if erroneously.
All of my justifications could even be the case because they were applied ex post facto
-
@Henryk said in NodeBB + ReactJS:
React, for example, has eaten the world and birthed many alternatives with similar ergonomics, smaller footprints and faster renders. Meanwhile nodebb is using... jQuery and BenchpressJS? Oof.
I mean, NodeBB is slowly moving away from jQuery, but the issue is the plugin ecosystem - removing jQuery would be a very breaking change, much, much bigger than the move from less to scss (since most plugins would still at least work even with their css broken, and most of the time the transition didn't actually require rewriting anything unless one was using more advanced features). I suspect it'll end up moving to something like cash at some point.
And I suspect you're confusing Benchpress with some other templating engine, since (which has both positive and negative aspects) it's basically used only by NodeBB and tailored towards it. It's a tiny and from what I've seen fairly well optimized templating engine - I suspect it'd be faster than react for templates just because it's significantly less complex.
I honestly imagine that if NodeBB was written, or fully rewritten, now it'd be using some framework, likely React/Preact. But the issue is that when you have a long-lived codebase with existing ecosystem the benefits need to be much larger than for the initial choice. Because even with diminishing returns on smaller improvements, the required amount of work makes it hard for a rewrite to beat them, much more so if the changes will require more changes by third party developers too. And you still have to ask yourself if working on DX and performance is worth the opportunity cost, or maybe it's "good enough" and you should focus your efforts elsewhere.
It's annoying, and if I had the time and will to develop forum software from scratch my tech stack would look different than NodeBB, but as with many things it's only easy on the surface and I still prefer the way NodeBB is built to php of Flarum (also - they're an example of an early framework bet that didn't work out ecosystem-wise, since mithril ended with a far smaller community than React and has gone through a few periods when it had years between new releases) or the weirdly dockerized Ruby on Rails w/ ember.js that Discourse uses.
I may not be a big fan of jQuery, but at least even when writing for core I have the choice of just not using it and going with modern JS instead. -
-
@crazycells I have the desire, but I need a lot of time to make it a separate plugin, now everything is strongly tied to the theme. Alas no free time right now
but someday I think I'll do it