User Avatar

Manuel Salvatore Martone

1y ago

Senior Software Architect | Tech Lead | Agilist | Senior Engineering Manager

1 Mistake to Avoid in Modular Monoliths with Node.js So You Don’t Fail
Manue Salvatore Martone

Modular Monoliths are overhyped.

That's what I told to myself after having had a look at what's meant for, and reflected on why what was all around for years is actually seen as the light.

Turns out I completely missed the point. At least about how to create effective modular applications in Node.js.

After spending days trying to find the right direction, I can share with you the mistakes to avoid when creating a Modular Monolith in Node.js

The mistake to avoid is not using Fastify for your next Modular Monolith solution

Creating a good Modular Monolith means mainly:

  • Defining clear module boundaries.

  • Isolate capabilities within the boundaries.

  • Properly manage dependencies.

  • Improve the design to favor cohesion over coupling.

Crafting good modular monoliths is even more than this, but the good news is that you don't need to struggle to craft everything yourself to achieve this.

Fastify and Fastify Plugins give you everything out of the box to build all of that.

Defining clear module boundaries

Fastify gives you the possibility to break your application in modules through plugins.

Everything within a plugin can be scoped to its boundary ensuring complete isolation and independence.

Isolate capabilities within the boundaries

Fastify plugins are the fundamental building blocks for defining a domain-specific application module, grouping within them everything necessary for it to be autonomous and independent.

Properly manage dependencies

Thanks to Fastify's plugin system, also dependencies are managed within the same module boundaries.

Improve the design to favor cohesion over coupling

The Fastify plugin system naturally and elegantly promotes a high-cohesion system rather than tightly coupled. Plugins can extend and enrich the application with functionalities through routes, hooks, decorators, etc.

The best thing you can do now? If you want to see all of that in practice look at the The hitchhiker's guide to plugins


The all-in-one writing platform.

Write, publish everywhere, see what works, and become a better writer - all in one place.

Trusted by 80,000+ writers