Modular Monolith Startup Template

Modular Application Development

Modular monolith approach is ideal for applications with complex business domains. It allows building independent, well-defined modules within a single application, so each module can be developed and maintained separately while still working seamlessly together.

Layered Solution Structure

Who is For?

In the following conditions, you may consider to build a modular software solution:

If your domain is too complex to develop and maintain in a single monolith codebase.

If your business domain has clear functional boundaries and is possible to split into sub-domains.

If you have multiple teams that will work on the solution.

When you need to reduce complexity early on. And if you are considering migrating your application to a microservice system.

Modular Monolith Application Development Tutorial

ABP provides a great infrastructure and tooling to build modular software solutions. In the tutorial, you will learn how to create application modules, compose and communicate them to build a monolith modular web application.

Document Link

How to Build a Modular Monolith Application?

modular monolith  application consists of a single host application and multiple sub-modules. Typically, each module has its own .NET solution that contains the code related to that module. So, the general structure is shown in the following figure:

In this example, MyCrm.Host is an almost-empty host application that has package references to other modules. Every module consists of two packages: implementation and contract packages.

You can follow the steps below to create such a modular solution with ABP Studio:

  • 1
    Create a new application  using either  single-layer  or  layered application startup template. That application will be the host application of your solution.
  • 2 Create new modules (right-click to the solution root, select the Add -> New Module -> ... command).
  • 3 Import & Install these modules to the host application.

Which Startup Template should be used for a Modular Application?

So, both single-layer and layered  startup templates are inherently modular. Just use one of them and start your modular solution. You may wonder which one to start:

  • Use the single-layer startup template  for the host application of your modular monolith if you will leave the host application as empty. It will contain some configuration code of course, but it won't contain any actual application code. This is the suggested approach.
  • Use the layered application startup template if you will write some application code into the hosting application. You may want to write some code that makes multiple module operations that are not easy to implement in a particular module. In that case, a layered hosting application will be a better way to organize your codebase. However, this approach can quickly move your solution away from a modular system.