Just needed to write this out. I've been working with some project which was decided to be implemented in NestJS. I have always been wary of using "thick" backend frameworks to implement applications, because I've seen all the problems that arise when a "toy program" becomes a real-life production project using RoR, LoopBack and similar frameworks.

At some point someone convinced me to try NestJS. In theory it is different because it uses several standard libraries and it "just" provides a framework to glue them all.

The problem is that that glue is pretty brittle: As with all frameworks, once you have to deviate a bit from their intended use, you are screwed. Similarly, you will hit a little known bug that is hidden deep inside the framework... and because it is free, nobody will really care if you get blocked (though luck, fix it yourself... if you can/have-time dive into the code). I've got two examples so far:

Using the TypeORM library

We had implemented a good chunk of code in NestJS, and it was working OK. However, at some point we decided to implement the TypeORM library as it is described in NestJS documentation (nothing fancy, just one table using Postgres). While everything works when running the application, the tests are irremediably broken due to this bug:


TypeError: Right-hand side of 'instanceof' is not an object when use absolute path in nestjs

Apparently NestJS + TypeORM do not play well with the Jest framework. The Github issue specifically talks about "using absolute paths", but this happened to us even when not using absolute paths. Of course getting "support" (which is free support because it's free software after all) did not help at all, and in this case, the NestJS team didn't even acknowledge the bug.

Using a RabbitMQ Microservice

The second issue happened when trying to use the "sanctioned" RabbitMQ micro-service configuration. I reported it in the following issue:


Basically, a malformed JSON in a RabbitMQ message is not being caught as an exception where it should. The issue has been open for several months now in the "needs triage" state. Good thing I found a workaround!


Because life must go on, I had to find workarounds for these two issues. Fortunately, workarounds were easy to do, but it seemed that I had to "patch" my code for problems happening in the NestJS framework.

What comes next

I would not use NestJS for any future project, nor I would recommend it for anyone. Sure, the prospect of not having to implement a lot of "boilerplate" code sounds good, but in this case, having to dig into some unknown codebase made me lose time that I could have been using for implementing real work.

It will be better to download one of the many NodeJS hexagonal-architecture boilerplates or MVC or NTier or whatever architecture you prefer, and then using standard libraries like Express, Sequelize, Bunny, etc to connect to services. That way if something doesn't work, you will have complete control.

I still prefer thin frameworks.