Nest.js is a Node.js framework that uses an architecture-oriented approach to build scalable and loosely coupled applications. It is inspired by Angular and uses modules, dependency injection, and other features to build progressive web apps. Nest.js allows developers to split code into reusable units and easily integrate with databases and other technologies through a clean architecture.
2. Nest.js is a Node.js Framework for building application
- Architecture oriented approach
- Highly testable, scalable, loosely coupled, and easily
maintainable
- Smoothly build progressive app
- The architecture is heavily inspired by Angular
- DI/Devtools/websocket etc
- For the nodejs server layer can be switched to any of
other nodejs server library such as Express and Fastify
https://docs.nestjs.com/
What is Nest.js
4. Modules
- Modules with DI system (Angular inspired)
- Split to Reusable unit
- Imports
- list of imported modules that export the providers
which are required in this module
- Controllers
- the set of controllers defined in this module which
have to be instantiated
- Providers
- instantiated by the Nest injector and that may be
shared at least across this module
- Exports
- the subset of providers that are provided by this
module and should be available in other modules
- This helps us develop with SOLID principal
- https://www.membersedge.co.jp/blog/typescript-solid-si
ngle-responsibility-principle/
5. Provider
- https://docs.nestjs.com/providers
- services, repositories, factories, helpers, and so on
- The main idea of a provider is that it can be injected as a dependency
- objects can create various relationships with each other
- the function of "wiring up" instances of objects can largely be delegated to the Nest runtime system.
6. - Must read
- https://angular.io/guide/dependency-injection
- Essence
- Dependencies are clearly defined and the SOLID principle is easily satisfied.
- Singleton and managed by instances when needed.
- High performance and code readability
Dependency Injection
16. Summary
- A concise and clean implementation can be achieved by following the Nest.js
architecture
- In particular, the combined swagger-based/E2E development style is highly
recommended
- It is very efficient!