r/SpringBoot • u/Financial_Mark1663 • Oct 01 '24
Which frontend to use for SpringBoot?
I recently learned backend in SpringBoot and have very little knowledge of the front end, only HTML, CSS, and Javascript(Beginner).
Please let me know which technology I should use for the frontend. What are the frontend technologies used by the industry where they have a backend in SpringBoot?
6
u/LouGarret76 Oct 01 '24
You can use vanilla html/ css/js with the fetch api. You can use thymeleaf (very easy) You could use VueJS, You could use JavaFX
4
u/YelinkMcWawa Oct 01 '24
Second for Thymeleaf. It probably accomplishes everything someone would want to do with Angular, React, etc., and requires no embedding. It'll probably get you to focus on the basics of creating a web app and will test your understanding of HTML and CSS basics.
2
21
17
u/mnbkp Oct 01 '24
The most common approach by far is to simply use SpringBoot to build a rest API and then build a separate React or Angular app that consumes this API.
If you want a more fullstack approach, you can use Hilla to handle the integration between React and SpringBoot for you.
Another approach would be to use a regular template engine (thymeleaf, pebble, freemarker, etc...) combined with Alpine.js and HTMX. This approach is extremely less common but can be much easier if you're not familiar with React/Angular.
1
u/Cr4zyPi3t Oct 02 '24
+1 for Hilla. Currently switching one of my FOSS projects to Hilla, it really combines the strength of a Spring Boot Backend with a React front end while having few drawbacks. Watch out for the next version with Full-Stack Signals, I think that this will be the next big thing.
6
u/TheBaconFate Oct 01 '24 edited Oct 01 '24
I’m building an application that uses Astro + react, I’d say go with react since it’s the most popular, I think. However, in the end go with whatever goes best for your use case or what you want to learn.
EDIT: Spelling and grammar
5
4
2
u/Ok_Trainer3277 Oct 01 '24
I would go with vanilla JS so that you can learn how everything works before you get into frameworks. If you really need one I think SvelteKit is the simplest one to start with, react is the most in-demand and angular is most in-demand for enterprise apps.
2
2
u/Humperino Oct 01 '24
Another alternative would be Vaadin. With Vaadin you can choose the full java route with Flow or use react with Hilla. Both are tightly integrated with SpringBoot.
2
2
u/Luis149174 Oct 02 '24
Anything but spaghetti language frameworks, personally I have always used thymeleaf
2
u/niravvarma Oct 02 '24
Depends on your use case.
Is the UI complex? If yes, then have to use ReactJS or Angular or similar
If you want very basic UI with some backend calls to perform CRUD operations, use the template engine like JTE or ThymeLeaf. I would suggest to start with JTE because it has good performance + easier to integrate for a beginner frontend developer.
2
u/wimdeblauwe Oct 02 '24
If you are a beginner, then go with Thymeleaf. I have some articles on my website about it: https://www.wimdeblauwe.com/tags/thymeleaf/
I also have this getting started video: https://youtu.be/fRQQu9mpwBE?si=Lnk_WpBlysPuOLcO
Finally, to quickly generate a project with live reload, you can use my ttcli tool: https://github.com/wimdeblauwe/ttcli
3
u/Holothuroid Oct 01 '24
Do you want to render server side? Then thymeleaf is fine.
Otherwise whatever.
2
u/hmiguel204 Oct 01 '24
Any you want, but start with react since it is the first class citizen right now
1
Oct 01 '24
[removed] — view removed comment
1
u/verocoder Oct 01 '24
Btw I’d start with a pen and paper version of your front end and work up from there
1
1
u/Yxig Oct 02 '24
As a related question, which template engine do you guys prefer? I've been using Thymeleaf, but I'm not a big fan. I think the syntax lends itself to mistakes (I've mistakenly forgotten to prefix with th: more than once), and prefer other systems syntax. I thought the ability to render the templates without processing ("natural templates") as examples would be beneficial, but in practice I never use it.
I might be hanged for this, but looking across the isle to the react folks, jsx just looks so good.
-3
u/TheOldMancunian Oct 01 '24
We use node.js, vue, vuetify, and vuex.
5
u/Fun-Shelter-4636 Oct 01 '24
you can use node.js as a frontend? i did not know this
1
u/TheOldMancunian Oct 01 '24
Yes. Design your front end in node.js using any framework you like. I use vue, because it is powerful and has a low entry point. We use vuex to manage state at the front end. We then have a bunch of rest calls using axiom to link it to a spring boot backend, we manage security with jwt tokens.
That was then, now we have replaced all the rest calls with a graphql interface. But that is beyond this conversation. But it is better in so many ways, but the learning curve is steeper.
1
u/Fun-Shelter-4636 Oct 01 '24
what do you mean design node.js with any framework you like? nodejs is a framework? how can you use that and vue on the frontend?
i can’t find any examples of this stack online
can you link me to one?
32
u/xsreality Oct 01 '24
I prefer HTMX with Thymeleaf. Anything to avoid seeing the node_modules folder.