First impression with NestJS
Recently, I had a chance to work with Angular and liked the class design in the Angular project (Disclaimed: I worked with React and Vue before Angular). It has a good structure for enterprise applications.
I was wondering if there is something similar for the Node backend framework. And finally, I found NestJS. But NestJS is not Angular for the backend, it has many exciting things for building enterprise backend and provides many cool features. And the last thing, if you love Dependency Injection (DI), you should take a look at NestJS. Let's go deeper!
What is NestJS?
NestJS was built by using good design patterns (DI is one of them) to provide a level of abstraction above these common Node.js frameworks (Express/Fastify), but also exposes their APIs directly to the developer.
For more information about NestJS, you can take a look at their documents.
What do I love?
- It uses Typescript. As you know, Typescript provides strong static type checking for our Javascript application, so we can confidently deliver to production. That is the big advantage of a NodeJS framework.
- The modular pattern is where we can split our application into modules. The benefit of that, we can create shared modules to use across many applications. It's like we play LEGO.
- Nest provides many production-ready features that we can include quickly into our backend. From the docs, you can see some modules such as Authentication, Authorization, Database ORM, Guards, GraphQL, Queue, CORS, CSRF, etc. Many features that you can integrate into just minutes or hours to make it work.
- For each feature, Nest allows us to choose what we love. For example, for Database ORM, we can choose TypeORM, Sequelize, Knex.js, etc, so we can apply what we have experience.
- Nest has a cool CLI (likes Angular) where we can generate different kind of schematic. The best one is CRUD generator, it will generate all resources (module, service, resolver, controller, data transfer object, etc) that we need for an entity.
What I don't like?
Nothing for now because I only spent one month in NestJS but I believe each framework will have their limitations.