r/Fastify

46 archived posts · Jun 2021 – Apr 2025

Random post

u/borja_tur•

Hi folks,

First off I would like to introduce myself here, I'm a senior backend engineer that has been programming in Node.js mostly during last 7 years even though lately much less than I would like to do...

I started in the field using express, then moved to a company where I had the opportunity to work with Hapi.js for 4 years, lovely framework, I learnt a lot about microservices architecture and Node.js in general.

After doing some more stuff here and there for other companies (python, k8s, go, terraform) I started to miss a lot working with Node.js more frequently so I started to invest some of my spare time on learning Fastify, it was love at first sight, after years of Hapi.js I fo

52


u/roteb1t•

Hello, as a developer transitioning between frameworks and libraries, drawing analogies can make learning new tools more intuitive. Recently, while working on a Fastify project, I realized that many Fastify concepts align with familiar React concepts. Obviously these are just concepts analogies, we are still talking about two different worlds, backend and frontend web development.

Here’s a quick breakdown that might resonate with fellow React developers exploring Fastify:

🔵 Fastify Plugin ≈ React Component/Custom Hook

A Fastify plugin encapsulates reusable server logic and can be registered to extend your server’s functionality. Similarly, React components and custom hooks encapsulate reu

30

u/itssimon86•

Hey Fastify community!

I’d like to introduce you to Apitally, a simple REST API monitoring tool I’ve been working on over the past 9 months.

Apitally provides insights into API traffic, errors, response times and payload sizes, for the whole API, each endpoint and individual API consumers. It also monitors API uptime & availability, alerting users when their API is down.

The big monitoring platforms (Datadog etc.) can be a bit overwhelming & expensive, particularly for simpler use cases. So Apitally’s key differentiators are simplicity & affordability, with the goal to make it as easy as possible for users to start monitoring their APIs.

Apitally works by i

30


u/Broad-Quiet2222•

Hi,

Today I'm happy to open source my web-app, I've been working on long time now.

It is still far from being production ready, but anyone can give it a try.

I also need to work on organising modules and clean code, I've been in the mindset of just make it run, so code is probably not the best.

Anyway, this is the repo: https://github.com/bacloud23/classifieds

I hope you like, but anyway, I'm OK with constructive criticism.

Kindly.

30

u/stefcud•

this is a small project based on Fastify, the code wants to be readable, orderly and uses many Fastify features in an understandable way I think it's a good case study:https://github.com/opengeo-tech/GeoPicker

in the server directory a npm package is structured with some Fastify plugins of well defined Routes and a lot of JSONSchema to validate and do other interesting things that Fastify allows:
https://github.com/opengeo-tech/GeoPicker/tree/master/server

this article explains in detail how it was implemented and some benchmarks[https://medium.com/p/bf4c4321c9ec](http

30

u/awpt1mus•

I am coming from OOP framework like Nest.js to fastify. I want to know what is better approach to share dependencies.

For example in OOP, You have controller class injects service classes service classes inject repository classes

In fastify do I create classes and decorate fastify instance with those class instances or Keep the services as pure functions and receive everything via arguments?

I think keeping pure functions for utilities will make testing easier ? What do you guys generally follow. TIA

21

u/totuszerus•

Hello, I'm building a toy app to learn Fastify, and one thing that's unclear to me is when I should place things in a plugin, or just in a module. A good example is the ORM client.

At first I placed my db client in a plugin, because that's what the fastify "getting started" shows with MongoDB, and also what fastify-example does with Elasticsearch. I built the plugin with fastify-plugin so it's available to all other plugins as fastify.db.

But now every time I want to define some function operating on the DB (e.g some patchUser function), it has to be in a plugin, to access fastify.db. Then to use patchUser from a route, I'll need to:

20

In my day job the BE team works with django and at the first time I saw django admin , a gui that can manipulate the database, filters, scripts, etc

There any equivalent of Django admin for nodejs ? And specially fastify & prisma ? I’m familiar with Prisma studio but it’s not that feature rich as Django .. Any thoughts?

20

u/Outside-Disk•

I am using fastify static to serve static files for my site. I also have a endpoint /:slug/:locale which is to serve data for my website template. Some way they both are getting mixed up and the request for my static content is calling the endpoint. Why is this happening? Btw I have registered the routes plugin after the fastifystatic plugin.

20