In idiomatic Node, the module is the fundamental unit of logic. Any typical application or system consists of generic code and application code. As a best practice, generic shareable code should be held in discrete modules, which can be composed together at the application level with minimal amounts of domain-specific logic.
In this chapter, we'll learn how Node's module system works, how to create modules for various scenarios, and how we can reuse and share our code.