App optimisation - Save money by reducing amount of workflows

Hi everyone,
I have been using Bubble for several years now and I have noticed that Apps can become pretty expensive at some point.

I have developed a system that uses the Bubble data API to optimise the usage of workflows and thus it reduces the cost of the app.

Is this something of interest for anybody?

2 Likes

Sounds like a great idea. Could you provide us with an example scenario on how the cost can be significantly reduced?

Sure! The basic idea is that when you use the Bubble data API you use the CPU and not a Workflow. I use it a lot for doing calculations or even writing and reading from the database.

I do this by using a Node.js module I have created (which uses Bubble Data API). One recent example of how I used this is for an ecommerce website I am building. I have a list of products which I want to put in a box (which is the item I want to sell in the ecommerce). Every time I put a new product in a box that I am creating I want to know the total cost of the box, total weight and shipping cost. To do that I don’t run crazy workflows, I just make an API call to my Node.Js backend sending the boxID, I read all the data I need about the products, do all the calculations and then I write/update the data in the database. Like this I use only one workflow instead of… well I don’t know how many I would need to do all that, but they are a lot. If you have a decent amount of users creating boxes the app will become pretty expensive quite soon if you would implement all that logic using workflows.

2 Likes

Thanks for clarifying. Would this be the same as utilizing math.js to do client-side calculations?

not quite I think. With math.js you still need to run workflows to gather all the data you need, put it in the right format and then you can do the calculations. Then if you want to have the data saved in the database you still need workflows to do that.

So for some use cases, maybe math.js can overlap, but that gives you way more flexibility to do whatever you want.

You could also use it to create a kind of hybrid app where bubble is used only for the front-end and experimenting new things and then the heavy logic would be implemented outside of bubble and only the data you need to display things would be saved in the database.

Is the cost of the app increasing as the number of workflows increases because of a need to add capacity to maintain the functionality of the app when more users are using the app?

Yes. If you use the CPU instead of workflows you need less capacity because you make a direct operation on the machine which hosts your app. When you use workflows bubble has to translate that into machine operations.

Hello @bralca88

It will be interesting if you can give ‘how to build’ a node.js server (with Amazon or other) and give some real life examples of interaction with Bubble.

Hi @JohnMark, at the moment I don’t have an how to guide on this. It would be also difficult to create one which would make sense, because each and every app has different needs, so part of the work is to study the current workflow setup and then propose a solution that reduces the workflow usage.

Also the code I use is not available to third-party, so even if I could find a way to create a guide it would not be useful without the code.

If you are interested in seeing how it works, I would be happy to set up a video call with you and show you a real life example.

3 Likes