October 18, 2024
4 mins

How to Export Your Data from Bubble.io to Supabase with PlanB

How to Export Your Data from Bubble.io to Supabase with PlanB

Introduction

Using a tool like PlanB Backups can help you easily export your data from Bubble and start querying it in a more robust database system within minutes. In this post, we'll guide you through the process and explore the next steps, such as setting up automated syncs and managing data integrity when switching from Bubble's simplified database structure to a more traditional relational database.

Why Supabase?

Supabase is a great option for this transition because it's a feature-rich, easy to learn, and is a PostgreSQL database like Bubble.io is based upon.. The best part? Supabase offers 500MB of free storage and you only need to log in once a week to keep your instance active. However, there are many other postgres based databases you can use, like AWS RDS or Xano. The choice is really about what features you need beyond the database itself.

Step 1: Create Your Supabase and PlanB Accounts

Start by creating accounts on both Supabase and PlanB Backups. Once you have these ready:

  1. Set up your Supabase database, which should take just a few minutes.
  2. Copy your connection string from Supabase. This will allow PlanB to export your Bubble.io data into your new database.

Step 2: Prepare Your Bubble App for Export

In Bubble, you’ll need to enable the Data API for the tables you want to extract. If you're looking to get your live data, deploy your app to the live environment before proceeding. Make sure the external URL is added in PlanB so it can connect to your app. Optionally at this point, consider renaming your tables and Columns in your bubble app to be SQL friendly.

PlanB will then scan your Bubble app to understand its structure, including tables and fields. This process only takes a few minutes depending on the complexity of your app.

Step 3: Export Your Data from Bubble.io

Once PlanB has scanned your Bubble app, go to the Data Export tab. From here:

  1. Select the table you want to export.
  2. Paste the Supabase connection string you copied earlier.
  3. Hit export.

Depending on the size of your table, this process could take seconds or minutes. PlanB also helps by intelligently renaming Bubble's more obscure field names (like emojis or special characters) into SQL-friendly column names. For example, columns with emojis or special symbols will be converted into more readable names for database queries.

Step 4: Set Up Automatic Syncing with PlanB

After you've exported your data, the next question is: How do I keep it in sync?

PlanB makes it easy to schedule daily syncs. This will insert any new rows since the last sync into your external database. For transaction-heavy tables that are constantly updated, PlanB offers options to sync the entire table rather than just new rows.

Transitioning from Bubble's Database to an External Database

Why Move to an External Database?

Moving to an external database opens up more possibilities, such as advanced querying, better scalability, and integration with business intelligence tools like PowerBI or Tableau (shout out to Visiokio that is my preference). While Bubble simplifies a lot of things, its database is quite limited when it comes to performing complex queries or aggregations, making this transition worthwhile.

Managing Referential Integrity

In Bubble, you likely didn't have to think much about referential integrity or foreign key constraints, since Bubble abstracts this away in workflows and actions. However, in a traditional relational database like PostgreSQL (which Supabase uses), you’ll need to consider things like foreign keys and data integrity.

For example:

  • In Bubble, relationships between data types are often abstract pointers, but in a relational database, you'll want to ensure proper referential integrity by enforcing foreign key constraints.
  • If your data structure relies on relationships between tables, you’ll need to set these up manually in your external database.

This is all optional - in your Bubble app you had no referential integrity in the database - you implicitly managed it in your workflows.

Handling Transactional Data

Another consideration is how to manage transactional data versus Log data that remains static. For instance, you may have tables that behave more like logs—continuously growing, but never updating records. Others might involve changing states, such as user login attempts or subscription changes.

In Bubble, managing these data types is simple, but once you move to an external database, you’ll need to manage these different types of data more carefully, especially when setting up your synchronization and querying processes.

Transition Strategies: Big Bang or Gradual Migration?

The Big Bang Approach

One strategy is to run both your Bubble database and the external database in parallel until you're ready to switch over completely. This is called the Big Bang approach. While it allows for a cleaner cutover, it’s high-risk and resource-intensive.

Here’s how it works:

  • Two teams: One manages the Bubble app, while the other builds the new platform on the external database.
  • At a certain point, all your customers are migrated from Bubble to the new platform.
  • This is the "big bang" - it is stressful and takes a lot of testing and planning to get it to work smoothly.

Gradual Migration &  Hybrid Platform (Recommended)

A safer alternative is a gradual migration, where you transition parts of your app’s data and functionality over time. This ensures that the app remains operational and that any new features or changes in Bubble can still be addressed.

Some benefits of this approach include:

  • Lower risk: You can test and validate each part of the migration.
  • Improved flexibility: You can continue to build new features in Bubble while progressively transitioning to the new system.
  • Up-skill your team: your domain expert team is retained

Conclusion

Exporting your data from Bubble.io and transitioning to an external database like Supabase is a powerful way to unlock more advanced querying, better data integrity, and more flexibility with external tools. Using PlanB makes the export process easy, while careful planning ensures a smooth transition with minimal disruption.

Full disclosure - PlanB backups is my own product.