Custom Events vs. Backend Workflows: Optimal Workload Usage

Hey Bubblers :wave:,

I had a question about choosing between using a frontend Custom Event (CE) vs Backend Workflows (BW). I’ve learned that CEs take place on the client-side and BWs, well, on the backend. Having said that, I’m trying to undertsand, which of these is a better strategy to use from a Workload Units optimization perspective?

As I understand CEs, they are page-specific. This means that if I have a bunch of actions that I want to bundle into a ‘function’ and use across all pages of the app, a CE won’t work, unless of course, I duplicate the CE itself across each page, but I would think that’s bad practice (DRY). If that’s true, then why not always use BWs to have the repeatable functionality available to use on all pages (assuming they need to run current time and not later)? Also, assuming from a speed perspective, there isn’t a noticible difference between whether I wrap my repeated actions in a CE or a BW, then is there a reason why I’d want to lean towards CEs instead of BWs specifically from a WU perspective? Do BWs cost more WUs than CEs?


1 Like

You are correct.

I do use them. The primary reasons are:

  1. Backend workflows using Schedule API workflow are asynchronous and slower to start (it’ll normally take a second to start running). You overcome this by making an API call to your own Bubble app so that it runs immediately and you can use the result of the API call in following action steps. I have never noticed any difference in speed once the workflow is running between frontend/backend though backend would presumably be faster as there is less latency between Bubble server and… the Bubble server. At least, compared to the front-end, where some data may have to go back and forth between Bubble and the user whilst stuff is happenning.
  2. Extra WU. Scheduling a workflow costs about 0.1WU. Negligible if you ask me.
1 Like

Just a small remark. You can “wrap” custom events into a reusable element. And add this RE on any page where you need your custom events. So this way you comply with the principle of DRY.
The most obvious example - reusable header element that (usually) exists on each page. If you add some custom events to it - they’ll be available on every page.


Another factor: If your “function” involves creating a list of things, then I believe the only option is to use a backend API workflow–either call a workflow defined as a Data API or use the Schedule Workflow on a List action.

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.