A module is the primary organizational unit in NestJS. The @Module() decorator provides metadata that NestJS uses to build the application graph and resolve the DI container. Every app needs at least one root module — AppModule. Modules encapsulate a cohesive slice of functionality: controllers, providers, and their import/export relationships.
Modules group related controllers and providers together into a cohesive unit. NestJS reads the @Module() metadata at bootstrap to build the dependency graph and wire up the IoC container. Providers not listed in exports are private to the module and invisible outside it.
imports — other modules whose exported providers this module needs.
controllers — controllers that handle incoming requests for this module.
providers — services, guards, pipes, and other injectables scoped to this module.
exports — providers or re-exported modules made available to any module that imports this one.