API calls: frontend vs backend

Hi,

I am building an app that include an API assistants from OpenAI, I can make the whole workflow in the frontend using a looping plugin, and I can use API workflows instead, so what is the right or professional way to do it? or what are the things I should consider to make a decision?

I now only use backend unless requested otherwise. That comes with a big limitation that live-streaming text isn’t possible. However, I’m using complex AI use cases that requires a lot going on behind the scenes. So, modularity is really, really, important for scale and maintainability. Bubble’s front-end modularity capabilities are limited (we can’t have true front-end global custom events, for example).

To give you an idea of what I mean by modularity, in one of my apps:

  1. The user needs to be able to choose whether to use OpenAI or Anthropic (so different API calls + structures for each).
  2. The user needs to be able to choose whether to include their project knowledgebase (Pinecone).
  3. The user needs to be able to choose whether to include their global knowledgebase (Pinecone)
  4. The user needs to be able to choose whether web browsing is used

Programming that logic to be used in multiple places across my app would be a huge pain in the ass. Because there’s no text streaming, for long responses, that means it takes a little longer, however responses will only speed up as models and processing algorithms speed up and for my B2B app use cases people are happy to wait.

The right option for you depends on what your app is, who uses it, and how complex it is :slight_smile:

2 Likes