r/SpringBoot • • Mar 01 '24

Is thymeleaf or any java web frontend templating engine still relevant in the age of react and and angular?

39 Upvotes

34 comments sorted by

28

u/g00glen00b Mar 01 '24

I don't use it, but I also see the JS ecosystem evolving more towards Server-Side Rendering again. And then there are also libraries like htmx popping up that makes Thymeleaf more interesting.

7

u/ashishpatil312 Mar 01 '24

exactly, like node.js being used for backend application development.

3

u/UnspeakableEvil Mar 01 '24

While there are definite benefits to server-side rendering, in the case of React at least the recent push has quite a smell to it - Vercel make money through hosting, so have a vested interest in making Next.js guide users towards an isomorphic app to boost their revenue streams.

Now, where did I put my tinfoil hat....

33

u/Sheldor5 Mar 01 '24

Yes ...

... for generating emails xD

1

u/kptknuckles Mar 01 '24

9

u/Sheldor5 Mar 01 '24

nice cancer ...

5

u/PsychologicalBus7169 Mar 01 '24

Why: We believe that email is an extremely important medium for people to communicate. However, we need to stop developing emails like 2010, and rethink how email can be done in 2024 and beyond. Email development needs a revamp. A renovation. Modernized for the way we build web apps today.

They don’t even provide a reason to use it on their site.

4

u/Sheldor5 Mar 02 '24

just shove TypeScript and Node.js into your Java backend ... just because ...

11

u/mnbkp Mar 01 '24 edited Mar 01 '24

Server Side Rendering is on the rise again, even in React.

IMO the vast majority of websites don't need the complexity of React. Libraries like HTMX and Alpine.js can cover everything most websites need without all the complexity React adds to the table.

Of course, many web apps do need this kind of complexity, React is the right tool for many websites and React Server Components is an incredible middle ground. I'm just saying you should use the right tool for each case.

18

u/devondragon1 Mar 01 '24

I may be an old stick in the mud, but I usually prefer to use Thymeleaf or HTML and JS. I can't count the number of times I've seen React and Angular apps adding tons of complexity and performance issues, and so many web apps can be done well using simple HTML/JS, etc...

9

u/UnspeakableEvil Mar 01 '24

Add something like HTMX in and you can get a decent amount of "web 2.0” behaviour without needing to deal with a JS framework, which avoids all the overhead having a separate frontend introduces. Add alpine.js and you can close the gap some more - full JS framework will always trump this approach in the niche cases that are heavy on JS state changes, but for most enterprise apps (or the CRUD parts of them at least) SSR is more than good enough, even without HTMX/other sugar.

3

u/Agile_Rain4486 Mar 01 '24

true, for small personal projects, it adds a lot of complexity in security part.

5

u/mauhumor Mar 02 '24

They actually are, it's just that if you go for both web/mobile app, server render doesn't make sense. It's also old tech, won't be on the news, or the next hacker news article.

But the amount of web system that use server render is staggering. Not mainstream software mind you, smaller, industry specific or nich systems, systems that don't fit on a smart phone screen.

From my experience, and this can vary greatly between people. For web systems I strongly prefer server render. It's ridiculously more easy to create and maintain, cheaper and faster to develop, and the performance is not that much different. Instead of building an object and serializing to JSON you are simply building the HTML directly, most of the cost is database anyway. If the JSON can be cached, so can the HTML. You need JS, but not an entire framework, there is no escape of doing ajax calls and adding the returned HTML directly on the DOM to update only parts of the screen. That and specific JS libraries aside (charts, popups, modals, etc) there's is not much else to it.

I actually like react, currently working on a major project that use it, but it does mean developing two entire different systems, two tech stacks, two "builds", two everything.

But I guess it might depends on scale, the 10% extra cost of server render (an honest guess) might translate to high server cost, enough to justify maintaining two teams, can't really say.

But the major factor is not cost but platform, if you need both web and mobile, then you certainly won't be doing server render.

7

u/supadupa200 Mar 01 '24

Thymeleaf + htmx > react/angular

11

u/[deleted] Mar 01 '24

You're going to get a lot of "yes" answers here given the nature of this sub, plus the bias lots of java devs have against anything in the JS ecosystem. But honestly, these templating tools are super niche at best. Thymeleaf, JSP, JSF, etc, unless you're on a legacy project or dealing with very narrow use cases you won't use them

3

u/Tednology Mar 02 '24

Thymeleaf and HTMX is the combination you’re probably looking for!

2

u/dumbPotatoPot Mar 01 '24

I use it just for proof of concepts or for mini personal projects. Haven't really seen it being used in companies

2

u/Horror-Inspection-82 Mar 01 '24

The whole concept is different. One is server-side rendering. The other one is client -side. Both have pros and cons and it depends on your project which one would be more suitable.

2

u/janoschbock Mar 01 '24

I would recommand to look into https://hilla.dev or https://vaadin.com/

2

u/czetsuya Senior Dev Mar 02 '24

Personally, I still use it when developing prototype or MVPs running on Java that need UIs. It's faster and easier as it's already packaged in the same app.

For big projects it's normally decoupled as a separate microservice running on UI frameworks such as React or Angular. This is preferred when you have the luxury of having multiple teams.

1

u/[deleted] Jun 05 '24

I use it to create dynamic PDFs in our app.

1

u/jxr4 Sep 19 '25 edited Sep 19 '25

For things like server status pages and simple stuff server side templating like thymelead is still relevant, but I think your highlighting of react and angular is not the way companies are going either because there's a middle ground with pure JavaScript frameworks like vue which loads almost as fast, doesn't tie companies to a particular backend, you don't need the cost of running a node server or worrying about the 50,000 packages your site depends on, like you do for react and angular and fits the needs of most companies. You can either just serve it from your webserver as static pages or add it to your CDN

1

u/MaheshBabu11 Mar 02 '24 edited Jul 03 '24

I know it's not a persay template engine u can check out Hilla if you are familiar with react or vaadin for front end with java apps

1

u/wansc Mar 03 '24

Is freemarker support AOT.

1

u/CloudDiver16 Mar 01 '24

SPA has still some downsides or challenges for some business cases, like e-commerce, landing pages etc. For MPA template engines are still relevant.

1

u/Then-Boat8912 Mar 01 '24

Not in the job market that I have seen lately. It’s React/next.js, vue or angular. For personal stuff I do use React but only because I figured out how to use it without complexity. It can be very off putting if you’re prop drilling or using reducers.

0

u/Agile_Rain4486 Mar 01 '24

for mini personal project you can use that, I would avoid learning react or angular just to make a small website. having front and back in same project also makes controlling security much easier.

-1

u/WalrusDowntown9611 Mar 02 '24

No it’s not. They are long gone and for good.