Setting up a proper Spring Boot Clean Architecture is, frankly, a war crime against developer productivity.
Before you can write a single line of business logic, you spend hours creating domain entities, use cases, controller interfaces, DTOs, and mapper configurations across 30+ different files. It's tedious, it's error-prone, and it leads to massive inconsistencies across engineering teams.
Friction is the enemy of velocity. So, I decided to automate it.
Enter ArchiGen
I built ArchiGen: a CLI tool that generates full Spring Boot Clean Architecture projects in less than 5 seconds.
Why Pure Java and PicoCLI?
When building developer tooling, speed and control are everything. I could have used a heavy framework or a scripting language, but I wanted a compiled, robust tool.
I chose pure Java combined with PicoCLI. PicoCLI is incredibly lightweight and allows for the creation of elegant, UNIX-style command-line interfaces with minimal overhead.
How It Works Under the Hood
To generate the boilerplate, ArchiGen doesn't just copy-paste empty text files. It uses FreeMarker, a powerful templating engine.
When you run the command to generate a new microservice, ArchiGen takes your specific domain inputs, feeds them into **FreeMarker **templates, and dynamically builds out the entire layered architecture.
// A conceptual look at how ArchiGen processes templates
Template template = cfg.getTemplate("UseCase.ftl");
Map<String, Object> data = new HashMap<>();
data.put("domainName", userInput.getDomain());
data.put("packageName", userInput.getPackage());
Writer out = new FileWriter(new File(outputPath));
template.process(data, out);
The Impact
The result is instantaneous. What used to take an entire afternoon of scaffolding is now reduced to a single terminal command.
- Velocity: Microservice setup time drops from hours to <5 seconds.
- Standardization: Every microservice generated across a team follows the exact same Clean Architecture folder structure. No more debating where the DTOs go.
Conclusion
Good developers write code. Great developers build tools so they have to write less code. ArchiGen was an exercise in prioritizing Developer Experience (DX) and proving that automation is always worth the upfront investment.
You can check out the CLI and the source code here: [https://github.com/mohamedmabrouk09/archigen]