0

Currently, I'm designing the Project based on Clean Architecture composing with 4 layers:

  1. Domain
  2. Application
  3. Infrastructure
  4. Presentation

Since the project is pretty huge, I'm now considering to separate the Application Layer into Multiple Module Layers. For e.g. Application.BackOffice, Application.FrontOffice, Application.Commerce.

There might also be multiple Presentation Layers which consume their related Application Module Layers.

For the Domain Layer, there will only be one layer since the project is within the Single Domain Boundary.

For the Infrastructure Layer, it also only one layer that implementing the Interfaces from the above Multiple Application Module Layers mainly related with Persistence and Third-Party Web Services.

There are 2 main reasons of separating Multiple Application Module Layers:

  1. Just separation of concerns and clean code perspective,
  2. Each application module layer might be published as separated service

Conceptually, I think it is valid but I haven't found any resources that mention to separate multiple Application Module Layers.

So, is the above approach the reasonable one and not deviated from the main Clean Architecture concept.

Also would like to know if there are other options that can fulfill the above conceptual requirement.

1
  • BackOffice, FrontOffice and Commerce all sound like the logical separation from your overall business/domain; the idea of clean architecture is not to replace that separation but to offer additional separation wherever it makes sense. Clean architecture certainly does not propose throwing away all of your logical slices or other forms of separation. Any architecture needs to fit the problem otherwise it's useless, so whether you're following "clean" or "onion" or "hexagon" or any other concepts, any natural separation from your business/domain should still be front-and-centre. Mar 7 at 7:47

1 Answer 1

1

I haven't found any resources that mention to separate multiple Application Module Layers.

That's probably because those components are usually not called "layers", just modules or "application modules". Layers (most times) refer to some horizontal slicing of an application system, with some notion of "up" and "down" ordering and dependencies.

Having multiple modules within one layer, with or without dependencies among them, is nothing special in any larger system, quite the opposite. So go ahead, you are dong fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.