Meet NestJS: the Fastest-Growing NodeJS Framework
The newly introduced NestJS framework has shaken the NodeJS community since it has become quite a breakthrough in the world of frameworks. Being extremely scalable and efficient, NestJS has already won the hearts of developers worldwide, got more than 23k stars on GitHub, and is praised by Roche and Adidas. We asked our developer Nikita to quickly explain why everyone (including him) is going crazy about NestJS and what makes it so special.
NestJS in a nutshell
NestJS is an open-source, versatile, extensible NodeJS framework that can be used to create the backend part of software applications. The main thing to remember about NestS is that it allows creating scalable and loosely coupled applications - that means, you can easily split the app into microservices if needed. NestJS was inspired by Angular, Vue, and React and encompasses certain elements from OOP, functional programming, and FRP (functional reactive programming) concepts.
NestJS consists of three main building blocks:
- Modules: help organize the code and split features into reusable components.
- Providers: are responsible for abstracting complexity and logic.
- Controllers: are used for handling incoming requests and returning responses to the client-side.
What else do you need to know about NestJS before we jump to its most distinctive features? It supports PostgreSQL, MongoDB, and MySQL databases (the crème de la crème in the world of databases), it is highly extendible, and it’s pretty much similar to Angular because it was inspired by it. Now, we can discuss what makes NestJS so good and why more and more developers choose it over other frameworks.
The distinctive features of NestJS
While we can endlessly praise NestJS, we respect your time so below are the biggest NestJS features to pay attention to.
Suitable for monolithic and microservices architectures
Because NestJS allows creating loosely coupled applications, that means such an app can be easily split into microservices. Hence, depending on your goal and project requirements, you can either go with a monolithic architecture or opt for microservices.
Optimization of TypeScript
NestJS has a great command-line interface known as Nest CLI. This tool helps initialize, develop, and maintain the apps and assists in app building and bundling. In general, a good CLI grants you better control over the app and contributes to faster development and Nest CLI is definitely a good one.
Support for different modules
NestJS supports many nest-specific modules that help better integrate your app with the most popular technologies. Among the modules supported by NestJS are Mongoose, GraphQL, TypeORM, Logging, WebSockets, Caching.
Built-in exception filters
There is a built-in exceptions filter in NestJS that handles those exceptions that were not caught by the app’s code. Thai filter then sends a corresponding response to the request and can generate responses even for unrecognized exceptions.
Other great features of NestJS are:
- Easy unit-testing;
- A high level of flexibility and ease of use;
- Highly scalable;
- A very fast-growing community;
- Great documentation;
- Versatile in terms of its use cases (suitable for MVPs, GraphQL apps, Web Sockets).
I think one of the best things about NestJS is its architecture. It’s built in such a way that it kinda guides you towards the best decision and recommends using all development patterns.
Nikita, Software Engineer at SoftTeco
NestJS is a really good and solid alternative to other frameworks out there. While it was mostly designed for large-scale enterprise applications, we believe it can be used for smaller projects as well. Did you already try NestJS or are still thinking about it? Share your opinion in the comments - we’d really love to know it.
SoftTecoView all articles by this author.