Firebase Databases are real-time. As soon as we modify the data in the firebase database, it will reflect in the client app immediately without refreshing the page. It works with Android app OS apps and web apps.
Step 1
To start with Firebase, you must have a Google Account. You should sign in with your Google account.
Step 2
After logged in successfully, click on Firebase Console.
Step 3
Here you can see all the projects that you have created. Click on Add new Project.
Step 4
Give your project a name. I am giving the name “AngularCRUD” so that I can use this one later on. Click on continue.
Step 5
Choose Default account for Firebase, or if you want to create a separate account, then you can create it.
Step 6
After selecting, click on Create Project.
Step 7
After finishing the setup, click on Continue.
Step 8
After finishing, you can see a project overview page of Firebase. Over there, click on "</>" to add Firebase in our web, you can choose iOS or Android.
Step 9
Now add Firebase to the web app. For that, we want to give a name. Here, I will use "Angular_crud" click on the ckeck box and register it .
Step 10
Now add Firebase to the web app. For that, we want to give a name. Here, I will use "Angular_crud" click on the check box and register it.
Step 11
You can see our Angular CRUD is showing in our Angular CRUD project. Also, you can see the features provided by Firebase, such as
Authentication, Database, Storage, Hosting, etc. For this article, we will see its database creation, so click on the Database menu on the left side of it.
Step 12
Click on the Database menu on the left side of the Firebase. Then the database screen will pop up.
Step 13
If you want to create Cloud Firestore, then Go to Cloud Firestore and click on Create Database.
Step 14
Then the security rules for the Cloud Firestore screen will appear, click on 'Start in test Mode'. Enable it, and then we can see the Cloud Firestore screen over there collections of records are there.
Step 15
If you want to create a Realtime Database, go to real database and click on it.
Step 16
The below image shows some security rules which I will select to start in test mode so that it will allow us to read and write to our database.
Step 17
Now we have successfully created the realtime database, as you can see it in the below image.
Step 18
We can add in the collection as a name-value pair as shown in the below image.
Summary
In this article, we have seen how to set up a real-time database in Firebase. In my next article, we will learn about CRUD operations using Angular 9 with Firebase.