Let's settle this once and for all:
. Monolith โ shared codebase, multiple teams, shared resources, one application, internal communication
. Modular Monolith โ shared codebase, multiple/one team, shared/separate resources, multiple applications, internal and external communication
. Microservices โ separate codebase, one team, separate resources, multiple applications, external communication
Glossary
. Application โ a process (instance) running on a server, using some codebase to solve a set of business tasks. An application can have many instances.
. Team โ a group of specialists who communicate regularly and develop the same applications.
. Codebase โ short for "application codebase," meaning the code that describes the specific (unique) process for your application (synonyms โ "business logic," "feature").
. Resources โ infrastructure (DB, caches, fs, transport, etc.) reused between applications.
. Internal Communication โ calling business logic within a single application by invoking a function from within the code.
. External Communication โ calling business logic from another application using some form of transport (TCP, HTTP, MQ, 2IP, stdin, etc.).
Let's substitute values from the glossary
. Monolith โ multiple teams work on features within one codebase; to execute a feature, you can call a function from within the application itself, which might have been written by another team; at the same time, the entire codebase shares the same DB, cache, fs; it all runs as one application (but can be in multiple instances, for example, if cron jobs are separated).
. Modular Monolith โ multiple or one team works on features within one codebase; to execute a feature, you can call a function from within the application or make a request to another application (for example, within the modular monolith); at the same time, you can share the same DB, cache, fs, or not; it all runs within multiple applications.
. Microservice โ one team works on it; to execute a feature, you need to make a request to another microservice; its own DB, cache, fs; it all runs within multiple applications.
Conclusions
. Undoubtedly, there are other variations, but in 90% of cases, parts of a system can be classified this way.
. Your system can simultaneously consist of Microservices, Monoliths, and Modular Monoliths.
. The Modular Monolith is the most flexible option because it allows for the implementation of multiple applications that won't have to use inter-service communication (as you can simply call a function from within the code), and if necessary, you can also use inter-service requests.
(continued below)