What is NestJS? And what is NestJS used for?

Joao RangelJanuary 5, 20236 min read

In this article

In this article, we will answer the main questions about NestJS, starting with the top question:

What is NestJS?

In a nutshell, NestJS is a framework written in TypeScript for servers running Node.js. Like any framework, Nest comes with a set of classes, functions, types, and patterns that help and organize the development of applications. One of the reasons NestJS has gained so much popularity in such a short time is the fact that it was created using the already popular ExpressJS framework and combines it with the design pattern of the Angular front-end framework.

What is NestJS used for?

NestJS is primarily used to create server applications. These applications can be: HTTP API, Web Application, gRPC Microservice, or Web Socket Application. Choosing one of these options or mixing even all of them is the developer's decision; in any case, NestJS facilitates, organizes, and scales any of these application solutions.

Is NestJS better than Express?

Being better or not is always relative, but keep in mind in this equation the fact that NestJS has ExpressJS built-in; from that, in addition to Nest having everything Express has, it also offers many other features and adds more possibilities for use than Express itself. Therefore, the obvious conclusion to this question is yes, NestJS is better than Express.

What is the difference between Next.js and NestJS?

Although the Next framework has the capability to create APIs and Web Applications, its main focus is on Front-End and not Back-End. Next is built using React and has as its main characteristic server-side rendering. This side is the primary and only environment for Nest, which, although its organizational pattern is inspired by Angular (another Front-End framework), is a Back-End framework and not Front-End like Next. However, besides the very similar names, they share other similarities such as the JavaScript language, the need to run Node.js, and strong community popularity.

Are NestJS and Node.js the same?

No. Node is the engine responsible for executing JavaScript on the server; it is also a prerequisite for NestJS and not a competing framework. NestJS, besides using Node.js to function, has a set of pre-written code and a design pattern for creating applications in Node.js.

Is NestJS an OOP?

Yes. Just to clarify, OOP (Object-oriented programming) is a feature of programming languages. JavaScript, in turn, has objects, and some features that have not yet been implemented in EcmaScript are resolved by the superset TypeScript, which is used by NestJS and is therefore also a prerequisite.

Is it worth learning NestJS?

Definitely yes, from our own experience here at Hcode, we use both Node.js and NestJS and save a lot of time in developing new features using the NestJS framework in addition to the new resources it offers us. Therefore, we strongly recommend using it if your Back-End is in Node.js, especially if you plan to scale your application now or in the future.

Is NestJS FullStack?

First, let's understand what FullStack is. FullStack is used to define the entire Stack or areas needed to fully execute an application. For example, imagine we need to create an online store; what will we need? If you determine that you will need a Database, a Back-End Programming Language, and a Front-End, and respectively choose MySQL, Node.js, and React, that is the Stack for this project. If you develop and master these three Stacks, then you are FullStack in this project. Now that we understand the concept of FullStack, the question we need to ask is: Is NestJS the only solution we need to create our entire application? If the answer is yes, then in this project you can say that Nest is FullStack, but the truth is that in most cases, you will need other Stacks like a database and a Front-End that are not part of NestJS, and finally, in this case, the answer is that NestJS is not FullStack.

Are companies using NestJS?

Yes, in addition to Hcode itself using NestJS, on the official Nest website, you can see a list of companies that use NestJS such as Roche, Adidas, Capgemini, Decathlon, Auto Desk, Neo4j, and more. You can check the complete list at this link from the official Nest website. And we can assume that with the ease that NestJS brings, more companies will migrate or create new services using this framework.

Why not use NestJS?

Just as we have countless reasons to use it, there will certainly always be numerous other reasons not to use NestJS; the answers and reasons will vary from project to project, but we can imagine some possibilities as to why someone would not use NestJS, such as not having experienced professionals in the area, not being able to use Node.js on their servers, having a legacy system in another programming language, or even not identifying with TypeScript or the patterns of NestJS. After all, this list could continue with new reasons, but each person will need to weigh the pros and cons before deciding to use or not use NestJS and propose an alternative that matches it.

Is NestJS easy to learn?

Yes! Especially with Hcode, as we have NestJS courses that teach the fundamental concepts in-depth with practical examples that go beyond what is described in the official documentation, which we can also say is well made and has many examples that help those learning about this framework.

Is NestJS better than Laravel?

Again we can say that better is relative to the overall scenario being evaluated. Both frameworks are great and recommended for production use; both also have resources to solve common problems and needs that an application will have. However, they use different programming languages; in the case of Laravel, it uses PHP, and therefore the language may bring or miss specific resources compared to JavaScript. But still, we can highlight that Laravel has been in the market longer, and the web still has a greater use of PHP in the Back-End, probably due to another PHP application called WordPress. This means we still have more professionals specialized in PHP than in NodeJS, but we believe this scenario will continue to change and become more competitive and balanced with the advancement of NestJS and possibly other frameworks and languages that may emerge over time.

Which Hcode course should I start with to learn NestJS?

As mentioned above, you need to have some prerequisites to get the most out of NestJS, such as already knowing Programming Logic, being familiar with JavaScript Language, understanding how it behaves on servers using NodeJS, and also the famous superset TypeScript which gives us access to more resources in this language that are used in NestJS. But if you already have this knowledge, we suggest starting with the NestJS Fundamentals course, which will cover the main concepts of NestJS and explain the terms and project patterns used by the framework while we develop a RESTful API as a practical example. It is also worth noting that both the Nest course and all its prerequisites are available on Hcode Class, our online course platform that you can access with just one subscription.

If you still have other questions about NestJS, please let us know by sending your comments or contacting us.

Keep learning with Hcode

Sign up for the course platform and follow the next blog guides.