What is Nest js and should I use it?

JT Earl
JT Earl
Jan 17 · 4 min read

Overview

I am currently working on a Nest js project for a large enterprise company. Before using Nest I used Java for all of my web services. After experiencing Nest, I feel that it is superior to my old Java ways and want to share my reasons why. By the end of this article, you will have a 10,000-foot view of what Nest js is and if it is right for your next project. Let's get started:

Nest was developed by Kamil Myśliwiec and was designed as a framework to rapidly build server-side applications. Myśliwiec was heavily inspired by Angular and it shows in the structure of a Nest application. The Angular inspiration can be seen with its use of controllers, providers, modules, and pipes. All of these fit into a folder structure that looks similar to how an Angular application would look.

Pro’s of Nest

A beauty of Nest is that it has positioned itself at a unique crossroad of front end and mid-tier development that many languages have struggled to find. For any Java Spring developers Nest will feel great out of the box. The framework is very annotation-driven with everything from endpoints to Swagger documentation being generated from them. A lot of the nasty Node.js and ugly JavaScript has been hidden by these annotations and the results are delightful. The annotations don’t just benefit migrating mid-tier developers though, front-end developers will be surprised at how clean endpoints look compared to Node and the annotations make developing simpler all around.

The folder structure in Nest is heavily based on Angular. This allows for minimal downtime when first designing a Nest service. Components get their own folders, with an application module and main file residing in the root(plus some extra configuration files). This structure is as simple as it sounds and allows more attention to be paid to the design of endpoints and their consumers, instead of application structure.

As the cherry on top, Nest uses the latest and greatest version of TypeScript. The use of TypeScript helps ensure that Nest will remain relevant in the rapidly changing JavaScript landscape and gives developers less context switching. Going from Angular code to Nest is painless. Mid-tier and host developers will still have to deal with context switching but at least TypeScript and its type checking are closer to many mid-tier languages than Vanilla JavaScript.

Similar to Angular, Nest also has a decent command line tool, available through Node Package Manager, nestjs/cli. The command line tool will let you scaffold the project, generate Nest architecture components, and display project information. The documentation for that can be found here.

Con’s of Nest

The largest risk facing Nest users is the lack of documentation. The framework has great integrations with other frameworks but the documentation is minimal and doesn’t cover any issues that may arise. Admittedly the issues tend to be few and far between due to the simplified structure but when an issue does occur finding stack overflow help can be tricky.

Another concern, albeit a minor concern, is the question of longevity. Nest receives a good amount of weekly downloads but there are several other server-side framework competitors out there. Nest does hold an edge in its use of TypeScript and relation to Angular but it doesn’t have the backing power of an IBM or large enterprise behind it. Based on the Nest website it seems that its biggest user is Adidas, although other larger companies, that aren’t listed on its homepage, might be using Nest. This is a minor con but when choosing any framework its something that should be considered.

Conclusion

Currently, Nestjs/core is getting about 74,000 downloads a week on npm. If you’ve read through this article I’d encourage you to go out and download a few of the Nest modules and try them out.

JT Earl

Written by

JT Earl

Programmer Since 17. Currently working in front-end and mid-tier programming for a finance company. Check out my Tech blog @ documentobject.com

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade