r/SpringBoot • u/[deleted] • Sep 21 '24
Built a Spring Boot + React project, looking for backend feedback!
Hi everyone,
I’ve built a project using Spring Boot for the backend and React for the frontend. I’ve pushed the project to GitHub and made a video to showcase it.
For authentication, I’ve used JWT and OAuth2 with a stateless session approach.
I'm mainly looking for feedback on the backend—code structure, API design, and any suggestions to improve performance or security.
Video demo: youtube link
GitHub repo: github link
Feel free to check it out if you have time! Any feedback is appreciated.
Thanks!
2
u/niravvarma Sep 22 '24
My 2 cents:
Use Sonarlint plugin in your IDE to fix some of the common known issues or any other static code analysis tool
It is already pointed out but I would like to stress again, that if your core skill is backend technology, the best practice is to write tests - JUnit tests, Integration tests, etc.
According to your README, you have docker but one needs to run or set up the database separately. Either have Docker for all the parts or don't have it - the point is to maintain a consistent approach.
Beware of using Transactional annotation, it is by default read-write and thus, one needs to mark all GET requests as readOnly=true or reverse, mark it readOnly for all controllers and then override in methods wherever read-write is required.
To understand the parts of relational mapping and implementation, I recommend checking the approaches discussed here: https://vladmihalcea.com/ and https://thorben-janssen.com/
You have some words hardcoded in your classes e.g. localhost:3000, better to add them to properties so that they can be changed as needed but from one place.
2
Sep 22 '24
Thank you for taking the time to help me.
I had never heard of SonarLint, but I will definitely try it.
I am writing unit tests now.
I never thought about creating one Dockerfile for all parts, but I will try to make one.
I will definitely check out the link you provided.
Regarding the hardcoded value, I have a property for 'localhost:3000,' and I can access it in other classes, but in this class, it was null no matter how hard I tried. The problem is definitely due to my lack of skills.
2
1
u/Amirr83 Sep 30 '24
How long did this take you to complete? Also, how long have you been coding in Java? I’m relatively new to spring boot, so curious to know how long it roughly takes to get to this level.
2
Sep 30 '24
I did it in one week, but you can do it much faster if you will plan it step by step before starting. Most of the time I spend on implementation of oAuth2 login with frontend.
I started learning java from basics one year ago at that time I did not know anything about java. But I was not studying whole year there was also periods when I did nothing and I also had a job as factory worker. I worked from 9am until 7pm sometimes until 10pm, so I spend about 1 - 2 hours a day for learning. One advice I can give is : learn the basics as quick as possible and then start doing projects , your projects can be simple but it is important to spend more time on real projects. You will understand anything much faster if you will use it.
1
u/Amirr83 Sep 30 '24
Btw did you also learn react along side or did you use chatGPT for the front end?
2
Sep 30 '24
I learned basics of react like how to create component, how to fetch data from api , but then yeah chatgpt helped a lot when I did not know how to do something in react
1
1
11
u/[deleted] Sep 21 '24 edited Apr 17 '26
I bulk delete Reddit comments using Redact which also supports Twitter, Discord, Instagram, and data brokers.
historical subsequent enjoy public tap observation numerous close act boat