Current User datasource for Bubble frontend + Django backend

TL;DR Is it possible to use the Current User datasource if our user data is stored on a remote server and fetched via API?

Our Bubble app needs to move away from Bubble for performance reasons.

Currently, we have both frontend and backend on Bubble. As the first step of migration we are thinking to:

  • Build a Django backend;
  • Connect the new Django backend to our existing Bubble app via API;
  • Continue using our Bubble app as frontend only.

Later, as the second step of migration, we will build our own frontend and move away from Bubble completely.

Questions

  1. Is it possible to add a custom backend workflow to a Bubble project to authenticate / log in / log out a user stored on a remote server?
  2. Is it possible to set the Current User datasource to the user data fetched via the API (without storing user data within User data type in Bubble DB)?
  3. If it is not possible to set Current User value unless the user data is stored within User data type in Bubble DB, then how to run a user session?
  1. Authentication: You can use a custom backend workflow in Bubble to authenticate a user stored on a remote server. This workflow can use an API call to your Django backend to authenticate the user and retrieve any necessary user data.

  2. Current User datasource: Once the user is authenticated, you can set the Current User datasource in Bubble to the user data fetched via the API. This can be done using a workflow or an action in your Bubble app. Note that you may need to map the fields in the user data fetched via the API to the corresponding fields in the Bubble User data type.

  3. User session: To maintain the user session, you can use cookies or tokens to store the user’s authentication credentials. These credentials can be passed back and forth between the Django backend and the Bubble app to maintain the user session.

but to maintain User Session you need some custom code, :smiley: No Worry :smiley: ChateGPT will help you on that.