Skip to main content

Create Dashboards from a Firestore Database

💭 Would you like to go over this topic with an instadeq specialist?

📅 Book a Call Free of Charge

Firestore

NoSQL database built for global apps

Cloud Firestore is a NoSQL document database that lets you easily store, sync, and query data for your mobile and web apps - at global scale.

You can use Instadeq to create live dashboards, reports and make interactive analysis of your Firestore data.

Step 1 - Open Firebase Homepage

Go to https://firebase.google.com/ and create an account if you don't have one yet, then login and go to the main console.

/galleries/guide-images/firebase/1-firebase-home-page.png

Step 2 - Create a new Project

Select an existing project or create a new one.

/galleries/guide-images/firebase/2-create-project.png

In this example I will call it Flickr Photos and use geolocated data for photos uploaded to Flickr.

/galleries/guide-images/firebase/3-name-your-firebase-project.png

You can disable Google Analytics if it is a test project

/galleries/guide-images/firebase/4-disable-google-analytics.png
/galleries/guide-images/firebase/5-project-ready.png

Step 3 - Create a Firestore Database

Click on Firestore Database

/galleries/guide-images/firebase/6-click-on-firestore-database.png

Click on Create Database

/galleries/guide-images/firebase/7-create-new-firestore-database.png

Start in test mode only for the next 30 days, you should change this security rules before you share your dashboard.

/galleries/guide-images/firebase/9-start-firestore-in-test-mode.png

Select your desired location to create the Firestore Database

/galleries/guide-images/firebase/8-select-firestore-location.png

Step 4 - Create a Firebase Card on Instadeq

/galleries/guide-images/firebase/10-create-a-firebase-card.png

Step 5- Create a new app in Firebase

We need to create a new app in Firebase in order to access to our Realtime database from an external app.

/galleries/guide-images/firebase/11-create-a-new-app-for-firebase.png

You can name it Instadeq.

/galleries/guide-images/firebase/12-call-it-instadeq.png

Step 6 - Copy Firebase Configuration to Instadeq Firebase Card

Firebase will generate configuration properties that you need to copy to Instadeq Firebase Card.

We won't enable authentication for this test but we recommend you to read and configure Firebase Authentication.

Fill the configuration fields in API Keys Section.

You can disable "Require Authentication" in the Security Section (please enable authentication before sharing this dashboard).

/galleries/guide-images/firebase/13-copy-api-key.png

Step 7 - Allow Readmode for your Database

Allow read mode for your Firestore Database. This is for test purpouse only. Later you should configure more advanced security rules.

/galleries/guide-images/firebase/14-edit-firestore-rules.png

Step 8 - Create a collection and documents

Start a new collection. In this example, I call it photos.

Add a few documents to it. I added information about photos uploaded to Flickr with:

  • gender (number)

  • faves (number)

  • description (string)

  • title (string)

  • lat and lon (numbers)

  • owner (string)

  • season (number)

  • etc

/galleries/guide-images/firebase/15-create-firestore-collection-and-docs.png

Firestore Queries

Instadeq has an internal Firestore Query Parser for the Query field.

You can write multiple condition using the WHERE condition separated by 'and', ORDER BY fields and/or LIMIT the results.

FROM "collection1"
WHERE a == 4 and b != "hello" and c < 4.5
ORDER BY a, b DESC, c ASC
LIMIT 5

Go to General tab and select:

  • Database Type = Firestore

  • Query Type = Run Once

  • Query = Your desired query

When ready select Apply.

/galleries/guide-images/firebase/16-query-firestore-database.png

Query Types

We have different types of queries:

  • Run Once: The query runs only when the deck or dashboard are loaded

  • Subscribe to Changes: Every time that you add a new document that applies to the query, Instadeq Firebase Card will update the data

  • Run on Intervals: The query runs when the deck or dashboard is loaded and later on the interval of seconds configured.

Advanced Queries

To query Collection Groups, use COLGROUP:

FROM COLGROUP "collectionGroupName"
WHERE a >= 4

To get an specifict Document:

FROM DOC "documentID"

Instadeq will parse your query and send it to Firestore as explained in Firestore Query Documentation.

obj.
    .collection("collection1")
    .where("a", "==", 4)
    .where("b", "!=", "hello")
    .where("c", "<", 4.5)
    .orderBy("a", "asc")
    .orderBy("b", "desc")
    .orderBy("c", "asc")

We have a Playground to test different queries.

Firestore Errors

In the tab Error you can find any error parsing the query, Firestore indexes missing, permission problems, etc.

/galleries/guide-images/firebase/16-firestore-errors.png
/galleries/guide-images/firebase/16-firestore-errors-query.png

Step 9 - Check data appears on Instadeq

Check the results of your query appears on the Output tab

/galleries/guide-images/firebase/17-query-result-will-appear-on-instadeq.png

Step 10 - Build your live Dashboard

Now you can follow our guides, videos or use our templates to create a live no-code dashboard using the data from Firestore.

/galleries/guide-images/firebase/18-live-dashboard.png

💭 Would you like to go over this topic with an instadeq specialist?

📅 Book a Call Free of Charge