🕑 Estimated reading time: 4mn
By Maxence Guyonvarho, Fullstack developer @ AT Internet
TypeScript dates back to 2012 and has been created by Microsoft. This technology is mature and production-ready today. NestJS actually predates TypeScript since its first version has been released in 2007.
NestJS is a web application framework supporting Express and Fastify out of the box. Monorepo and micro-service ready and with an active community, new packages enhance the experience regularly by opening new possibilities without increasing the size of the core thanks to an expressive module system!
Most of the ideas that you will find in NestJS are derived from other technologies and especially from Angular. For instance, dependency injection, the CLI and the request lifecycle. The documentation is simply one of the most exhaustive there is, which supercharges developer experience.
The request lifecycle of NestJS is the following:
The NestJS CLI displays its documentation if used without any argument. To create a new project named “project”, you
would use the command
nest new project. To start it immediately,
The core of the framework is very light as it is modular. For instance,
can help manage
.env configurations in your project. Some features such as hot reload are natively provided thanks to
Webpack. From a performance standpoint, NestJS does not add significant overhead to the requests. The overhead is
estimated at 10% of the total request throughput, which is far from what the rest of the request handling should cost.
Pipes and Guards are implemented and function similarly: they can both be placed at the application, controller or route level. Pipes can additionally be added to individual parameters.
Application cache is not a problem for NestJS thanks to its implementation of
This works with in-memory, files, Redis, Memcached and many other options, is simple to integrate thanks to a dedicated
Absolutely! It comes with its own logger but it can be replaced with the more popular Winston.
This framework is a good fit for the following uses:
The user validation can prevent classic cases of CORS, CSRF. It can provide rate-limiting and reject submissions based on validators and it is possible to implement additional modules to further enhance features.
libs and pure validation functions would be compatible. Even though NestJS’s creator is close to Google,
NestJS and Angular are not exactly meant to be used together at the same time. But it is possible to share some parts of
the code and to send messages back and forth.