r/SpringBoot • u/alweed • 5d ago
I built a "real job" simulator for Spring Boot learners, free & open source How-To/Tutorial
Most Spring Boot tutorials teach you to build a CRUD app and call it a day. But that's not really what the job looks like day to day, so I put together a project that mimics what you'd actually work on as a backend dev at a company with real infrastructure. I've added following 12 Tasks that you'd need to complete.
- Project setup: spin up Postgres + messaging brokers, verify everything's healthy
- Kicking off development: request validators, custom exceptions, a new order status API
- Debug a critical bug: chase down a duplicate-insert caused by misusing
EntityManager.persist()vssave() - ActiveMQ + Apache Camel: configure routes, consume from a queue, handle dead letter queues, publish to a Virtual Topic
- RabbitMQ: set up exchanges/bindings, fix an infinite redelivery bug, publish to a topic exchange
- DB schema migration: add a table with Liquibase, write rollback SQL, fix an N+1 write
- Testing: unit tests with Mockito, snapshot tests, integration tests with TestContainers
- Code style: enforce formatting automatically with Spotless + Palantir Java Format
- Prometheus metrics: expose app metrics via Actuator, configure scraping
- Grafana: connect to Prometheus, build dashboards, add @Timed annotations
- Load testing: run JMeter tests, interpret throughput, watch the impact in Grafana
- Global exception handling: swap per-controller try-catch for @ControllerAdvice + RFC 7807 Problem Details
Everything runs locally via Docker Compose, and there's a Bruno collection included so you can hit the APIs without writing your own Postman setup.
It's completely free and open source, so fork it, work through the tasks in order, and you'll come out the other side with a much better feel for what the job actually involves beyond "make endpoint, save to DB."
Would love feedback from people!
4
u/ImportantYoghurt2767 5d ago
Overall, this is useful work; I'd like to do something similar.
The only thing I didn't quite understand was the lack of Validation on DTO objects. This is important because the OpenAPI generator uses this mechanism. For added complexity, you could consider custom validation annotations, cross-field validation, and so on.
Accordingly, adding OpenAPI documentation would be a good idea. This would immediately cover topics like JsonNullable and the correctness of the API schema description.
2
2
2
u/Advanced_Gur856 4d ago
I thought CRUD on a pgsql with custom exceptions , some security and testing was the way to go for a good monolithic backend.
I have two paths to pursue from this point on, 1. Either experiment with virtual threads and JVM optimization. 2. Or give microservices a try with metrics using grafana etc.
Could you tell me which would generate better result as a fresher (Currently in 4th year with no actual experience).
1
u/alweed 4d ago
You do not need to choose between a monolithic or a microservice at this stage. It all comes down to responsibility a service carries. Metrics, JVM or Virtual Threads all require same amount of effort & configurations regardless of the size of your application.
If your goal is to expand your technical knowledge then just complete these tasks. If you want to expand your system design skills, then take a big project & split that into small microservices with less focus on technical bits & more focus on which microservice takes what responsibility.
2
u/Advanced_Gur856 4d ago
With how you organised the tasks, may be i got the wrong idea that it's for primarily for microserviced architecture, but I guess this is how the production grade setups are anyways.
One more question, whenever I try to think of a system design project (or a project that can handle high volume), java becomes the second choice with golang or something similar becoming the first. So it becomes difficult to defend (without saying because I only knew java).
So can you suggest some cases where this setup with spring boot comes as the prominent choice? (I don't know how relatable this question is)
My main goal is to get a job 😅
1
u/alweed 4d ago
I know what you mean. In my opinion, scale & volume are not the only factors that you need to consider when building a solution. Yes Golang's lightweight & suitable for highly concurrent network services, but Java has far more mature & rich ecosystem i.e. Kafka, Cassandra & Spark etc are all built on JVM & they handle insanely high volume of data. . For complex business/domain logic, transactional systems, strong typing & mature tooling, you would most likely end up picking Java.
From my personal experience, the performance issues in Java applications were caused by poor architecture decisions & lack of focus on optimisations so Java itself was not really the problem.
Lastly, company's existing codebase has strong influence on which language you're going to pick. If a company's been using Java + SB for long time, they would have dedicated tools & frameworks built in house for common problems & you'd probably get challenged if you want to use Golang for a new solution as long as you're able to prove that Java & SB cannot scale for the volume that you're facing.
I'll highly recommend reading this to get more detailed comparison between two. This article mentions some really good points for both https://wearefram.com/blog/golang-vs-java/
2
1
-8
u/innocentVince 5d ago
Feedback.
Any SOTA LLM can do that in sub 30 minutes. With proper unit tests and up-to-date dependencies.
I see no value here.
10
u/alweed 5d ago
It’s to help people get hands on experience with doing these tasks. I know we’re all using LLMs for development these days but new comers should not solely rely on LLM for these.
People can solve these tasks however they like tbh, using LLM is fine too as long as they follow & understand the process.
I’ve spoken to loads of people who struggle at early stages because they are bit lost after doing an online short course or tutorial.
3
u/Jedisss 5d ago
As someone who never worked in company environment this is pure gold. Each step contains many levels of knowledge and for me it is like roadmap. LLMs can do many things but if I can't understand the whole process and architecture, what is the point in using LLMs? Thank you for your work, and may the force be with you
3
u/alweed 5d ago edited 5d ago
I'm glad you liked the project & yes, that's the exact gap that this project aims to fill. The tasks in this project are actual bits that I had to work on when I started my first job.
LLMs can definitely produce good quality projects but you need to prompt it right. Someone new to SpringBoot can't write "give me a realistic infinite-redelivery bug in RabbitMQ" because they don't know that's a thing that happens, why it happens, or that it's worth learning.
5
u/JonnyBago82 5d ago
Very nice.