Member-only story
Nest.js and Modular Architecture: Principles and Best Practices
Discover How to Better Organize Your Modules by Following 8 Architecture Guidelines
I’ve been working with Nest.js for over four years, and during this time, I’ve developed a strong familiarity with the framework. However, organizing projects into readable and maintainable modules was an initial challenge that took me some time to overcome.
Don’t get me wrong. I know even a beginner developer can break down a system into modules, whether based on domains or layers. The problem lies in defining a convention that is easy to follow for a group of seven or more developers, each with their own experiences and opinions.
After facing some frustrating situations, I discovered that a good convention is one that is unambitious, with few abstractions and some tolerable coupling.
This might sound strange and counterproductive, but the volume and speed of delivery required of developers today make it difficult for any “clean architecture” to remain spotless for long.
Believe me, worse than an architecture with some well-understood coupling is an architecture that has become overly complex because its principles were violated.