Deploying Cloudflare Workers to create serverless function
Published: 2022-02-07 13:48:38



   So after a few months of procrastinating, we finally created a blog site that we planned initially to create last year. We know this blog is not perfect yet, but we plan to upgrade and update it over time.

![](https://s3.us-west-2.amazonaws.com/secure.notion-static.com/81b8ecdd-7d58-48e1-8eb6-7e6a80720fe6/Untitled.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIAT73L2G45EIPT3X45%2F20220207%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20220207T134718Z&X-Amz-Expires=3600&X-Amz-Signature=025b201e11118d873d846a20f29702c59e9615ca7c5ce7b6dc386f16227bc1f7&X-Amz-SignedHeaders=host&x-id=GetObject)

Let us talk about the tech stack we used and why we chose it over other options. For this blog, we are using a service from Google called Firebase. Firebase is a BaaS(Backend as a service) like AWS(Amazon Web Service) Amplify. We are using Firebase because we want to speed up the development process, and we do not want to create a backend from scratch.


![](https://s3.us-west-2.amazonaws.com/secure.notion-static.com/21648f2c-6783-4269-b201-e8a47234eb52/Untitled.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIAT73L2G45EIPT3X45%2F20220207%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20220207T134718Z&X-Amz-Expires=3600&X-Amz-Signature=4343a00fefd0615980ee0975c75a6ddfe5c7de966fd158fd3b691134fd323d2c&X-Amz-SignedHeaders=host&x-id=GetObject)




Nevertheless, there are a few drawbacks of using Firebase, such as:

- Firebase comes with a No-SQL database(Firestore)

- Cannot run a complex query on Firestore

- vendor lock by Google

For the future, we are planning to use the [Supabase](https://supabase.com/) to replace Firebase

![](https://s3.us-west-2.amazonaws.com/secure.notion-static.com/5dcc5b0b-70fe-464a-ac00-3847aaa3d00b/Untitled.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIAT73L2G45EIPT3X45%2F20220207%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20220207T134718Z&X-Amz-Expires=3600&X-Amz-Signature=04d24f1f431f6cb73f951d75bcec57c17b93000c566230cdc24f527f0db34648&X-Amz-SignedHeaders=host&x-id=GetObject)

Since we are using Firestore from Firebase as our database, there is a limit of up to 1Mb for each document. Because of that, we have used [Notion](http://notion.so/) for our Content Management System and store all of our blog content there.

![](https://s3.us-west-2.amazonaws.com/secure.notion-static.com/43a2ec85-d6c3-4389-a10d-01df827c54a4/Untitled.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIAT73L2G45EIPT3X45%2F20220207%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20220207T134718Z&X-Amz-Expires=3600&X-Amz-Signature=5a5618a3c719f6ee0cffce4b39a50612c24460820ea4816319e69a9073ee840d&X-Amz-SignedHeaders=host&x-id=GetObject)

There are many frameworks to develop a web app for the front end, but we are using [Nextjs](https://nextjs.org/) from [Vercel](https://vercel.com/) because of their server-side rendering function. Compared to the usual Create React App, the page will be rendered at the server during runtime, making our Blog site SEO friendly.

![](https://s3.us-west-2.amazonaws.com/secure.notion-static.com/3680470b-bf34-44c5-9960-cf3ba30ff761/Untitled.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIAT73L2G45EIPT3X45%2F20220207%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20220207T134718Z&X-Amz-Expires=3600&X-Amz-Signature=6d258f97b64d23a67b374937c9332133d46cf3cd07ddff4a79a12763583fefb6&X-Amz-SignedHeaders=host&x-id=GetObject)