Adventures in Nodeland logo

Adventures in Nodeland

Subscribe
Archives
February 21, 2022

Fastify has 91% developer satisfaction and others Adventures in Nodeland - Issue #48

Hi Folks, here is another edition of Adventures in Nodeland packed with great news and new releases. The biggest news is that Fastify has 91% developer satisfaction according to the State of JS survey. I find this result quite impressive - thank all of you for the support! On the release front… I shipped Fastify v4.0.0-alpha.1 on Friday! As usual, let me know if you have any questions!

Fastify

Last Friday I merged the next branch of Fastify with the main branch, officially starting the v4 release cycle with v4.0.0-alpha.1. The pre-release is pretty low on release notes, plugin support and migration guides. However all breaking changes are there. We will cut a release candidate soon!

Release v4.0.0-alpha.1 · fastify/fastify · GitHub
Release v4.0.0-alpha.1 · fastify/fastify · GitHub
Fast and low overhead web framework, for Node.js. Contribute to fastify/fastify development by creating an account on GitHub.
github.com
Release v4.0.0-alpha.1 · fastify/fastify · GitHub
Release v4.0.0-alpha.1 · fastify/fastify · GitHub
Fast and low overhead web framework, for Node.js. Contribute to fastify/fastify development by creating an account on GitHub.
github.com

Last week we also shipped a new version of fastify-reply-from that adds support for custom querystring functions:

Release v6.5.0 · fastify/fastify-reply-from · GitHub
Release v6.5.0 · fastify/fastify-reply-from · GitHub
fastify plugin to forward the current http request to another server - Release v6.5.0 · fastify/fastify-reply-from
github.com
Release v6.5.0 · fastify/fastify-reply-from · GitHub
Release v6.5.0 · fastify/fastify-reply-from · GitHub
fastify plugin to forward the current http request to another server - Release v6.5.0 · fastify/fastify-reply-from
github.com

Fastify does not allow to redefine routes at runtime. This causes a challenge to use Fastify as the basis of any software that needs to do so when reacting on a configuration change. I have created a new library called @fastify/restartable that wraps Fastify and allow you to reload a fastify instance in the same process. Here is a simple example:

Mercurius

Mercurius Federation Gateway continues to improve. You should try the new release:

Release v9.3.2 · mercurius-js/mercurius · GitHub
Release v9.3.2 · mercurius-js/mercurius · GitHub
Implement GraphQL servers and gateways with Fastify - Release v9.3.2 · mercurius-js/mercurius
github.com

One of my teams at NearForm keep finding edge cases that are not handled by Mercurius gateway, in this case the support for value types in top-level resolvers. I have a good grip on how federation work and fixing its problems, so this time it was not an impossible bug.

[gateway] Resolve nested references in a value type resolved from a top-level resolver by mcollina · Pull Request #734 · mercurius-js/mercurius · GitHub
[gateway] Resolve nested references in a value type resolved from a top-level resolver by mcollina · Pull Request #734 · mercurius-js/mercurius · GitHub
Fixes #731 Fixes #732 Signed-off-by: Matteo Collina hello@matteocollina.com
github.com

Manuel fixed an important bug on top of the previous fixes to handle empty arrays or null references.

fix: gateway empty types by Eomm · Pull Request #733 · mercurius-js/mercurius · GitHub
fix: gateway empty types by Eomm · Pull Request #733 · mercurius-js/mercurius · GitHub
Follow up #726 When the resolvers returns empty states (null or []) an error is thrown
github.com
fix: gateway empty types by Eomm · Pull Request #733 · mercurius-js/mercurius · GitHub
fix: gateway empty types by Eomm · Pull Request #733 · mercurius-js/mercurius · GitHub
Follow up #726 When the resolvers returns empty states (null or []) an error is thrown
github.com

Pino

Pino v7.8.0 was released last week with a few fixes and a new feature: mixinMergeStrategy. Check it out

Release v7.8.0 · pinojs/pino · GitHub
Release v7.8.0 · pinojs/pino · GitHub
🌲 super fast, all natural json logger. Contribute to pinojs/pino development by creating an account on GitHub.
github.com
Release v7.8.0 · pinojs/pino · GitHub
Release v7.8.0 · pinojs/pino · GitHub
🌲 super fast, all natural json logger. Contribute to pinojs/pino development by creating an account on GitHub.
github.com

Check out v6.14.0 that adds the mixinMergeStrategy to the LTS line too:

Release v6.14.0 · pinojs/pino · GitHub
Release v6.14.0 · pinojs/pino · GitHub
🌲 super fast, all natural json logger. Contribute to pinojs/pino development by creating an account on GitHub.
github.com
Release v6.14.0 · pinojs/pino · GitHub
Release v6.14.0 · pinojs/pino · GitHub
🌲 super fast, all natural json logger. Contribute to pinojs/pino development by creating an account on GitHub.
github.com

News

One of the reason I build Open Source software is to improve the lives of the developers around the globe. Therefore I couldn’t have added the following article to my newsletter:

Building for the 99% Developers
Building for the 99% Developers
Should you move to serverless? Is GraphQL the answer to your API woes? Should you follow the latest DevOps playbook to increase your system reliability?
future.a16z.com
Building for the 99% Developers
Building for the 99% Developers
Should you move to serverless? Is GraphQL the answer to your API woes? Should you follow the latest DevOps playbook to increase your system reliability?
future.a16z.com

After a couple of months from the previous release of express v4, we can see more movement on express that is now progressing in the release of v5 with the first beta release!

Release 5.0.0-beta.1 · expressjs/express · GitHub
Release 5.0.0-beta.1 · expressjs/express · GitHub
Fast, unopinionated, minimalist web framework for node. - Release 5.0.0-beta.1 · expressjs/express
github.com
Release 5.0.0-beta.1 · expressjs/express · GitHub
Release 5.0.0-beta.1 · expressjs/express · GitHub
Fast, unopinionated, minimalist web framework for node. - Release 5.0.0-beta.1 · expressjs/express
github.com

Should you use REST? or maybe GraphQL? What is simpler and guarantee you the best time to market?

Overhead of using REST instead of Graphql with node.js
There are quite a few misconceptions when it comes to graphql. It cannot be cached on http protocol level, it has to return 200 code even when there are errors, it kills fluffy kitten every time you make a mutation.

dev.to

I often find myself in situations where I have to design a migration from a legacy system to a fresh, modern one.. Here is a detailed guide:

I find the trend of specifying the types in modules using JSDoc instead of writing them in TypeScript from the get-go quite fascinating. It combines great user experience for users while retaining the full flexibility of JavaScript when implementing things. Wdyt? Would you use them?

How to add JSDoc Typechecking to SvelteKit
How to add JSDoc Typechecking to SvelteKit
As I build out swyxkit, I am finding that I am no longer prototyping and that I need to be able to refactor with confidence. This makes it the right time to introduce types! I was tempted to use TypeScript since I am more familiar with that, but since SvelteKit is written with JSDoc types, I figured I’d finally give that a try as I had never tried it before.
www.swyx.io
How to add JSDoc Typechecking to SvelteKit
How to add JSDoc Typechecking to SvelteKit
As I build out swyxkit, I am finding that I am no longer prototyping and that I need to be able to refactor with confidence. This makes it the right time to introduce types! I was tempted to use TypeScript since I am more familiar with that, but since SvelteKit is written with JSDoc types, I figured I’d finally give that a try as I had never tried it before.
www.swyx.io

Do you like Markdown? I do! However quite a few startups are replacing it with their custom, post-markdown, proprietary format to be able to support more use cases. Check out this article from the smashing magazine.

Thoughts On Markdown — Smashing Magazine
Thoughts On Markdown — Smashing Magazine
Quick summary ↬ Markdown in all its flavors, interpretations, and forks won’t go away.
www.smashingmagazine.com
Thoughts On Markdown — Smashing Magazine
Thoughts On Markdown — Smashing Magazine
Quick summary ↬ Markdown in all its flavors, interpretations, and forks won’t go away.
www.smashingmagazine.com

I’m a huge proponent of the micro frontends approach… so I couldn’t link this article from Auth0 describing how they set it up!

Micro Frontends with Angular, Module Federation, and Auth0
Micro Frontends with Angular, Module Federation, and Auth0
TL;DR: Module Federation allows loading Micro Frontends at runtime. Common dependencies like Angular or the Auth0 library can be shared and hence don’t need to be loaded several times. This is also the key for sharing data like the current user or global filters.
auth0.com

How does twitter servers logs? What are the complexities involved? In the following article you would learn how hard logging at scale can be. Check it out:

Logging at Twitter: Updated
Logging at Twitter: Updated
Infrastructure While centralized logging previously existed at Twitter, it was limited by low ingestion capacity, and limited query capabilities which resulted in poor adoption and failed to deliver the value we hoped for.
blog.twitter.com
Don't miss what's next. Subscribe to Adventures in Nodeland:
GitHub X YouTube LinkedIn