Why to choose NestJS?

priya s
YavarTechWorks
Published in
3 min readMar 20, 2023

Hi friends, in this blog we will see about why we need NestJS.

NestJS is a simple framework used to build a scalable and efficient NodeJs server-side application with full support for TypeScript. NestJS uses robust HTTP Server frameworks like Fastify or Express.

What is NestJS?

NestJs is an extensible, versatile, progressive framework used to create a demanding and compelling fastes-growing NodeJs framework. It is used to write scalable and loosely coupled applications. It also supports databases like MySQL, MongoDB and PostgreSQL. Nestjs is influenced by React, Angular and Vue.

Folder Structure for Nestjs:

Providers, Controllers and Modules are the building blocks of the NestJS.

app.controller.ts — → It is the basic controller with a single route.

app.module.ts — → The root module of the application.

app.service.ts — → A basic service with a single method.

app.controller.spec.ts — -> the unit tests for the controller.

main.ts — → The entry file of the application which uses the core function NestFactory to create a Nest application instance.

Controllers:

The controllers are responsible for handling incoming requests and returning responses to the client. The routing mechanism controls which controller receives which requests. Controllers are denoted with the @Controller() decorator.

Providers:

Providers are the plain javascript classes that are declared as providers in a module. The logics behind the incoming request will be handled here and returned back to the controller. Providers are denoted with the @Injectable() decorator since it can be injected as a dependency in the application.

Modules:

The module is the class annotated with a @Module() decorator. This provides the metadata that Nest makes use of to organise the application structure.

Significant features of NestJS:

  1. Easy to learn, master and use.

2. Active codebase maintenance and development.

3. Easy unit-testing applications.

4. Open-source MIT license.

5. Powerful command-line interface used to boost productivity for easy development.

Nest JS is a superset of JavaScript with leveraged typescript. It also supports dozens of specific modules that easily integrate with different technologies and concepts like Mongoose, Logging, Caching, Validation, and Type ORM.

Why should you choose Nest JS?

JavaScript is a programming language that is older than 20 years. It is the main framework that helps to create business applications and focuses on shifting towards node JS.

Nest JS is the fast-growing framework for Node JS. The following are the reasons to choose NEST JS:

  • Efficient and quick response in the development process
  • Easy in maintaining applications and highly scalable.
  • Fastest growing framework for the past 3 years
  • Large community and support.
  • Great documentation
  • Easy in unit testing
  • Nest JS provides you to build microservices, and create high testable, easily maintainable applications.
  • The structure of the application in the nest is based on angular. However, the structure is simple and allows us to pay attention to consumers and the design of endpoints instead of focusing on application structure.
  • Nest JS forces the developers in using a specific architecture by introducing controllers’ services, angular-like modules, loosely coupled contrary, and highly testable.

Hope you find it useful! Thank you for reading.

--

--