3 ms·
So I spent a lot of time in the Nest ecosystem, and I wrote some nontrivial libraries with a little (not a lot) of uptake (and neither are actively maintained a
by eropple 4y ago
So I spent a lot of time in the Nest ecosystem, and I wrote some nontrivial libraries with a little (not a lot) of uptake (and neither are actively maintained at this point, so these are here mostly for completeness):
https://github.com/eropple/nestjs-auth https://github.com/eropple/nestjs-auth
https://github.com/eropple/nestjs-openapi3 https://github.com/eropple/nestjs-openapi3
I was pretty excited by NestJS when I ran into it because, well--I don't mind magic, when it's done right. I quite like Spring Boot, for example. But NestJS's magic is...incorrect, in a lot of ways. The DI container is a little bit scary, with oddly hardcoded ways to register interceptors into request scope (itself necessary because NestJS's logging facilities aren't--or weren't at the time--decorating requests with X-Request-Id or similar, so you had to register your own) and no way to then define interceptor order.
It also has a lot of really overlapping nouns; guards are interceptors but less capable (and @eropple/nestjs-auth didn't use them at all) and the "pipe" concept for validation was itself inscrutable. To make it usable, I ended up just doing everything with decorators and interceptors, all living in request scope. And once I'd gotten it going, it was pretty nice. But it also meant broad incompatibilities with much of the NestJS ecosystem. It was mostly just my magic, instead.
These days I use Fastify, and, well--some things never change:
https://github.com/eropple/fastify-openapi3 https://github.com/eropple/fastify-openapi3
- dimgl 4y agoI haven't been following the Node ecosystem closely. However Fastify is really interesting. Why choose Fastify over Koa? I've never understood why Koa gets so little love from the Node.js community.
- eropple 4y agoFastify has, IMO, a better Typescript story than any other framework, particularly with Fastify 4. I also prefer Fastify's ergonomics around plugins as scoping to Koa's Connect-derived approach, and I don't really love having a `ctx` object as opposed to req/res (but that one is purely a taste thing). For me, if I wanted what Koa does, Express does 90% of it and I already know it off the top of my head. And I don't really want Express because I'll have to reinvent a lot of wheels or stack a lot of sorta-compatible middleware on top of one another (Fastify's ecosystem is smaller but generally pretty cohesive). Nothing at all wrong with Koa, to be clear--I just don't have a use for it.
- dimgl 4y agoSuper cool. I'm gonna give Fastify a shot next time I'm in Node.js land. Thanks!