Your Blueprint to a NestJS REST API project
NestJS offers us the solo @nestjs/jwt module that allows us to integrate JWT in our project.
The Passport package is a massively used NodeJS library, whose “sole purpose is to authenticate requests, which it does through an extensible set of plugins known as strategies.
Here is a detailed post of how you can implement them in your project.
NestJS Modules are Singletons by default. Their Providers are also singletons when they are provided from within the same module. However, there are cases where we want to use just a single solo class as provider to a couple or more modules. In such cases we can use the solo class as singleton or not. Let’s see how we can do that.
In this post we will try to focus on how to start implementing the class-validator and class-transformer libraries. Both of them are widely used tools for validating REST API Requests’ data and/or transform your API Responses before to send them back to the client.
NestJS provides the necessary documentation for working with different environments (development, production, etc.) using external configuration files and environment variables. So, if you have already taken a look there, then the below provided cases, will give you a hand to start implementing your (relatively simple) project as well.
A circular dependency occurs when two classes depend on each other. For example, class A needs class B, and class B also needs class A. Circular dependencies can arise in Nest between modules and between providers.
Here, you can get a nice grasp on how you can avoid the Circular Dependency in Nest.js.