This storage option is useful for anything from saving game high scores to tracking work credit, powered by Firebase.
{% hint style="info" %} You can 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. {% endhint %}
{% hint style="danger" %} 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 {% endhint %}
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.
Create your free Firebase project and account
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
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
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.
Event | Description |
---|---|
Save (key , value ) |
Asks Firebase to save a given value under the given key |
Event | Description |
---|---|
Get (key ,value ) |
Asks Firebase to get thevalue stored under the givenkey |
Event | Description |
---|---|
Add Listener (key ) |
Asks Firebase to listen to a specifickey for changes in the database. Required for Data Changed block. |
Data Changed (key ,value ) |
Asks Firebase for updates tovalue for specifiedkey . Requires an Add Listener block. |
Remove Listener (key ) |
Ask Firebase to stop listening to a specifickey for changes in the database |
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.