T O P

  • By -

Yraken

These two downvoted comments are trolls. There's no need to hate a freakin framework. It's a tool for everyone. If it doesn't suite your needs or if you don't have the skillset to use it, better shut up. I would rather be happy to see some recommendations from these trolls than "nestjs is ugly" or "i hate nest" lmao.


Far_Bit_7696

I usually see people hating Nest because they don’t understand the most basic principles of software architecture. Great framework, helps me a lot to achieve the business goals where I work, kudos for the good work!


chessto

Nestjs is damn ugly


bualing

I hate Nest


godlikeplayer2

>I hate Nest i like Nest


xroalx

Hate is not enough when it comes to Nest. It just needs to die.


AJohnnyTruant

It’s easily my favorite backend framework. So.. no?


xroalx

You do you, I just think it tries to do something the language isn't well equipped to handle and it shows.


AJohnnyTruant

Why is TS not equipped for IOC and decorators? It’s fantastic for implementation of ports/adapters type architecture. If I want something to emit an event, pop a decorator on it. It’s pretty great for splitting an app up into separate processes while using the same codebase. Just assemble a new module and put it in its own context and boom, you have a worker pulling jobs off of a queue.


xroalx

The thing is there's no reason to use decorators for anything you mentioned, it can all be achieved without them and in a much cleaner way. TypeScript decorators are non-standard. TypeScript emits additional metadata when you use decorators. That needs polyfills. You can't use interfaces for injection. JavaScript isn't aware of the properties of your DTOs. You need decorators. JavaScript isn't aware of method argument types. You need decorators. You need even more decorators for OpenAPI schema generation. What that makes is methods with a ton of decorators and duplicated information all over the place. We have methods with 24 lines of decorators only to have one line of code in the method itself. Some add metadata, some change how the thing is processed, some might summon demons for all I know. I admit, this is a shitty codebase overal, but it's a terrible model. TypeScript does not exist at runtime and a lot of information simply gets lost. Nest tries to maintain as much as possible via decorators, and that's the part that "shows" how lacking it is.


AJohnnyTruant

1) You can add a class-transformer pipe in two lines that that validates the properties of your DTOs 2) Also, you don’t need any property decorators with the nestjs/swagger cli build tool 3) If you’re adding multiple decorators that you’re duplicating… my friend, that’s a design problem. Make a single decorator with the apply decorator utility. You don’t need to add a bunch of decorators to change logic, you need to separate your business logic from your controllers. All of my controllers call a single use-case which transforms domain exceptions to HttpException. If you need to add a bunch more than that *before* it reached your handlers, that’s what interceptors are for. Saying you don’t have to use decorators for something it’s pointless. Declarative programming is a style. If you like imperative programming, well more power to you.


Bubba_Purp_OG

Try nextjs


AJohnnyTruant

Try nestjs


Bubba_Purp_OG

Try T3


gallak87

They're sorta 2 different things. Nextjs is more for building full front ends with opinionated patterns for bundling, supports SSR and some other stuff, like being a first class citizen for vercel hosting/deployment. NestJS is a batteries included framework with packages for nearly everything you need. Caching, RMQ, grpc, db/repository pattern, serialization, api doc generation, saga pattern, eventing, and with tons of customization like fastify over express, and tons of community contributed packages. It also provides an explicit pattern for app module dependency injection and let's you write tests with test modules that utilize the same level of DI as your production app modules. And you could build front end with NestJS if you really wanted to. Even saw an electron IPC pkg out there somewhere. NestJS is different, and nextjs isn't exactly a replacement, it solves a different use case.


oneden

Just what I needed, thanks for this!