You should now use cloud variables instead of adding a Realtime DB component. This will work the same way in the background but will save you a lot of blocks.
We highly recommend you use your own Firebase account with your app. With the increased focus on user privacy, we strongly advise that you use own Firebase account both to ensure the privacy of your user data and to give you visibility into the database itself. We provide our database for your convenience but we may also clean out our shared account periodically
This storage option is useful for anything from saving game high scores to tracking work credit, powered by Firebase.
Set up Your Own Firebase account
Thunkable provides a default Firebase account for testing purposes. When your app is ready to be distributed, we strongly advise connecting your app to your personal Firebase instance.
Firebase Realtime Database also pairs well with Sign in and you can use a single Firebase project for both services.
If you are using Sign In powered by Firebase in your app, you do not need to edit the default database rules which permit reading and writing to the database for authorized users.
Otherwise, you will need to set your Read and Write rules to true
Connect Your Firebase Project with Thunkable
To connect your Firebase project with Thunkable, you'll have to add an API key and Database URL to the Firebase Settings in the App Settings, which you can find by clicking on your app icon
One way to retrieve the API key and Database URL from Firebase is to click on the Add Firebase to your web app option
Test Save to your Database
Once your project is connected to your Thunkable app, we recommend that you do a simple test and save a value into your database. It should appear in your data tab in your Firebase console.
Save (key, value)
Asks Firebase to save a given value under the given key
Asks Firebase to get thevaluestored under the givenkey
Update Data in Real-time
Add Listener (key)
Asks Firebase to listen to a specifickeyfor changes in the database. Required for Data Changed block.
Data Changed (key,value)
Asks Firebase for updates tovaluefor specifiedkey. Requires an Add Listener block.
Remove Listener (key)
Ask Firebase to stop listening to a specifickeyfor changes in the database
Separating Your Data into Project Buckets
You might want to split your database into smaller spaces, also known as project buckets. To do this, you would need to save your value as an object and use the create object block to create your project bucket. More details in this post.
Thanks to our power Thunker @actech for this awesome tip!