Cal.com is making me lose faith in the Node ecosystem
It's like that Onion article...
Man Who Thought He'd Lost All Hope Loses Last Additional Bit Of Hope He Didn't Even Know He Still Had
Now that I'm running a mentorship #podcast, I'd like to get more people on it as guests, so I thought of deploying some sort of appointment management software. Browsing the Open Source Calend.ly alternatives section only really gives cal.com as something viable. A clean UI that integrates with CalDAV and offers great features (some behind paywall, but still). Self-hostable in theory...
I took a first stab at it, and was immediately blocked by something call turbo which is Vercel's new and shiny tool for building javascript apps.
So, immediately I was prevented from just doing the bare minimum I hope to expect from JS applications:
npm install
npm run
Okay, I get it, it's a Next.js app, so it needs some amount of compilation for all that Typescript and JSX.
My first portent was the fact that yarn
was running for minutes, downloading all the dependencies. All 2.5 gigs of them...
After the download completed I proceeded with build. It ran for about five minutes and crashed with OOM exception. I've spent next hour trying to get it to work by passing the NODE_OPTIONS="--max-old-space-size=4096"
and it kept failing.
After digging around some more, it looks like turbo
specifically whitelists the environment variables passed to the applications being built, and NODE_OPTIONS
was not one of them. After adding it to the turbo.json
the build started progressing, but still failed soon after, completely saturating the available RAM on the small Vultr VPS I was using for this purpose...
I've cleared up some room on the disk and created a 2 gig swap file... Build process went on for 10 minutes and crashed. Okay, let's bump that up to 4 gigs... now it's running for 12 minutes and crashes... Eventually, after scrounging all remaining space on the box, the build has completed with 8 gigs of swap, after whopping 25 minutes.
The app was finally running...
Now my node_modules
folder has a .turbo
cache folder, that bring the total to 6 gigs of disk space...
Now I felt like Doc Brown in the famous 1.21 Gigawatts scene
All the bugs and configuration issues notwithstanding I have the software running...
A few weeks later I've fetched the most recent release, and the process had to be done once more. Now that they've upgraded to a newer version of NextJS, it now takes 40 minutes to build, and the site itself is slow beyond reason. I though that SSR and fancy new “Oh, we're just like PHP was 10 years ago, but with React on the server” it is supposed to be fast...
I'll likely be nuking this software from my server... I can't be using products that are only usable if you're paying Vercel for the privilege...
I can probably write a small subset of features that I need that will not require 2.5 gigs worth of NPM packages, and such insane build times.
It should just be
npm install
npm run
Or better yet, write it all in zig
with a 10Mb binary with no extra dependencies...