What makes Fastify a successful project?
Oren Hacohen
22 de dezembro de 2020
0 minutos de leituraWelcome to our spotlight on Fastify. Today we’re welcoming Ethan Arrowood, an active contributor to the open source Node.js web application server Fastify. We observed that Fastify scores very high on health metrics in the Snyk Advisor fastify package page and we want to drill down into the details of some of them with you.
What is Fastify? What is the package mostly used for?
Fastify is a web framework highly focused on providing the best developer experience with the least overhead and a powerful plugin architecture. Fastify is used by developers all around the globe to build scalable HTTP applications — as server-side-rendered, JSON, or GraphQL APIs. The best way to get started is our getting started guide.
Could you tell us about your role within Fastify in a few sentences?
I started contributing to Fastify after chatting with Matteo Collina at Node.js Interactive 2017. At the time, I wanted to dive head first into learning everything there was to know about Node.js HTTP servers; and even today I’m still learning more! I started by improving test coverage, documentation, and triaging open issues and pull requests. More recently, I’ve focussed primarily on the TypeScript definitions rewrite, improving the developer experience for our TypeScript users across the entire Fastify ecosystem.
We flagged Fastify as an influential project in terms of popularity, gaining over 130,000 downloads a week. What do you think made it a successful project?
Fastify’s success is because of its community. The contributor team is ever-growing and highly active. In addition, by focusing on improving our overall developer experience (for modern JavaScript and TypeScript too), more Node.js developers are reaching for Fastify first when they start a new project.
What are your favorite features of Fastify?
One of the pieces that has always intrigued me is the underlying router: find-my-way. It is based on a radix trie data structure and is really great at what it does. For context, think of it like a physical dictionary. When Fastify is asked to find a certain route it goes character by character until it matches the requested path.
What are the new features in the latest Fastify release?
In Fastify’s latest release, we changed logging serialization, schema substitution, added better TypeScript support, and made it possible to run Express apps inside of Fastify using fastify-express. We also modified some of our route-level hook behaviour, and added some timeout options. If you’re interested check out our migration guide to V3 for a full list.
What are good signals for the health of the Fastify project in your mind?
The activity in our ecosystem. It seems like nearly every week another plugin is being added to our community list. Taking a brief look at our recently closed PRs, it looks like we’ve added fastify-redis-channels, fastify-custom-healthcheck, fastify-envalid, and fastify-get-head in just the last week. Additionally, more and more folks are joining the contributor team and helping us drive new features in all aspects of the project. A great example of this was a request for an OpenTelemetry plugin. A few months later and one of our community members contributed their fastify-opentelemetry plugin and it was added to our list of community ecosystem plugins.
Why do developers choose to use Fastify? Are there other projects that you see developers migrate from?
First-class data validation is one of our most attractive features for developers. In addition to all the other API features that make Fastify unique, our users really appreciate our community. Many folks actively help each other out on our discord and in our help repo.
Many of our users migrate from Express. We’ve made this as effortless as possible through the fastify-express plugin. It adds full Express compatibility to Fastify, enabling users to slowly migrate their Express apps piece by piece.
What is the biggest challenge today, in being an open source project maintainer?
Time. I work full time as a software engineer at Microsoft and only get to devote a slice of my workday to open source. It honestly isn’t enough time to do everything I want to do, so I have to try my best to prioritize and work on things slowly over time. But don’t get me wrong, I love my job and it enables me to work on open source in the first place; at the end of the day it’s all about balance.
What are your top 5 most favorite open source projects?
Node.js, Electron, TypeScript, Undici, and of course Fastify!
Best tip to get started as an open source contributor?
Join the Fastify community on discord, and check out our issue list for opportunities to contribute.