This section covers the different ways you work with data in Bubble
This section takes a long-form look at how Bubble manages different types of data. To see the concise, technical description of data sources, operators, comparisons, search and privacy, you can check out our more concise core reference entry on data.
Working with data is the cornerstone of any application. In fact, it's such a central part of app development that it's hard to imagine an app that doesn't rely on it in some way. Whether it's data generated by users, owned by you or imported from other apps and services, the ability to collect, store, and visualize information is why most applications exist in the first place.
Think about it: a ride sharing app needs information about drivers, customers, locations and many other details to complete a transaction. A social media app needs user information, photos and user-generated content and a newspaper needs articles and images: they all collect, store and display their data in different ways, but in principle they all work in the same way.
The ability to work with data is what allows apps to do what they do best: provide value to users.
Not only do most apps by their most basic definition work with data, but they mostly all do it in the same way: by storing the data in a database.
In this section, we'll cover many topics related to data in Bubble:
The database is like the unsung hero of the tech world. It quietly sits in the background, doing its thing, while most users don't know how it works or even that it exists. All they see is a nice-looking user interface that always seems to have their data ready. But without the database none of those apps and websites would be of any use.
So how exactly does it work? Imagine a huge spreadsheet that has hundreds, thousands or even millions of rows and columns, with each cell containing a piece of data. You can think of each row as representing a single entity, such as a customer or an order, and each column as representing a specific attribute of that entity, such as their name or order number.
In many ways, the comparison is not just a metaphor: a spreadsheet is a kind of database. But the type of database connected to a web application is designed to store data in a secure way and be incredibly efficient at finding and retrieving specific records even with complex queries.
That's why great applications are those who put a lot of work into the combination of working efficiently with data and great design. A social media app like Facebook or a video app like TikTok would not be very interesting if all they presented was a spreadsheet of likes and URLs to video clips; the data and design go hand in hand to create a success story.
Setting up and managing a database is traditionally a demanding job that requires specific training like a degree in computer science and even additional education and certification.
One of Bubble's core strengths is its built-in database that's automatically set up when your app is created, removing the need for dedicated employees to operate it.
Bubble takes care of most of the database management for you:
- Creating the database when you first set up your app
- Setting up and maintaining two separate databases: one for testing and one for live users
- Keeping it operational and maintaining uptime
- Encrypting its content to store and transfer it securely
- Take point-in-time backups that can be recovered at any time
- Privacy Rules keeps user data securely protected, based on who is trying to access it
- Creating and maintaning user profiles with secure passwords
- Regular vulnerability testing
As you develop your Bubble application you'll find that you need to store data in different ways, and we split these into three categories:
Dynamic data is information that the users of your app need to dynamically be able to create, read, edit, delete, search for and aggregate. This covers all kinds of different data that you and your users will find it useful to work with on an ongoing basis: stuff like social media posts, customer information, blog articles, eCommerce products and chat messages.
Information like this is stored in the database.
Temporary data is information that your app needs to store while the program is running – in traditional programming you would call them variables. They can be used for all sorts of things: navigation, calculations, remember a list of things that the user selected, remembering user input that you don't need to store permanently – any kind of information that you only need while the app is open.
Temporary data is stored in Custom states (a sort of variable connected to an element) or in URL parameters (information stored in the page's URL)
Static data is information that you want to keep consistent or that's unlikely to change regularly. This could be a list of options like states, countries, colors, or categories, strings of text like headers, menu options, error messages or text translations and settings like membership type, gender or interests.
Bubble offers two different ways of storing static data with very different uses:
App texts are static strings of text that you display around your app, such as headers, tooltips, explainer texts, menu options, page titles and metadata.
App texts are different from Option Sets in that they are created specifically to hold strings that can be translated into different languages. This gives you an easy way to prepare your app to available to a global audience.
Let's say you add the App text "Welcome to my app". You can then add translations of that string in other languages such as German and Hindi and Bubble will automatically use the translated text based on the user's preferences. You maintain full control over what languages you want to let your users pick and how they set their preferred language.
App text can be used for translations, but they don't have to: you can also use it to have a simple way to manage all the static strings of text around your app in one place.
App texts are meant for public information – they are not encrypted and should not contain any sensitive information.
Option sets let you store any type of unchanging information like in the examples above. It can be single values like a text or number or a list of values that can be used in elements like checkboxes, radio boxes and dropdowns.
Option Sets, as the name suggest, allows you to set up a set of options that you can manage in one place, making it easy to maintain and update as needed. They require that your app is deployed before updates are visible to your users, as opposed to dynamic database data that can be changed in real time.
Option Sets are meant for public information – they are not encrypted and should not contain any sensitive information.