Why to choose Nestjs
September 03, 2021
Table of Contents
What is Nestjs
Nestjs is a framework for building efficient, scalable Nodejs server-side applications. It uses modern JavaScript, is built with TypeScript (preserves compatibility with pure JavaScript) and combines elements of OOP (Object Oriented Programming), FP (Functional Programming), and FRP (Functional Reactive Programming).
Under the hood, Nest makes use of Express, but also, provides compatibility with a wide range of other libraries, like e.g. Fastify, allowing for easy use of the myriad third-party plugins which are available.
It uses robust HTTP Server frameworks like Express or Fastify. Nest provides a level of abstraction above the common Node.js frameworks and exposes their APIs to the developer. This gives a great amount of freedom to use third-party modules.
It is the fastest growing nodejs typescript framework for building server side interprise application. It was develope by Kamil Mysliwiec and the first version was released in 2017 highly inspired by Angular.
Why nestjs
To be able to talk about the nestjs magics you always need to bring in Nodejs because Nestjs adds a layour abover the usual Express or Fastify application. In nodejs ecosystem Nodejs includes nothing by default there is no assumption. If would like to know why I'm talking about Nestjs and why It's the first Nodejs framework highly used today, I found you minimal points in very many others.
Developer is tasked project setup for every thing needed to be used, architecture set up which may result into the potential problems as the application grows or the team grows very large, the application is hard to maintain and lack of consistance in the codebase
Nestjs provides those setup such as setting up TypeScript, api routing, middleware setup, error handling, E2E tests and Unite tests etc
Nestjs provides developer teams with out of the box architecture to create scalable, loosly-coupled, testable and maintainable interprise applications.
Nestjs being amaizing it doesn't block a developer from using the basic Nodejs but it adds a layer above Nodejs, by default it uses express but upon that you can also use fastfy or other
A quick and efficient development process, architecture consistance, TypeScript and Robust CLI accelerates the development process
Highly scalable and easy to maintain applications.
It's Opensource and Fastest growing Nodejs framework for the past 3 years with Large and active community, you can join the community discord server. For any blocker or issue you post and get replied soon from community members
Nestjs has positioned itself at a unique crossroad of front end and mid-tier development that many languages have struggled to find.
The use of TypeScript helps ensure that Nest will remain relevant in the rapidly changing JavaScript landscape and gives developers less context switching.
Support for dozens of nest-specific modules that help you easily integrate with common technologies and concepts like TypeORM, Mongoose, GraphQL, Logging, Validation, Caching, WebSockets and much more
The passport feature that allows easy intergration of thirdy part authentication strategies e.g: Auth0, Github Auth, Facebook Auth, OAuth2 etc
It leverages TypeScript — strongly typed language which is a superset of JavaScript
Great documentation for guidance
Easy E2E and Unite tests, Nestjs powerfull CLI generates
.spec
file forcontroller
,service
,gateway
and etc with boiler plate code to build the feature Unite tests, you can also override them or intergrate other third party testing libraries.Built for large scale and maintainable enterprise applications, Nestjs is breaking the record of Java known of building large scale interprise applications, with Nestjs you can build them and keep the Java desplines such as OOP and Dependency Injection
Like it was mentioned above in introductions, Nestjs provides an out of the box application architecture that allows developers and teams to create highly testable, scalable, loosely coupled and easily maintainable applications.
Nestjs forces developers to use a specific architecture by introducing Angular -like modules, services, and controllers, ensuring the application is scalable, highly testable, and loosely coupled contrary to other Nodejs frameworks like Express, Fastify or Koa where a mistake early on in the project regarding the architecture may cost a lot in terms of time spent refactoring the codebase later.
The structure of the application in Nestjs is heavily based on Angular. The structure is very simple and allows more attention to be paid to the design of endpoints and their consumers, instead of the application structure.
Powerful Command Line Interface (CLI) to boost productivity and ease of development
Nestjs swagger for Restful API documation easy the work of documenting apis
Nestjs is easy to learn and muster.
What you can build with Nestjs
Nestjs provides dependincies to build a production ready application of the following
- RESTFUL API applications
- MOCROSERVICE applications
- MONOLITHIS applications
- WEB SOCKETS applications
- GRAPHQL applications
- CLI applications
- MVC applications
- Clone Jobs applications
Companies using Nestjs
Knowing that serveral companies have shifted their interprise applications to Nestjs this confirms what said above
References
- nestjs-official-doc
- https://medium.com/selleo/why-choose-nest-js-as-your-backend-framework-c2a69c2154ae
- nestjs-officail-repository
- https://hachinet.com/blogs/what-is-nestjs
- https://selleo.com/blog/why-choose-nest-js-as-your-backend-framework
- https://jtearl188.medium.com/what-is-nest-js-and-should-i-use-it-b71c7646926b