← Return to myShelf

Getting Started with Fastify

I’m gonna tell you a story that started kinda rough, but ended up pretty well. It was almost a year ago (April 2025), right when Batista Lando invited me into web development. I was trying to build my first API, my basic CRUD with Express...


Then a more senior friend hit me with: “have you tried Fastify? Beny, check out this video.” Me, innocent but lucky, decided to give it a shot. And man… it was like when Goku learns instant transmission: out of nowhere, it became one of my biggest strengths.


Fastify is an HTTP framework that was born in the async/await era. My current stack is Fastify + PostgreSQL + React/NextJS. But getting there was a whole learning journey. Express is great to start with, there are tutorials for everything, and the community is huge. But over time (even early on), I realized I was spending more time debugging middleware than actually writing code. CORS middleware, JSON parsing, logging, authentication — all done manually, and one wrong order could break everything.


What really won me over with Fastify was the JSON Schema validation. Like, you define how the data should look, and the framework just blocks it at the door if it’s wrong. No more writing a million if statements to check if email exists, if password is there, if field X came through. It saved me hours of my life — and I’m just a junior, I don’t have that many productive hours per day.


Performance? I’m not crazy enough to run benchmarks all day, but I did notice a real difference. An endpoint that took around 150ms in Express dropped to about 50ms in Fastify. Could it be bias? Maybe. But in the real world, that kind of thing matters.


Another thing I loved was the plugin system. Everything is a plugin. Want logging? Plugin. Validation? Plugin. Rate limiting? Plugin. 61 plugins. And you register everything in a clean, logical order — none of that app.use chaos that feels like black magic. Even my junior self managed to keep things organized.


Look, I’ve got nothing against Express.js, honestly. And yeah, Fastify still loses to some “new gen” HTTP frameworks. Personally, I’d say it loses to Hapi.

Anyway, if you’re just starting out, give Fastify a shot. That’s it — if you enjoyed the read, don’t miss the next article, because WE definitely won’t.

Tags deste artigo

Leituras Sugeridas