Search code examples
web-applicationsarchitecturemicroservicesmodularitymonolithic

Dealing with monolithic application as the project scope grows


I have been working on an monolithic ERP web app/tool which has grown more than I initially expected, I didn't thought about microservices at the time and now it's becoming harder to outsource work with other developers without sharing the entire code base (which they would need to go over) and most importantly dividing resources between different services and users.

Starting the app from scratch again using micro-service architecture is not an option now since it would take a really long time to re-implement everything. Is there any other solution to this?


Solution

  • This is not only related to Microservices but business aspect as well.

    Your current situation

    • Large codebase
    • Monolith application

    Long term goal

    • Neal code more granular from business domain perspective.
    • Outsource only required functionality and not entire code base.

    Microservice is good solution for your desired scenario at the same time it is hard now as product already developed.

    You can evaluate following things.

    1. Even if it is monolith, do you have separate domain level module or it is layered structured ?
    • If it is layered and not separated as domain then it is bit hard.
    1. Let's consider you have domain level module.
    • Try to find out contract by which other module communicate with that module but by abstraction and not like directly referencing that module.
    • By this way you separate module in monolith itself and later you can convert it into service.

    Definitely it is time consuming process and step by step you have to do it. Many organization are transforming this way only even there product is 10-20 years of development.

    Update 1:

    1. How would each module be connected to each other, do we need a wrapper module/app to connect all modules together?
    • Monolith ( specially non-modular) has issue with coupling. All modules are not depends on abstraction so it is kind of tighly couple.

    • First identify contract for each module that other module can use.

    public interface IModule1Contracts
    {
           // Method expose by that module to another module.
    }
    

    Same needs to repeat for each module.

    At first point when IModule1Contracts implements concreate type. It is still call module1 directly by creating object but by this way you have separate contract.

    • Next step would be separate module1 as service.
    • Now that contract implement again but this time via network call like gRPC or Http.
    1. Also does the database stays the same or do I need to also separate it?
    • You can do process like separate all databases for all domain. You can do that if you have timeframe to do that.

    • Instead in above point when I mention that you can separate module as a service. At that point you can think of separating db for that module1.

    This is architectural concern and also it very project to project. I am not aware of any tool that do this process. Mostly this is manual process but once do for one or two module process will become visible in context of your project.