# Connect a Firebase Realtime Database

## Overview

Firebase is a Google product that simplifies the development of mobile apps by providing out-of-the-box solutions for common mobile development needs, such as a simple realtime database and authentication. You can use a single Firebase project for both a realtime database and authentication.

Thunkable provides a default Firebase account for testing purposes, but before you distribute your app we strongly recommend connecting it to your personal Firebase account.

{% hint style="info" %}
Please note that while the images and instructions from the Firebase account are accurate at the time of this doc’s publishing, they may change slightly over time.
{% endhint %}

## Create a Firebase Account

1. Visit [Firebase](https://firebase.google.com/).
2. Click **Get Started** or **Sign in**.
3. Sign in with your existing Google account credentials or create an account.

## Create a Firebase Project

1. On your [Firebase console](https://console.firebase.google.com/u/0/), click **+ Add project**.
2. Give your project a name.
3. Click **Continue**.
4. Indicate whether or not you want to enable Google Analytics.
5. Click **Create project**.
6. When your new project is ready, click **Continue**.

## Create a Realtime Database

To create a Firebase Realtime Database:

1. Within your Firebase project, click to expand the **Build** menu in the left sidebar.
2. Select **Realtime Database**.
3. Click **Create Database**.
4. Select your **Realtime Database location**. This is where your data will be stored.
5. Click **Next**.
6. Select your preferred security rules.\
   **Start in locked mode** - Your data is private by default. Client read/write access will only be granted as specified by your security rules.\
   **Start in test mode** - Your data is open by default to enable quick setup. However, you must update your security rules within 30 days to enable long-term client read/write access.
7. Click **Enable**.
8. Build your database to your specifications.

### Sample Realtime Database

Below is a simple example of a Firebase Realtime Database.&#x20;

<div align="left"><figure><img src="/files/evG6uHbZo14gVCVXFZLt" alt="" width="375"><figcaption></figcaption></figure></div>

## Connect Your Firebase Account to Thunkable

To connect your Firebase and Thunkable accounts, you need to locate two Firebase properties:

* API Key
* Database URL

These will need to be entered into Thunkable, so we recommend you have two browser tabs open, one for Firebase and one for Thunkable.

1. On your [Firebase console](https://console.firebase.google.com/u/0/), select your project.
2. Click the **gear icon** next to Project Overview.
3. Select **Project settings**.\
   ![](/files/1LaZVAf2ZzEDIqD0WNzF)
4. In the Your apps section, locate the web app's SDK code snippet.

   <div align="left"><figure><img src="/files/GWMXtl3af70G4uAA7FsQ" alt="" width="563"><figcaption></figcaption></figure></div>
5. Copy the **apiKey**.
6. In your Thunkable tab, click the **Settings gear icon** in the sidebar.
7. Scroll to the Firebase section and paste the apiKey into the Firebase **API Key** field.
8. Return to Firebase, and within the SDK code snippet, locate and copy the **databaseURL**.
9. Back in Thunkable, paste the databaseURL in the **Database URL** field.

## Video Tutorials

### How to Read Data in a Firebase Realtime Database

In this tutorial, you’ll learn how to read data from a connected Firebase Realtime Database.

{% embed url="<https://youtu.be/2TnfendzlBI>" %}

### How to Update Data in a Firebase Realtime Database

In this tutorial, you’ll learn how to update data in a connected Firebase Realtime Database.

{% embed url="<https://youtu.be/mY2omvP9oRM>" %}

## Related Docs

{% content-ref url="/pages/WIkJxydctAv4Z0IHKTHK" %}
[User Sign Up, Sign In, and Authentication with Firebase](/blocks/app-features/sign-in/sign-in.md)
{% endcontent-ref %}

***

{% hint style="success" %}
**Have feedback on this doc?** Please take a moment to share your feedback here: [Thunkable Docs Feedback](https://docs.google.com/forms/d/e/1FAIpQLSfCwn5L2xyla-LSLZX0DSWFcFeJ43qp-r1tELCacuVS2zduLA/viewform?usp=sf_link). Your valuable insights will help us improve and better serve you in the future.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.thunkable.com/blocks/blocks/variables-overview/connect-a-firebase-realtime-database.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
