Improving the bubble app's performance and WU usage by writing your custom serverless backend functions

Hey, Bubblers,

Today I want to share our experience improving the bubble app’s performance and costs (WU usage) by writing your custom serverless backend functions.

Several serverless platforms offer similar functionality, each with its unique features and benefits:

  1. Supabase Functions: Supabase is an open-source alternative to Firebase. It offers a suite of tools, including a real-time database, authentication, and serverless functions. Supabase Functions allow developers to write and deploy server-side code without managing a server.
  2. Amazon Lambda: As part of the Amazon Web Services (AWS) suite, Lambda is a top-rated serverless computing service. It runs your code in response to events, such as changes to data in an Amazon S3 bucket or updates in a DynamoDB table. It automatically manages the resources required by your code.
  3. Cloudflare Workers: Cloudflare Workers provide a serverless execution environment that allows you to create entirely new applications or augment existing ones without configuring or maintaining infrastructure. It’s mainly known for its exceptional performance due to Cloudflare’s extensive global network.
  4. Microsoft Azure Functions: Azure Functions is Microsoft’s serverless computing service. It enables developers to run event-triggered code without explicitly provisioning or managing infrastructure. Azure Functions support multiple programming languages and integrate with various other services in the Azure ecosystem.
  5. And other…

In Sommo, we prefer to use Firebase Functions. It has a straightforward, intuitive interface and flexible pricing model, Firebase follows a pay-as-you-go model, meaning we only pay for what we use. Firebase Cloud Functions offers 2 million invocations (executions) monthly for free. Beyond this, the next 1 million invocations are priced at just $0.40.

Another compelling reason for our choice is that Firebase is based on Google Cloud infrastructure. This opens up a gateway to many different services that we can leverage to enhance our applications.

While Bubble’s no-code interface is user-friendly for non-tech people, Firebase and JavaScript offer superior performance, scalability, and cost-effectiveness. Don’t be daunted by the prospect of learning to code - with tools like OpenAI’s ChatGPT, it’s easier than ever. These AI-powered chatbots can guide you through the learning process and even assist with coding.

To create and set up Firebase Functions to work seamlessly with the Bubble Data API, you need:

  1. Prepare Project Environment.
  2. Set up a new Firebase project in your project directory.
  3. Run your Cloud Function (I recommend you download Visual Studio Code or use any other IDE you like).
  4. Set up Environment Variables and Authorization.
  5. Set up communication with Bubble API.

I have detailed each of these steps in this guide.

In Sommo, we use this approach for chaining network requests, mapping data, performing calculations, or cleaning up the database, but the possibilities are virtually endless. Try and share your experience with us!

16 Likes

Thank you @andriy.bas :+1:

2 Likes

Me and Keith have been preaching this for a hot minute. Keep advocating, dude!

5 Likes

@jared.gibb thanks :v:

1 Like

@andriy.bas thank you! <3

1 Like