Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

38 Comments

  1. Great Article,
    What if we have a table that is shared for two or more modules? Or module tables have a relation with other tables in different modules?

    1. Hi, so this is where bounded context would come into picture.
      1. You should either cut your application in such a way that 2 modules don’t depend on each other’s table.
      2. If there are cases, where it is not avoidable, you can still make use of interfaces! Imagine 2 Modules, M1 & M2. If there is a case where M1 needs access to M2’s table, you should add the interface to the SHared.Core project and implement it in the M2.Infra Project! And you make use of the interface at Shared.Core wherever you want in M1

      I hope I cleared your question.
      Regards

    2. I had the same issue. That I did was move my domain entities to Shared.Core. There I can access them from my modules through their respective repositories.
      Hope it works for you too.

  2. What is the point of having `ICatalogDbContext`? It contains DbSet properties hence it’s always dependent on EF Core. So what it the purpose of this abstraction?

    1. I’m not the author but I can add my assumption. Exposing DbContext gives access to the DatabaseFacade which has methods to do Migrations etc. By abstracing the DbContext behind this “leaky” interface you at least limits the usage to the DbSets and calling SaveChanges. But since both live inside the same module nothing stops anyone from using the DbContext directly.

  3. Great Article,
    But there is a downside that we still have to re-initialize the host api if we add a new module.

    1. There is no a downside. It is a monolithic application and will be deployed as a whole. If new module comes in then you should add reference to this module. This is done only one time. Modules are not plugins, they are not plug-n-play.

    2. Even Microservices require re-deployment at times. I am currently working with microservices at the office, and I am well aware of its complexities. Plug and Play Architecture is a whole new risky game. I really find the Modular Architecture much more reasonable for mid-level applications.

  4. Could modules interact with each other?
    for example, ModuleA does some magic and wants to send a notification, and we have a NotificationModule.
    how would they work together?
    through the shared layer?

  5. Great article, Mukesh. Thanks for sharing. At this point, FluentPOS solution is already available and I’m taking the opportunity to see the implementation of a complete solution using the Modular Architecture approach.

  6. I really liked this, thanks for taking the time to write it up.

    A continuation would be great, but I could always dig into the fluentPOS code too.

    I’ll definitely take the time to look through your other articles

  7. Hi
    please advice on how to add logging, redis cache and business logic. Reading through your blog on nlog and redis, but guessing the right project to add these. I would add nlog at core to capture the exception around controllers. But where to add redis and business logic for each module?
    Regards.

    1. You can add logging to the common infrastructure project.
      Business logic stays in each module as I explained.
      Redis also can be put into the common Infra Project as it’s likely to be used by all the other modules as well.
      You can refer to the implementation of fluentPOS for details.

      Regards,
      Mukesh

      1. Hi Mukesh,
        Firstly, accept appreciation from my side for your great work. Secondly, please guide how can one can use React as a frontend.

  8. Absolutely Great Blog Here. This Blog Has Quite In-depth Information Regarding Modularizing Web Applications Using Modular Architecture In ASP.NET Core

  9. Absolutely great blog here. This blog has quite in-depth information regarding modularizing web applications using modular architecture in ASP.NET Core.

  10. Great article Mukesh.
    I just have a doubt related to the fact that in your application the concept of joining between the different entities / tables is lost.
    For example, assume that the application must export all the orders of a customer and for each line report the item description.
    To determine the item description instead of using a simple include mediator uses.
    What do you think about it? Instead of executing an inner join query you execute n queries as there are order lines.

  11. Dear Mukesh, I am following your blogs for the past months (if not year).
    Today we are building a midsize App (for now – soon it will grow) and we are torn between Microservice and monolithic, I’m planning to use your BlazorHero until I read this Modular-Monolithic.
    Removing Microservice from our option, Do you suggest to go with Modular-Monolithic?

    Best Regards,
    fadz

  12. i always avoid to use modular architecture just because of unitofwork, what should i do if i want to perform multiple operations in diffrent modules as 1 transaction, 1 failed than whole request rollback or commit as single transaction.
    for example
    whenever item sale in sale module than update the inventory/stock module, what if sale done successfully and inventory can’t be updated because of some reason ?

    just read whole article because of this thing to find

  13. Hi Mukesh!
    My comments has not diaplayed on the page for pre moderation, or wrong site working?
    And another one thought, Many Thanks for so clean and easy understanding approach and article!

  14. Thanks for the article. Especially love the screenshot of the solution layout.
    Many explanations of clean architecture just discuss it at a high level without implementation detail examples.

    I’m curious what you think about using Orchard Core Framework (not the CMS) to build modular applications. I found your article and orchard framework in my research and wondered if you had experience/opinions about it.

  15. Great Article !
    I cloned and run your project successfull.
    But, Can you tell me how do add extended attribute in dashboard for product ?

    Thanks

  16. Great article. It looks like the fluentpos repo has been removed and replaced with a microservice repo. I found it a much better example compared to the article repo.

    Would it be possible to make the original available again? Perhaps in an archived state.

    Thanks

      1. Hello Mukesh,
        I want clone this Repo because learn how to impalement the relation between the modules like customers and products and sales.
        Please let me clone this fluentpos repo.
        Finally Thanks for this great article.

  17. Great article,
    Can i use your illustrations about monolith architectures if i quote you in my work ?
    Thanks.

  18. Hi Mukesh,

    I was confused between Microservices and Modular Monolith for my new project.
    You artical helped me to choose the right architecture.

    Great Article. Thanks.

    It looks like the fluentpos repo has been removed.

    Would it be possible to make the original (modular monolith) available again? Perhaps in an archived state.

    I want clone fluentpos Repo because I wan to learn how to impalement the relation between the modules like customers and products and sales.
    Please let me clone the original fluentpos repo (modular monolith).

    Finally Thanks for this great article.

  19. Hi, first I want to say thanks for sharing this content.
    I have a question regarding contract sharing. In some cases you might need to share data which for microservices could be http or gRPC calls between some services. In this example you only move controllers to each module and they all live in isolation, but let’s say you have a feature in your API which requires data from Catalog and People. Would you expose a Contract library from each module which contains an Interface and DTO models? In that case it would be easy to swap the implementation for http/gRPC if you later decide to move out the module to it’s own service.