TL;DR: Get access to Fastify V4 and Node 20 with the newest Gadget framework version.
Gadget gives developers the performant, scalable infrastructure and framework to build their apps, while abstracting all of the annoying parts out of the code. With this upgrade, that means eliminating the headache of upgrading to the latest version.
Starting today, every new Gadget app will have instant access to Gadget framework version v0.3 making Fastify v4 and Node.js 20 available, so you can build with the latest tech, without the hassle of upgrading and existing projects will have a one-click migration flow to easily upgrade.
Framework versions bottle up all of Gadget’s thoroughly tested software versions into one simple number. Instead of spending time fighting with upgrade processes for each little component, or lagging behind and introducing security vulnerabilities, Gadget apps can upgrade to blessed, tested node.js software stacks at the click of a button.
We’re also introducing the option to manage which version of the Gadget framework your app is running. No one wants to worry about running a migration only to find out it broke something. Now, you have the ability to upgrade to new versions, or downgrade to an older version.
To manage which version of Gadget your app is running, you can select the framework version on the app settings page. For more information check out our documentation here.
Fastify is the high-performance JS framework powering all Gadget apps, Gadget v0.3 includes Fastify v4, which has improved throughput, simpler error handling, and many general enhancements.. Previously, plugins were named using <inline-code>fastify-something<inline-code>, but with the new version, they have all been renamed to <inline-code>@fastify/something<inline-code>. To upgrade a plugin version, check out that plugin’s readme to identify the new plugin name.
The composition of error handlers has also changed. Custom error handlers are now encapsulated, allowing for more granular control. If a custom error handler within a plugin encounters an issue, the parent handler catches and manages the error seamlessly. This streamlined approach enhances error handling, creating a more stable and performant development environment.
The other major change in the new v4 shows up in routes. With this update, it is mandatory for routes to return a reply if they intend to send a response asynchronously. Simply include <inline-code>return reply<inline-code> if you want to call <inline-code>reply.send<inline-code> after the route handler has completed its execution. Routes will also automatically expose a HEAD route by default, and the <inline-code>reply.res<inline-code> has been migrated to <inline-code>reply.raw<inline-code>.
You can read about all of the Fastify improvements in the Fastify announcement blog.
And, of course, Node.js 20 comes equipped with V8 version 11.3, promising improved overall performance with things like WebAssembly Tail Call.
Find all the details on what’s changed in Node.js 20 over on their blog.
If you have any questions or comments about the new Gadget framework version, hop over to our Discord to share your feedback and connect with a community of developers.