Firestore, Firebase Auth & Realtime DB
Last updated
Was this helpful?
Last updated
Was this helpful?
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 these data sources and with them.
If you want to dive deeper and learn more about Firebase possibilities with UI Bakery, make sure to check out these articles
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.
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.
Private key
Navigate to Project settings > Service accounts. There, select Firebase Admin SDK and click Generate new private key.
Once you've obtained the necessary credentials, you can proceed to connecting the data source:
On the Data sources page, click Connect, and select the necessary option in the Data sources list - Firestore, Firebase Auth, or Firebase Realtime DB.
Next, specify the required credentials:
For Firestore, specify the private key and the project ID.
For Firebase Auth, specify the private key.
For Firebase Realtime DB, specify the private key and the Firebase database URL.
Click Test connection to check whether the data source can be connected, and then click Connect Datasource to complete the setup.
To get a list of your collections, you need to select your Firestore data source from the list of data sources and select the Firebase Query action type. Choose Get collection list as the Firestore method and provide the Parent document ID or leave it blank for top level collections.
To query Firestore, you need to select your Firestore data source from the list of data sources and select the Firebase Query action type. Choose Query as the Firestore method and specify your collection name. You can filter your query by values, add limits, and add ordering by a certain field.
To get a document by ID, you need to select your Firestore data source from the list of data sources and select the Firebase Query action type.
Choose Get document by ID as the Firestore method and specify the collection name and document ID. Document ID can receive dynamic values passed in {{}}
.
To update a document, you need to select your Firestore data source from the list of data sources and select the Firebase Query action type.
Choose Update document as the Firestore method. Specify the collection name, document ID and the objects that need to be updated. Document ID and values can receive dynamic values passed in {{}}
.
To insert a document, you need to select your Firestore data source from the list of data sources and select the Firebase Query action type. Choose Insert document as the Firestore method. Since the pattern of document insert is the same as for updating a document, you can leave the document ID blank, and Firestore will generate it automatically.
To delete a document, you need to select your Firestore data source from the list of data sources and select the Firebase Query action type.
Choose Delete document as the Firestore method and only provide the document ID. Document ID can receive dynamic values passed in {{}}
.
To query a collection group, you need to select your Firestore data source from the list of data sources and select the Firebase Query action type. Choose Query collection group as the Firestore method and specify your collection name. You can filter your query by values, add limits, and add ordering by a certain field.
With UI Bakery, you can manage your users from the Firebase Auth setup, namely view, update, create new and delete existing users.
To get a list of your users, you need to select your Firestore Auth data source from the list of data sources and select the Firebase Query action type. Choose List users as the Firebase Auth method. You can limit the number of returned users if necessary.
To get a certain user by their UID, phone number or email, you need to select your Firestore Auth data source from the list of data sources and select the Firebase Query action type. Choose Get user by UID/ email/ phone number as the Firebase Auth method.
To create a new user, you need to select your Firestore Auth data source from the list of data sources and select the Firebase Query action type. Choose Create user as the Firebase Auth method and provide a user object.
To update user's information, you need to select your Firestore Auth data source from the list of data sources and select the Firebase Query action type. Choose Update user as the Firebase Auth method and specify user's UID and the update object.
To delete a user, you need to select your Firestore Auth data source from the list of data sources and select the Firebase Query action type. Choose Delete user as the Firebase Auth method and specify user's UID.
To enable additional filtering options, turn on the Use ordering toggle. The following filters are available:
Ordering by child, key, value, or priority
Ordering by limit (limit to first/ limit to last)
Filtering queries with equalTo
, startAt
, endAt
In Firebase databases, you can use two approaches to updating data:
set
rewrites the current values of an item
update
updates the required values of an item, but doesn't rewrite all the values of an object
To use the set
method, select it from the action dropdown, specify the database ref and the data object.
To use the update
method, select it from the dropdown, specify the database ref and the data object.
To append data to a list, you need to select your RealtimeDB data source from the list of data sources and select the Firebase Query action type. Choose Append data to a list as the Realtime database method and specify your database ref and the data object.
To query Realtime DB, you need to select your RealtimeDB data source from the list of data sources and select the Firebase Query action type. Choose Query as the Realtime database method and specify your .
Perform CRUD operations with Realtime DB & Firestore
Provide authentication to your database in UI Bakery
Connect from the client
Connect Firebase libraries for more capabilities