BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Fastify 3.0 Improves Performance, Logging, Schema, and TypeScript Support

Fastify 3.0 Improves Performance, Logging, Schema, and TypeScript Support

This item in japanese

Fastify is an open-source, low-performance overhead Node.js web framework. Fastify version 3 introduces support for running Express applications inside Fastify, adds improvements to logging serialization and schema substitution, and provides better TypeScript definition support.

Fastify remains focused on lightweight performance. According to Fastify's most recent performance metrics, Fastify serves more requests per second than other Node.js frameworks, including Koa, Restify, hapi, Express, and the built-in http.Server. The 3.0 release more than doubles Fastify's requests per second compared to early 2.x versions.

Fastify version 3 improves its type system to support generic constraining and defaulting and more efficient definitions for schema types.

The fastify-express package provides full Express compatibility inside Fastify to ease the transition from Express to Fastify over time.

Validation and serialization receive a significant upgrade in Fastify 3. The setSchemaCompiler and setSchemaResolver options get replaced with the setValidatorCompiler enabling future tooling improvements. Further changes to preParsing and other hooks improve performance and consistency and leverage more of Fastify's internal APIs such as Fastify requests. Similarly, the Fastify logging serializers now use Fastify Request and Reply objects instead of native objects. Existing Fastify users should review the Fastify 3.0 migration guide for a complete list of updates.

Fastify now includes 136 official plugins ranging from features like Next.js server-side rendering, WebSockets, Webpack, and much more. Immediate support for all plugins was a significant priority for the 3.0 release. As explained by Tomas Della Vedova, software engineer at Elastic and Fastify contributor,

I’m very happy about how the @fastifyjs v3 release went. As you might know by now, we have a rather big plugin ecosystem. With v2 we didn’t have a specific plan for the upgrade, so we just released Fastify v2 and then slowly updated all the plugins. This year we started doing prereleases of all plugins, so a user was able to test Fastify v3 by installing the @.next version of every component of their application. Then on the release day, we published the final release of Fastify v3 and @matteocollina and me bumped all the plugins, so old and new users would not experience gaps or unwanted bugs while upgrading. Improvement for next year: automate this step as well!

Learn more about the Fastify 3.0 release from Matteo Collina, technical director at NearForm, Node.js Technical Steering Committee member, and Fastify project lead.

Or watch a more in-depth introduction to Fastify 3.

Fastify is open source software available under the MIT license and is part of the OpenJS Foundation. Contributions are welcome and should follow the Fastify contribution guidelines and code of conduct.

Rate this Article

Adoption
Style

BT