Have you used Instagram?
We are sorry, let us re-phrase
“Do you live under a rock in a cave buried somewhere in Alaska and are so out of touch with Technology that you have not heard of Instagram?”
When Kevin Systrom and Mike Krieger built the prototype of an idea intended to be used as a check-in service, they had no idea that the app would grow fast. Or rather, explode!!
The very first Instagram post was that of a stray dog that the founder, Kevin Systrom, took while in Mexico.
Instagram was launched on 6th October 2010, and the app just had a handful of users in the first couple of days.
The user count then went up to 100,000 users in one week and then hit the first 2 million app count in two months.
This is a classic scheme of “BlitzScaling”. If you have an interesting idea for an app, then the Instagram story should be your benchmark on scaling.
Products of today need to be scaled fast. Real fast.
And Node.JS is known for scaling apps fast.
How does Node.JS do this? By using a non-blocking event loop mechanism that helps servers to process requests seamlessly. Node.JS also leverages Microservices, that breaks your app down into smaller parts.
But wait a minute? Can Node.JS do all of this alone?
Vanilla Node.JS cannot do all of the things that we just said, and that’s why Node.JS is used in tandem with other frameworks such as Nest.JS and Express.JS.
Is NestJS new?
Well, no. It was launched quite a few years ago. Here is a graph showing the trend among developers that search for NestJS.
NestJS is a framework that helps us to build efficient, scalable Node.JS server-side applications.
In this blog post, we take a look at why Nest.JS is the best framework among all its peers, and why you should consider building your web app using Nest.JS.
Let’s dive right in!
Nest provides developers the freedom to use a host of third-party modules, which makes the life of developers that much easier.
So what sets Nest JS apart? In a word — Architecture!
Although other projects such as Angular, Vue, and React help create fast, scalable, and testable front-end applications, none of these projects provides an out-of-the-box application architecture for developers.
Nest.JS solves this problem.
If you are familiar with Angular, then Nest.JS shouldn’t be a problem for you. Decorators, classes, injectable services, all of these figures in Nest.JS as well.
Nest.JS is also a wrapper around fastify, which is an awesome framework in itself.
You have to install Nest.JS as a tool, but it shouldn’t be a problem because all the documentation is given by Nest.JS on its documentation page.
The tool itself has built-in capabilities, like Django, and the Nest CLI tool will make the lives of developers that much easier.
When you run the controller application available on the Nest JS website, it creates a bunch of scaffolding, which looks something like this.
It might look complicated at first, but this is a very declarative style of programming and takes getting used to.
To be clear, Nest JS is supposed to be a backend, server-side language, and it is not supposed to create client-side requests.
Here are three reasons why Next Js is preferred over other NodeJS frameworks.
NestJS is a highly opinionated framework. What this means is that it gives importance to the design paradigm “convention over configuration.” It forces the designers to think and code in a particular way.
Un-opinionated frameworks mean the developers have a lot of freedom, which leads to messy projects with ugly structures. Nest.JS takes that out of the equation.
When you build an application that has hundreds of lines of code, you may have to go back to several service files or component files to check what parameters are available.
If there is no type hinting, you may spend several precious hours looking for a silly type such as a user object being passed instead of a user id. You are really done for if you join a project development at a later stage and are now sifting through screen after screen of code.
NestJS is mostly the only well-structured framework written entirely on TypeScript, making chances of errors due to typos reduced to close to 0%.
Nest uses a Command Line Interface (CLI) to fire up a project and scaffold it quickly. This means generating controllers, modules, middleware, and pipes are as easy for a developer as hitting Alt+Ctrl+Delete.
Performance is another feature of Nest that needs a special mention. To enhance performance, Nest provides a method to change the framework underneath to implement the transition from Express to Fastify.
And last but certainly not least, the Nest CLI package comes bundled with a default testing environment configured with the Jest framework. When we generate a controller, middleware, interceptor, or service, the CLI generates a “spec” file side by side.
This makes unit testing a lot more simple.
Choosing the right technology to solve a particular problem is a daunting exercise, and you often have to factor in intangibles like “Will my development team learn this quickly?” or “Will it include good documentation.”
While NestJS is undoubtedly cool and is one of the hottest frameworks in the market right now, it is best to decide to choose a particular technology only after consulting your entire development team.
That being said, NestJS has over 20k + GitHub stars and is highly recommended to anyone familiar with Angular philosophy and Typescript.