Nestjs. Is it worth it?

Nestjs. Is it worth it?

TLDR:

Pros

  • The folder structure in Nest is heavily based on Angular
  • If you're a fan of strongly typed languages you will appreciate its built with Typescript
  • It's fast
  • Annotation-driven

Cons

  • Debugging is sometimes pain. ( Mostly because of TypeORM )
  • Deployment causes some downtime so you need to account for that
  • Lack of documentation. Finding stack overflow help can be tricky

If you've worked with Angular even for a little bit you will find a folder structure very familiar. You can split your projects features into modules and keep them separate that way. Also you get everything what comes with modules. Import/export problems too!

Nest is built with Typescript. I love how it sort of reminds me of swift.

Nest is very fast. You would be surprised by performance if you're coming from something like PHP or Python.

Nest heavily uses Typescript decorator annocations. Controllers, routes, modules, data transfer objects, params, query params and even swagger documentation is annotation based.

While working nest one of main cons is the debugging. It integrates with other frameworks (express/fastify) and npm packages (class-validator, TypeORM). Thats all nice and I respect that maintainers and contributors to the Nest do their best to leverage whats available and avoiding reinventing the wheel. Though sometimes there is an error and you get either nothing in the console or empty object `{}`. Good news is that it doesn't happen too often.

Because node is a server it needs to parse and load javascript into memory before it can execute it, so on file change ( deployment ) you must restart it to changes appear.  If you have a mission critical application in mind maybe you should consider a loadbalancer or use a docker. Cloud based solutions such as Google cloud App engine also can be an option!

Nest's documentation isn't the worst, but it can there is a room for improvement and I hope it will get better. You probably will have a question while working and might have a to dig a little deeper in stackoverflow to find answer or advice to point in the right direction.

All in all I love how NestJs is growing. Since end of 2018 ( ~20k weekly downloads )  till 2019 June ( ~65k weekly downloads) it has grown by more 300% according to npmjs.com. I plan to use it where I have a chance, because I really enjoy working with it. Definitely I see it growing more in popularity and surpassing other backend javascript frameworks such as AdonisJs or SailsJs.  So give it a spin and try it out for yourself. There is a little bit of learning curve, but I'm sure it's nothing too much.

Cheers!

Karolis

Show Comments