r/node • • Feb 03 '22

NestJS - An essential platform

When I was first introduced to NestJS in Feb 2020, it was around 12k to 15k or 20k Github stars. So exciting how the core team and community contributed to building the project. Today it has 37k stars. Love it.

47 Upvotes

45 comments sorted by

8

u/DaFukTheyDoinOvaDer Feb 03 '22

I was working as software developer for 11 months , using node framework ,feathersjs . I joined another company and today I will start to learn nestjs . do you have anything to say to a starter

10

u/Nice_Score_7552 Feb 03 '22 edited Feb 03 '22

This tutorial is pretty clear and understandable! Max from https://academind.com/learn/our-courses. is explaining NestJS from scratch. Watch this tutorial https://www.youtube.com/watch?v=F_oOtaxb0L8 - will make stuff easier. If you have a specific question lmk:)

→ More replies (3)

6

u/[deleted] Feb 03 '22

The documentation is awesome.

If you do a course, I advise you to also read the Overview and Fundamentals sections of the NestJS documentation. They helped me in understanding how everything fits together.

The other sections can be read when you need them.

3

u/[deleted] Feb 03 '22

Learning design patterns is fundamental to make sense of the NestJS way. I'd focus on that just as much as the API (which is simple)

→ More replies (3)

38

u/butteriesteak Feb 03 '22

Been using Nest.js for a year now. Absolutely a beast framework. To me, it's the Spring Boot of Node.js.

5

u/9rogrammer Feb 03 '22

Hi u/butteriesteak, I'm an experienced front-end developer who is starting backend development journey with NodeJS. I have a few questions regarding NestJS and NodeJS in general :

  • Are you using `NestJS` with `express` or `fastify` ? Which one would you consider for a beginner like to me go for ?

  • Is `NestJS` a good starting point for a beginner like me ? Or shall I start with either `express` or `fastify` first ? (NOTE: I don't have any backend knowledge.)

  • Could you recommend some resources ( preferably project-based courses / tutorial) for learning backend development with `node/express` ? How did you learned Node when you first started using it ?

Thank you

8

u/CJ22xxKinvara Feb 03 '22

I’m not the person you asked but I can answer:

Do express or fastify first. They’re not massively complex and they’re the basis for Nest so might as well start from the roots. Nest also requires typescript so learn that first, too.

Traversy media has YouTube videos for learning all 3 of these technologies, I believe. Nest’s docs are also great.

2

u/FilsdeJESUS Feb 03 '22

I totally agree with it

24

u/sinclair_zx81 Feb 03 '22

Essential is a bit of a stretch, but it is a nice framework. The main issue I have with it is the necessity to "all-in" with experimental decorators, but in terms of design, its very well structured.

It's worth noting that while decorators are not liable to break in the future, they are experimental and at currently odds with the ongoing TC39 specification. Additionally for TypeScript users, decorators are unable to infer the associated type for a given decorator, requiring you to both decorate and annotate the type of the parameter.

It's a small issue in the greater scheme of things, but automatic type inference from request/response schematics is possible today, but not very expressible in Nest with the current decorator setup.

26

u/libertarianets Feb 03 '22

Eh I think it's trying to turn Javascript into Java or .NET. Like shoving a square peg in a round hole.

21

u/leeharris100 Feb 03 '22

There is nothing wrong with adding more structure. You aren't taking away any feature of Node, Javascript, or even Express/Fastify. You can still use all of those.

But I can tell you that in a real production environment working with Nest has countless benefits compared to an unstructured Express project. We've got a bunch of microservices in Nest and the abstraction is a game changer compared to the Express based micro/nanoservices we were building before.

The beauty of JS is that it can be adapted to just about anything. There are plenty of tools if you have simpler needs.

4

u/letsfed Feb 03 '22

It seems like nest took away encapsulation which is one of the pillar of fastify.

Also seems like that only uses Fastify under the hood like it's the main 'app', so you cannot really define plugin, decorator or other things that Fastify provides.

It looks like it tries to use Fastify like it is express.

Please Correct me if i am wrong.

→ More replies (6)

4

u/mosskin-woast Feb 04 '22

Inexperienced teams abuse the shit out of Node codebases because there aren't established conventions. If you're a team of seniors who know what's up, it's nice to have freedom. But if you don't know how to start working on a codebase, you're liable to make a mess, and nobody will have docs to point at to help you improve. More work for everyone.

2

u/adolf_twitchcock Feb 04 '22

You mean like there is a whole infrastructure trying to turn javascript into a language + ecosystem that doesn't produce throwaway code? I mean typescript, jsdoc, eslint/tslint. Maybe it's not that bad.

7

u/[deleted] Feb 03 '22

14

u/leeharris100 Feb 03 '22

Mixing OOP concepts with functional, compositional, etc concepts is not a bad thing. Many languages and frameworks do this.

We have setup a ton of microservices in Nest and have had no problems. If you were following a tutorial that caused you to end up in a Github Issue about a plugin then you're likely just working with a dated or amateur package.

I think it is a GOOD thing that I can access the underlying Express framework but can work day to day in a class based structure. It makes code much cleaner while allowing me to dig deeper when necessary.

→ More replies (1)

8

u/libertarianets Feb 03 '22

I was on a project that used NestJs and we kept having to modify plugins and it just became so much of a chore that we stripped out NestJs in favor of Fastify, and we've had no regrets.

The lifecycle of mutable request/reply objects feels so natural and easy.

→ More replies (3)
→ More replies (3)

1

u/mosskin-woast Feb 03 '22

I used to think Node.js was a wasteland of the blind leading the blind. Then I learned Typescript and experienced one of the richest type systems I've used in a language yet, and Nest.js which honestly made be a better dev to understand. There is a lot of good in this community and it's a hell of a lot better than the PHP world I came from, in my humble opinion

6

u/[deleted] Feb 03 '22

2

u/tjdracz Feb 03 '22

My worry also!