r/SpringBoot • • Jun 29 '24

Well Structured Projects

Hello, I am looking for some well-structured Spring Boot projects to learn the best practices of the framework. I would really appreciate any recommendation.

25 Upvotes

25 comments sorted by

View all comments

10

u/DecisionMaterial8078 Jun 29 '24

I may be wrong, but I currently believe a well-structured project must be framework-agnostic.

A well-structured software project is related to knowledge of software architecture. For example, I subscribe to the clean architecture methodology by Robert Martin and it doesn't matter if I am building a project in Spring, .Net, Node.js, Flutter, or whatever framework or language in the Universe, I structure my software according to the tenets of Clean Architecture.

You have to read the book to get the full understanding. There are code examples. The premise of Clean Architecture is that dependency between your software layers must be carefully controlled. Thus, your peripherals (UI, database, controllers, etc) must depend on your business rules (entities and use cases) and not the other way around.

You practice that using interfaces in a technique called dependency inversion and dependency injection. The ideology is similar to the SOLID principles but it's broader in scope.

In practice, I use a variant of clean architecture called Hexagonal architecture also called ports and adapters in almost all my projects. You can send a DM and I will be happy to tell you more.

0

u/tleipzig Jul 02 '24

In my opinion best practices and architecture approach depend on the framework you are working on, with only those tweeks that bring a big benefit over the default approach.

You can create a project on bootify.io and try out the different options for the package structure. But "everything Spring" like Spring Data is basically a good starting point.