We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
Building a modular monolith with Fastify - Matteo Collina, Node Congress 2023
Learn how to build a modular monolith with Fastify, separating concerns and avoiding spaghetti code, while leveraging domains, plugins, and encapsulation to achieve scalable complexity.
- Building a modular monolith with Fastify involves setting up folders for routes, plugins, and inventories to separate concerns and avoid spaghetti code.
- Model-View-Controller (MVC) architecture is not suitable for scaling complexity, leading to carbonara code.
- Domains are the organizational structure of a monolith, where each domain has its own set of plugins, routes, and inventories.
- Encapsulation is the process of hiding implementation details and exposing only necessary interfaces.
- Breaking encapsulation is necessary to communicate between domains.
- Fastify offers a concept called autoload, which automatically sets up routes and plugins.
- Plugins can be used to share code between domains.
- Decorators can be used to share data between plugins.
- The inventory is an object that stores data for a specific domain.
- The Fastify plugin can be used to automatically generate routes.
- Modular monoliths can be easily migrated to microservices.
- MVC architecture is not good enough to handle complexity, leading to spaghetti code.
- Building a modular monolith requires thinking about domains, features, and code organization.
- Not all systems are suitable for microservices.
- Not all domains are suitable for isolation.
- Modular monoliths are often confused with monolithic architecture.
- It’s not about telemetry or production readiness, but about structuring the code.
- Good architecture starts with a clear understanding of the problem domain.
- Fastify is suitable for building web applications.
- Not all plugins can be loaded through the Fastify plugin.
- The best way to handle complexity is to break it down into smaller domains.