FullStack Labs

Please Upgrade Your Browser.

Unfortunately, Internet Explorer is an outdated browser and we do not currently support it. To have the best browsing experience, please upgrade to Microsoft Edge, Google Chrome or Safari.
Upgrade

Modular Monolithic vs. Microservices

Written by 
Sergio Agamez
,
Mid-Level Software Engineer
Modular Monolithic vs. Microservices
blog post background
Google AMP vs. Other Frameworks - When to Use Each
How to Create a Simple File-Transfer WebRTC React Web Application
Using Split Flags with React to Control Feature Deployments

When we are building web or software applications, we constantly look for ways to improve our code and use better tools to get the best experience, performance, and many other things, not just on the final client-side but also in the development and deployment process.

Table of contents

Microservice architecture was created in response to challenges faced when building monolithic applications. Microservices aim to be more scalable, flexible, and easier to maintain, however, microservices are not always the best choice - it all depends on your own specific needs.

But wait... what is a monolith app?

A monolith app is the one where the application is a single unit, which means that all the business logic is in one place and if a change is applied to the app, it affects the whole application and needs to be fully deployed again to include the changes working in the production server. Also, this kind of application usually uses only one type of database and one programming language for development.

And what about microservices?

An application built using the microservices architecture is one where the whole application is divided into different pieces of software, each independent of the other, using different programming languages, libraries and frameworks, and even different databases. The changes applied to one of these pieces don't affect the others, making the development process more flexible.

So, we should obviously choose microservices, right?

Well, if you're familiar with monolith applications, there is an alternative that you should know about before considering moving your entire project to a microservices architecture, and it is the modular monolithic architecture, a great way to keep your application as a single unit, but with advantages that before were only found in microservices.

Let's talk about modular monolithic

When we build traditional monolithic software, we divide our logic into different layers to make the development and maintenance of the code much easier:

Traditional monolithic software
Traditional monolithic software

This kind of structure is a good way to build efficient software, but not too flexible because any change in the code will affect the whole unit. Because of this, we can use the modular monolithic architecture, before going on to microservices.

What is modular monolithic architecture?

The modular monolithic architecture consists of dividing our logic first into modules, and each module will be independent and isolated. Then, each module should have its own business logic — and, if necessary, its database or schema. In that way you can build and modify the layers of each module without affecting the others:

Modular monolithic architecture
Modular monolithic architecture

Of course, following this pattern, there should be communication between the modules to work correctly, but this communication must be done through public APIs, allowing access to the logic of each module from the other using public methods, and not using the internal functions and logic of each one.

What are the features of modular monolithic apps vs microservices?

Now, let's compare the features of modular monolithic and microservices architectures to help you know which one could be the best option for your project:

Modular Monolithic:

  • A module is never completely independent. It has dependencies with other modules, but these should be minimal.
  • Modules are interchangeable.
  • Code is reusable.
  • Better organization of the dependencies compared to traditional monolithic apps.
  • Easier to maintain and develop new versions than traditional monolithic apps.
  • You can keep the whole project as a single unit, without needing different servers for deployment.
  • More scalable than traditional monolithic apps.
  • Less complex than microservices architecture.

Microservices:

  • Services are completely independent; each one has its own dependencies and logic.
  • Each service could have a different database (this is optional because they can share the same database, but it's preferred).
  • Each service can use a different programming language and technology.
  • When there is a change in the code, you can deploy only one service without interrupting or affecting the others.
  • CI/CD Cloud-ready.
  • More scalable than modular monolithic apps.

Conclusion

These are just a few features of each one, but I invite you to do more research about the different architectures of software development and use the one that you know is the best option for your specific case. Our Software Architects are ready to discuss your project, contact us or review our playbook to learn more about our technical discovery process.

And, of course, try to master the monolithic and modular monolithic architectures before thinking about refactoring all your code to migrate to a microservices architecture. Neither is perfect for everyone, but one can be perfect for you and your development team.


Sergio Agamez
Written by
Sergio Agamez
Sergio Agamez

My interest in development began when I discovered WordPress, and it continued as I learned new frameworks for creating amazing things for the web and figuring out how to solve ever more complex, real problems with code. I love that every day, I can learn something new. My favorite front-end technology is Vue.js because of how simple and easy to understand it isyou can do something great with it in just five minutes! On the back-end, I most appreciate Laravel. Its organization is amazing, and it's robust enough to create applications no matter how complex or simple. Not to mention, it's one of the best documented languages available. I'm passionate, focused, and disciplined, and when I'm not working I enjoy playing video games and reading.

FullStack Labs Icon

Let's Talk!

We’d love to learn more about your project.
Engagements start at $75,000.

company name
name
email
phone
Type of project
How did you hear about us?
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.