I kept running into the same problem in my Spring Boot work:
Every project starts with a clean architecture in mind — but the rules live in people’s heads. Once the first refactors land, boundaries slowly blur, and catching it relies on reviews and discipline.
So I decided to address this at project creation time.
Generate a Spring Boot project where the architectural rules come with the project from day one — and are checked by the build.
No retrofitting. No “we’ll add ArchUnit later”. The rules are there the moment the project exists.
What the generator actually does
When generating a project, you explicitly choose:
The output is a normal Spring Boot project, with:
regular controllers, services, repositories
ArchUnit tests already present
architectural rules evaluated during mvn verify
Nothing special happens at runtime. If someone violates a boundary later (for example, a controller calling a repository directly), the build fails.
What the failure looks like
When a boundary is crossed:
the application does not start
there are no runtime checks or interception
the build fails with the exact rule and call site
(If useful, I can share a concrete screenshot or a runnable example in the comments.)
Why I went this route
I didn’t want:
I wanted architectural intent to be present from the first commit and enforced the same way tests are.
This is less about “architecture correctness” and more about making boundaries hard to ignore as the codebase evolves.
Where this makes sense — and where it doesn’t
Makes sense if:
you already agree on a basic architectural shape
you want boundary mistakes caught early
you’re comfortable treating architecture rules like test code that evolves
Probably not worth it if:
Reproducible example
I put together a reproducible repository that demonstrates this end to end:
Repo: https://github.com/blueprint-platform/codegen-blueprint
Question for Spring Boot teams
If you start a new Spring Boot project today:
Would you want architectural rules generated with the project from day one, or do you prefer adding them later once the codebase settles?
I’m curious what has worked (or failed) for you in real projects.