# Firestore, Firebase Auth & Realtime DB

UI Bakery allows you to easily connect to Firebase Admin API with no need for additional layers like APIs or third-party services. It's possible to connect to **Firestore**, **Firebase Auth**, and **Firebase Realtime DB**.

In this article, we'll explore how you can [configure](#configuration) these data sources and [work](#usage) with them.

If you want to dive deeper and learn more about Firebase possibilities with UI Bakery, make sure to check out these articles:point\_down:

<table data-view="cards"><thead><tr><th data-type="content-ref"></th><th></th></tr></thead><tbody><tr><td><a href="firebase/realtime-database">realtime-database</a></td><td>Perform CRUD operations with Realtime DB &#x26; Firestore</td></tr><tr><td><a href="firebase/firebase-authentication">firebase-authentication</a></td><td>Provide authentication to your database in UI Bakery</td></tr><tr><td><a href="firebase/firebase-1">firebase-1</a></td><td>Connect from the client</td></tr><tr><td><a href="firebase/firebase-libraries">firebase-libraries</a></td><td>Connect Firebase libraries for more capabilities</td></tr></tbody></table>

## Configuration

### Prerequisites

Before connecting to your Firebase services, you will need to obtain one or several of the credentials listed below:

* **Firebase project ID**

Navigate to the Firebase console and copy the *project ID* of the required project.

<figure><img src="https://837703843-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUX6zPRMFFK0yrTghj7cY%2Fuploads%2FcvmOGPxBchqDq3MXtNCZ%2Fspaces_UX6zPRMFFK0yrTghj7cY_uploads_git-blob-edeac3fe5befb91121bfe391b6ff356aff33b77a_CleanShot%202023-03-27%20at%2017.35.31%402x.png?alt=media&#x26;token=d6967e9e-6ef5-4a14-839d-70a9d9ef3703" alt=""><figcaption></figcaption></figure>

* **Firebase database URL**

Navigate to your project and select Realtime DB in the left side menu - you'll need to copy the *project URL* there and save it for later.

{% hint style="info" %}
The URL pattern is `https://your_project.firebaseio.com/`.
{% endhint %}

* **Private key**

Navigate to *Project settings* > *Service accounts*. There, select **Firebase Admin SDK** and click **Generate new private key**.

<figure><img src="https://837703843-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUX6zPRMFFK0yrTghj7cY%2Fuploads%2FLIAfp0evb5aVlPAOApit%2Fspaces_UX6zPRMFFK0yrTghj7cY_uploads_git-blob-a562376abde993c9a4f907b67ce15b9f525b3148_CleanShot%202023-03-27%20at%2017.40.53%402x-min.png?alt=media&#x26;token=087a5c9a-6acc-41c6-959d-5ea4d354f499" alt=""><figcaption></figcaption></figure>

### Connecting the data source

Once you've obtained the necessary credentials, you can proceed to connecting the data source:

1. On the **Data sources** page, click **Connect**, and select *the necessary option* in the Data sources list - *Firestore*, *Firebase Auth*, or *Firebase Realtime DB*.
2. Next, specify the required credentials:
   1. For **Firestore**, specify the *private key* and the *project ID*.
   2. For **Firebase Auth**, specify the *private key*.
   3. For **Firebase Realtime DB**, specify the *private key* and the *Firebase database URL*.
3. Click **Test connection** to check whether the data source can be connected, and then click **Connect Datasource** to complete the setup.

## Usage

Once you've connected the data source, you can start interacting with its data. For this purpose, you can use the [Firebase Query](https://docs.uibakery.io/reference/working-with-actions/firebase-query) action step.
