Skip to content

NoBuddy 0.2 - moving to the web

Posted on:April 12, 2022

⬅️ For previous article in the series, see NoBuddy app first POC

First, lets do a little recap to jog our memory:

💡The Idea

After thinking through the mentioned changes in requirements, I thought of the following ideas:

🏗Execution

Creating backend for Notion API management

Before implementing the backend, I had to make several decisions about technologies that I would use to achieve these requirements:

The Netlify debacle

For the API part I decided on using Netlify functions. I did not do in-depth research into alternative providers, but I heard good things about the service and wanted to try it out.

It was nice to work with, and I liked the authentication offering in the form of Netlify Identity. The major gripe I had with it was very little documentation. As a beginner in this area it took me a while before figuring out how to integrate it.

However, this phase of everything going pretty smoothly was about to end. I was almost halfway done with moving the Notion integration to Netlify functions when I hit a roadblock.

I implemented the function that stores the Notion api key in Fauna. This is used when first setting up the app, where upon entering the API key, the app checks if all needed Notion databases can be found. To do this it makes 4 calls to Notion, and since the API (and, frankly Notion as a whole) is not very fast, I ran into the 10 second Netlify function time limit almost immediately. This gave me huge pause as there were definitely functions that were even more “Notion heavy” than this one, and this was almost unusable. I could of course try to split the functions into separate ones that would probably be faster, but the hanging sword of the 10 second time limit would always be above my head, ready to fall without any notice. This was the reason I began looking for an alternative FaaS platform.

Looking for alternatives

One of the other FaaS providers I know of is Vercel, which I actually use to serve this blog. But it has the same execution time limitation as Netlify, at least for free accounts. And even with paid plans that have this limit expanded to 60 seconds and more, I feared what the costs would be if I started adding more Notion interaction.

The next provider I know of is Cloudflare Workers, and while looking at their price model, I started to get excited. The way they compute execution time is CPU execution time. This is important because as I said before the reason for my functions exceeding the limit is interaction with Notion API, which is mostly IO. This means I should not be billed for all the waiting around for Notion API at all. And the difference was really huge, what was 10s or more when timing the whole execution, became around 24ms of CPU execution time!

Ok, so I was sold 😀, now I need to take everything I just implemented with Netlify, and move it over to Cloudflare Workers, yay … And that is what the next post is going to be about.