Hi Folks!
As I write this, I'm on a plane to London, where I will spend the entire week working with my co-founder, Luca Maraschi. Since I last wrote, there has been quite a bit of news.
Bun hit the 1.0 release, and I'm both excited and disappointed. I really like what Jarred Sumner is building with Bun, but I'm a bit frustrated by their compatibility claim with Node.js. In my experience, it's not a drop-in replacement, and many inner details differ. This results in many random issues over my repos asking for fixes for Bun incompatibilities while people try it out. I would have preferred if they waited for calling a 1.0 to reach greater compatibility with the ecosystem.
A few reasons:
As I'm writing this, Bun does not support Fastify or Pino. Both are high-impact modules, with pino being as popular as Next.js. The Bun team is actively looking into adding the missing APIs and behaviors, and I expect them to catch up in the coming months. Given how many are asking for support, a variation of the following message ended up in my GitHub saved reply:
Ultimately, Bun does not implement all Node.js APIs. It's not a clean drop-in replacement for Node.js (despite their claims). Please refer to the Bun Discord or Issue Tracker for such questions.
If any of my repositories do not run well on Bun, please open a bug on Bun. This approach is also what Jarred asked everybody to follow.
bun install
speed comes at a costOne of the most impressive things about Bun is the performance of bun install
. However, it comes with a considerable cost in developer experience.
npm
, pnpm
and yarn
check if a new version is available and fetch it from the registry by default. Instead, bun
would pick a local version first.
In fact, pnpm --prefer-offline
flag has roughly the same behavior of bun install
and it yields performance in the same ballpark: on my system 750ms vs 150ms (see also this tweet from Evan You). While this difference matters, the two numbers are comparable, and hopefully, the gap will be reduced.
What would be interesting is how the end users would appreciate this difference in behavior. Would you use the latest and the greatest, or what you have installed locally, knowing you might lose on bug or security fixes?
I was also very impressed by the clever use of copy-on-write on Mac OS X, making it almost instantaneous with a hot cache. This is partially due to clonefile
, which tells the operating system to copy the file only when modified for the first time, saving precious seconds. I hope all the other JavaScript package managers copy this technique.
For a few years, Node.js invested very little in improving the runtime performance. Last year, Yagiz Nizipli kicked off the Performance Team, and it's now a strategic initiative. This has led to quite a few significant Performance improvements that are described by Rafael Gonzaga) in the State of Node.js Performance 2023. Node.js is getting faster at each release, without massive breaking changes.
Would you like for Node.js to become faster? Join the performance team and contribute... alternatively, find a way to fund the development of Node.js.
Have you ever wondered how to implement usage metering for your SaaS? In this video, I pair up with Peter Marton to find out what OpenMeter is, how to use it, and how it enables tracking how much a user has used a specific feature. We will also check if the new Platformatic client would generate a good client for OpenMeter... and we have found a few bugs!
I also recorded a video explaining why using EventEmitter with an async function is an anti-pattern. Are you using this pattern? Stop now!
I've also been busy building Platformatic in public: we are adding automated tests to the code created by the create-platformatic
generator, so all the harness for testing is already set up.
Follow along with the development at https://github.com/platformatic/platformatic/pull/1323.
mongodb@6
driver and drops Node.js v14.@fastify/cookie
to v9; v7.1.0 adds a .touch()
method to refresh the session.opts.rejectUnauthorized
for SSL option.request.session.cookie.expires
is null
.onListen
hook!fastify-html v0.1.0 is a new module I plan to use to explore htmx. I'm planning a stream on this in the coming weeks. Would you join?
How much drama can happen if a major technical influencer drops TypeScript? It sparked a massive flame war between TypeScript lovers and haters.
Announcing native npm support on Deno Deploy - Amazing news as Deno can know run Fastify at the edge!
How we built Pingora, the proxy that connects Cloudflare to the Internet - read this amazing engineering story on how CloudFlare replace NGINX.
I've found this online book quite interesting - How Query Engines Work; maybe I will implement one day!
When URL parsers disagree (CVE-2023-38633) - Canva Engineering Blog - who said that parsing a URL was easy?