Development

Why your next application should be built with NestJS

3 min. read

As a principal consultant, I've worked with many clients across an array of back-end technology stacks. We routinely find programmers who specialize in a single language, like C# or Java, as their "go-to" back-end language of choice.

While there is nothing wrong with having expertise in multiple languages, context switching can be hard on developers. That's one reason we like NestJS as our go-to for production applications. It can help ease the pain when jumping from Angular to back-end API development.

What is NestJS (Nest)

Nest is a Node.js server-side framework that is really an abstraction on top of HTTP server frameworks Express or Fastify that is heavily inspired by Angular.

If you look at server-side Node applications built using Express, you'll see architecture practices and patterns differ quite heavily. One of the main goals of Nest was to create a better framework that instills proper application architecture.

Nest provides an out-of-the-box application architecture which allows developers and teams to create highly testable, scalable, loosely coupled, and easily maintainable applications.

Here's quick run down on why should build your next back-end API using NestJS.

The beauty of Nest

Nest is a fairly newish framework that runs on top of Node and uses Express under the hood, so it relies heavily on the powerful foundation that both pieces of software have created over the years.

The underlying architecture is so similar to Angular, that developers coming from an Angular background should have no problem catching on to Nest concepts.

While the way you write and structure your application will be new, developers don't have to learn new patterns from scratch when it comes to the structure and design of their back-end applications. In fact, modules, services, dependency injection, testing, are all nearly identical.

Developers with an Express background, will still have full access to the underlying Express framework.

Use native Nest packages or bring your own

This is a big selling point. You won't be left out to dry because the framework developers built plugins for your every need.

Nest covers just about every area in terms of native packages and keeps it simple allowing you to use most packages that support Node and/or Express out-of-the-box.

Need to add authentication to your application?

Just add the highly popular Passport library to your application, a small @nest/passport wrapper, and viola!

Anything you might need, they have you covered:
Caching  ✅
Database access  ✅
Task scheduling  ✅
Queues  ✅
Swagger  ✅
WebSockets  ✅
GraphQL  ✅
and the list goes on.

With Nest being built on top of Node, you'll have the entire ecosystem at your disposal. Even the new up-and-coming frameworks, we've found, don't have an established community, so you may be stranded to solve problems on your own.

For the more advanced developers, anything that Nest hasn't built is easily solved by adding a package. In our opinion, this far exceeds anything you get from .NET, Java or, even Python.

Get more from your existing talent pool

There is good reason I keep mentioning Angular while talking about Nest. I really can't express how comforting it is when I introduce Nest to seasoned Angular developers.

Developers with little back-end API design experience are shocked at how easily they pick up and build complex API's using the skills they already learned using Angular.

You no longer have to worry about your Angular developers jumping in to help rescue overdue back-end C# or Java projects.  It's much easier to have your Angular developers do the work with Nest, versus learning another back-end language. That's a powerful way to boost productivity of your team.

Reasons we think you will love Nest

  • Runs on top of Node and uses production tested Express or Fastify under the hood
  • Wide plugin ecosystem, thanks to Node & NPM
  • NestJS CLI makes scaffolding, building, testing and deploying applications a no brainer
  • Using a monorepo strategy you can share DTOs and more
  • Superb documentation & examples
  • Training courses from the team behind it

Conclusion

We see companies of all shapes and sizes that rely on Nest as their go-to back-end choice for production applications. I hope this article helps you think twice before writing off Nest as just another fad in the framework world.

We certainly love Nest and will continue advising our clients to explore it as an option when starting new projects.

If you have questions or need help comparing, for example, NestJS vs C# ASP.NET for API development, we specialize in cloud and custom software solutions. Feel free to reach out to us on Twitter or via email with any questions.

Justin Waldrip

Angular • React • Ionic • NestJS • C# • Azure • Next.js