How do you structure your traditional (non-modular) monolith applications?

architecting   modular monolith  

New public workshop: Architecting for fast, sustainable flow - enabling DevOps and Team Topologies thru architecture. Learn more and enroll.

I’ve written a series of posts about modular monoliths. But I recently realized that it’s been a long time since I’ve written anything about traditional monoliths, except to say that their primary organizing principle is technical. For example, a technically layered architecture or hexagonal architecture.

But beyond this, there’s lots of options.

One key question is how to organize the monolith’s codebase into Maven modules or Gradle projects? There are many ways to do this. Here are some options I’ve seen.

Singular Maven or Gradle project

The simplest option is a Maven project consisting of a single module or a Gradle project with no sub-projects. This is what gives you, for example. It’s great for small applications but can become unwieldy as the application grows.

Maven/Gradle multi-module project: one per layer

Another common option is to have a Maven module or Gradle sub-project per layer. I have vague memories of starting the development of a few applications this way:

mkdir application
cd application
mkdir main web domain infrastructure

Each subdirectory is a Maven module or Gradle sub-project.

Maven/Gradle multi-module project: domain + feature modules/projects

There are various other ways to structure a Maven multi-module or Gradle multi-project build. For example, I’ve seen applications with the following structure:

  • persistence or infrastructure module/project
  • domain module/project containing the entities and value objects of a rich domain model
  • Multiple ‘feature’ module/projects, each one containing the service and (HTTP) controller classes for a given slice of functionality

This structure is perhaps the most modular although the domain module can be rather large.

How do you structure your traditional monoliths?

How do you structure your traditional monoliths? I’d love to hear about it in the comments below.

Need help with accelerating software delivery?

I’m available to help your organization improve agility and competitiveness through better software architecture: training workshops, architecture reviews, etc.

Learn more about how I can help

architecting   modular monolith  

Copyright © 2024 Chris Richardson • All rights reserved • Supported by Kong.

About is brought to you by Chris Richardson. Experienced software architect, author of POJOs in Action, the creator of the original, and the author of Microservices patterns.

New workshop: Architecting for fast, sustainable flow

Enabling DevOps and Team Topologies thru architecture

DevOps and Team topologies are vital for delivering the fast flow of changes that modern businesses need.

But they are insufficient. You also need an application architecture that supports fast, sustainable flow.

Learn more and register for my June 2024 online workshops....


I help organizations improve agility and competitiveness through better software architecture.

Learn more about my consulting engagements, and training workshops.

LEARN about microservices

Chris offers numerous other resources for learning the microservice architecture.

Get the book: Microservices Patterns

Read Chris Richardson's book:

Example microservices applications

Want to see an example? Check out Chris Richardson's example applications. See code

Virtual bootcamp: Distributed data patterns in a microservice architecture

My virtual bootcamp, distributed data patterns in a microservice architecture, is now open for enrollment!

It covers the key distributed data management patterns including Saga, API Composition, and CQRS.

It consists of video lectures, code labs, and a weekly ask-me-anything video conference repeated in multiple timezones.

The regular price is $395/person but use coupon GIVLKECM to sign up for $145 (valid until June 19th, 2024). There are deeper discounts for buying multiple seats.

Learn more

Learn how to create a service template and microservice chassis

Take a look at my Manning LiveProject that teaches you how to develop a service template and microservice chassis.

Signup for the newsletter

BUILD microservices

Ready to start using the microservice architecture?

Consulting services

Engage Chris to create a microservices adoption roadmap and help you define your microservice architecture,

The Eventuate platform

Use the platform to tackle distributed data management challenges in your microservices architecture.

Eventuate is Chris's latest startup. It makes it easy to use the Saga pattern to manage transactions and the CQRS pattern to implement queries.

Join the microservices google group