Hacker News new | past | comments | ask | show | jobs | submit login

I used to do more node work, and that was mostly pre v4. Express was the go-to.

There’s more options out there now. I did a bit of research a few years back, and my go-to now is Fastify.

https://fastify.dev/




Fastify is absolutely fantastic. It has the concept of "type providers", allowing you to pair it with fastify-type-provider-json-schema-to-ts (for JSON schemas) or another typing system of choice, such as Zod, to obtain strongly typed queries, request bodies, and responses in handlers with TS types derived on the fly at compile time. It also validates data returned from handlers to conform to schemas, reducing the likelihood of accidentally leaking sensitive information. And it's faster than Express, even with validation.


Could you share a bit more of your reasoning for choosing Fastify over Express and how was your experience since you switched?

Express is my go-to but I'm always open to improving my ways.


Fastify has a nice modular architecture, decent popularity, growth trending upwards (so more future proof), first-class support of async and typescript (it's not cobbled on like it is with express).

Conversion was mostly easy because most web frameworks are pretty similar. It's less an issue of an individual frameworks features and more how popular it is. For example, a lot of people use passport for auth, so using a popular solution is more likely to have a well-supported plugin for passport, which makes conversion trivial.

On a practical note, I did have some minor roadbumps with the typical PITA issues like dealing with file-streams and multipart.


We like fastify for structure, types, perf, and maintainer responsiveness. I can count how many bugs we have had.

The backwards incompatibility is frustrating as most of the major changes could have been done in non-breaking ways. That makes it harder to recommend for people who do software for work - it is par for the course of the economic waste that is the JS framework upgrade treadmill, which may seem normal, but isn't.

I'd still generally recommend something like Django (!) or, if you need to go thin, fastAPI, as more complete, stable, & open governance than many node frameworks. Frustrating as V8 is an amazing engine.


Is Express.js still even maintained? Does it still adds new features?

Also switched to Fastify. It has a great ecosystem and community. It's also easy to write custom plugins.


Why does it need to add new features?

I've tried building production apps on top of server frameworks that are constantly innovating, and it's a massive PITA. You can't not update because there are security fixes that you need, but the API surface is constantly changing to support the new great thing.

I think it's a good sign that the most popular server framework for JavaScript has finally stabilized and isn't innovating any more. We might finally be at the point where we can just build an app without constantly chasing the new.


> I've tried building production apps on top of server frameworks that are constantly innovating, and it's a massive PITA

Oh hi there Sveltekit


Why should it get new features?


Nice. First time I hear about fastify.

I use Go for all backend. But sometimes I have dabbled in node using express.

Maybe if I ever have a need to do something with node I’ll try with this.

Cheers




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: