How to use Firebase Realtime DB (in-depth tutorial)

4

Index

Stats

6,091 visits, 10,960 views

Tools

Translations

This tutorial hasn't been translated.

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Published on 6 Jun, 2017. Last updated 19 Feb, 2019

So you are probably wondering how do I use firebase realtime database?

I'm going to teach you how to set it up!

Requirements:

1. Firebase Account (Link)

2. Construct 2 (Account type doesn't matter)

3. C2 Firebase Api 3 Plugin by Rex (Get it here)

4. C2 Firebase ItemTable Plugin by Rex (Get it here)

How to set up the firebase account:

1. Go to the link provided above

You'll see something like this:

2. Press the "Go to Console" Button and login with your email account

You'll see a screen like this once you've gone through the setup:

Now click "add project" (NOTE: You can only make 5 projects with the free version)

Once you have chosen your name and filled in the form and hit enter you should see these 3 icons:

Now leave the browser as it is and import the Firebase Api 3 and Firebase ItemTable plugins into your C2 Project.

Now you need to go into the properties of the Api 3 Plugin it's going to ask you for the following stuff:

Go back to your firebase account and click the "Add firebase to your web app" button and wait a few seconds for it to fully load up.

You'll Get something like this:

Now paste the api key into the correct field in c2, authDomain into the correct field, Database URL into the correct field and also the storage bucket into the correct field.

You are almost done setting up the project file,

The last step is to open the properties for the ItemTable plugin and remove the "items" text from the sub-domain field and leave it empty, this disables creating a new sub directory for the realtime db which affects reading the data back from the db.

Do this:

Congratulations You've now set up your database and the project file for using Firebase Realtime Database! In the next part of this tutorial I'll be going over how to read and write to a database, if you want to learn this then carry on reading but if you already know how to do this then you can stop! :)

  • 2 Comments

  • Order by
Want to leave a comment? Login or Register an account!