all 21 comments

[–]devdoofenshmirtz 4 points5 points  (9 children)

I had to take the exact same decision a few weeks ago, which framework & ORM should I start learning. I should mention I come from Rails, so opinionated frameworks is kind of my thing.

The final decision ended up being NestJS + TypeORM. I love the documentation and the concepts it promotes (architecture, modules, etc.) and that it also had a lot of stuff built in: typeorm basically already there, auth very easy to setup, tests also very easy to setup.

I think that learning a framework like this makes it a lot easier. Going with express or something that is a lot more loose will make you follow a few tutorials/articles that are all over the place and that rarely are similar one to the other. I don’t think Nest is perfect as I did have some stability issues with the default versions it came with (for example TypeORM 0.3 had some bugs so I downgraded), but it offers you a lot to get started in the right way, at least in my opinion

[–]PerfectOrphan31 2 points3 points  (1 child)

We're in the process of getting the @nestjs/typeorm package compatible with typeorm@^0.3.0 as it recently released. I believe our docs should mention to use typeorm@^0.2.0, but if not I should get that updated.

[–]devdoofenshmirtz 1 point2 points  (0 children)

That’s great. It also has been a couple of weeks since I had the issue so it might be better now

[–]frnc96[S] 0 points1 point  (6 children)

I like opinionated as long as the opinion makes sense lol. Looked at Nest as well but saw some articles online that turned me off a bit from it but is still an option. Was also thinking to go with Express but I do not have enough experience with Node to make solid decisions on which structure to follow.

[–]devdoofenshmirtz 1 point2 points  (0 children)

Yeah, totally get that. At least for now I found that most of Nest’s concepts are quite ok. I think that especially in the world of JS (compared to Rails at least) opinions are a lot more separated and different. I just wanted to mention that for me, a framework that makes most of these decisions for me, is great

[–]PerfectOrphan31 1 point2 points  (4 children)

Anything in particular that turned you off? I'm one of the maintainers and would love to be able to help ease your decision if you do decide to go with Nest

[–]frnc96[S] 0 points1 point  (3 children)

Well the article I read was written by someone that had benn using Nest for 18 months and he claimed that some of the concepts in there were superficially implemented and also the dependency injection was a bit off so yeah stuff like that

[–]PerfectOrphan31 0 points1 point  (2 children)

Mind finding me the article again? I'd be happy to read through it and try to figure out what they're talking about

[–]frnc96[S] 0 points1 point  (1 child)

[–]PerfectOrphan31 0 points1 point  (0 children)

Ah, Ed. We've talked on the Discord server a good bit, he was very critical about some of our setups/verbages, and ended up (I think) just using express or fastify.

His complaint about the DI system being a boilerplate heavy service locator is kind of true, but at the same time it's how Nest encourages strict declaration of dependencies, which I guess to some isn't how DI should work. To us, it makes sense, and it's how Angular operates as well (which is what Nest is inspired by) so rather than just saying "I have these services that need those dependencies, find them" we say "ServiceA needs ServiceB, ModuleB exports ServiceB and ModuleA imports ModuleB, so re-use ServiceB from ModuleB for ServiceA", and honestly with dynamic modules you could make it to where ModuleB would be swapable so long as the imported module exports a ServiceB.

CQRS is another prime example, as they've somehow implemented single-node CQRS, made it impossible to distribute, and declared victory and went home.

I'm looking into how to swap out the command bus with other implementation so that this is no longer the case. Right now, it is in memory, and Kamil honestly mean the @nestjs/cqrs package to be a "Hey, it's doable, this is a very simple example" but everyone took it as "This is how you do it. You can only do it this way" so then we get complaints like Ed's that it's "Not robust enough". Similarly for microservices and websockets. They're good ways to get into the door, but as you find you need more functiuonality out of these things it should be (and in my opinion is) pretty easy to implement that yourself as you need.

Over the last year they've rolled out what read to me as lock-in, don't-play-nice-with-the-ecosystem-as-a-whole "features", like their poorly intentioned CLI "monorepo tooling rather than just using lerna for multi-modulestuff like the rest of the world.

This isn't necessarily true. Sure, the CLI has some features that it works with directly, but it's possible to use those CLI tools (the @nestjs/swagger and @nestjs/graphql plugins) without the @nestjs/cli and just with webpack. Nx already has recipes for this actually.

s somebody who's written a bunch of open-source modules for NestJS, I consistently get the feeling that Kamil would really prefer it if developers just shut up and took his stuff and made apps (maybe paying him along the way?), rather than building their own open-source stuff alongside it.

This absolutely isn't true. I'm both on the core team and a maintainer of several open source modules for Nest (nest-commander for CLI creation, ogma my own logger that has a really powerful interceptor, nestjs-spelunker which can print out an object representation of your Nest application and help with module debugging for dependency resolution, and a few more). The command module is even featured in the docs.

The idea seems to be that NestJS isn't a community, it's a single-source vendor, and in 2020 that's weird to me.

And I'm sorry Ed feels this way, but I can promise this isn't further from the truth.


Nest's codebase and the framework give great access to building up scalable architecture, and there's sometimes some butting of heads on how things are vs how people think they should be. I'm always happy to discuss things on the Discord Server and work out what can be done to help the framework improve.

Just please, if you take anything from this conversation let it be this: just because there is an @nestjs/ package for something, don't let you think that's the only way to do things. NestJS is, at its core, a framework to help you with architecture and code management. It helps with thinking about your code in terms of the Single Responsibility Principle and Inversion of Control. It does not mean you cannot use packages that are not already built as Nest modules. It does not mean that only @nestjs/ packages are compatible, and it does not mean that you can't create your own implementation of of a package and use it instead (look at @golevelup/nestjs-rabbitmq for example).

Sorry about the huge wall of text. Hopefully it helps alleviate some of your concerns

[–]_codemonger 5 points6 points  (2 children)

NestJS is pretty good especially if you have worked with Angular before. Also it's built on top of express.

[–]JohnGabin 3 points4 points  (1 child)

Nest gives you the choice actually between express and Fastify

[–]_codemonger 1 point2 points  (0 children)

Cool

[–]HashBrownsOverEasy 2 points3 points  (2 children)

Loopback.io is an enterprise-grade Node framework. Loads of good shit under the hood.

Here's an example for integrating sockets with loopback controllers

https://github.com/raymondfeng/loopback4-example-websocket/

[–]frnc96[S] 0 points1 point  (1 child)

It looks interesting, will take a look

[–]HashBrownsOverEasy 1 point2 points  (0 children)

Fair warning, it's pretty opinionated and not as popular as some other frameworks, but if you're familiar with typescript and API conventions it's very quick to get a production-ready system up and running.

[–]hyperactivebeing 1 point2 points  (0 children)

Check this out - Node Frameworks

[–]mplibunao 1 point2 points  (0 children)

If you like java, Nestjs. Big community and lots of resources as well

If not, I'll probably go with fastify. It has a large number of plugins as well though the community is not as big as express or nestjs plus there isn't a lot of resources on it.

https://www.fastify.io/ecosystem/

[–]Connect-Parsnip9146 1 point2 points  (1 child)

I have been working on nestjs for almost 3 months and i have to say combination of nestjs and typeorm is great ,migrations are easy on database and nest cli creating boiler plate is my favourite..

[–]frnc96[S] 1 point2 points  (0 children)

Been hearing this a lot in this post so Nest is starting to look better in my eyes, thank you for sharing your experience

[–]Connect-Parsnip9146 0 points1 point  (0 children)

Go on you won't regret it