Main content includes:
- What is Firebase?
- Firebase development history
- How does Firebase work?
- What kind of apps can be developed with Firebase?
- User guide to initialize Realtime Database and connect to Node-RED towards IoT programming for microcontrollers
- Firebase service price
1. What is Firebase?
Firebase is a platform for web and mobile app development, including simple and powerful APIs without the need for a backend or server.
Firebase is a cloud-based database service. Accompanied by an extremely powerful server system of Google. Its main function is to help users program applications by simplifying database operations. Specifically, simple API application programming interfaces. The aim is to increase the number of users and get more profits. In particular, it is also a versatile service and extremely good security. Firebase supports both Android and IOS platforms.
Firebase also provides a complete list of products to assist developers in their development. The two database options are Firebase's Firestore and Realtime Database. Likewise, Firebase allows you to make Cloud Media hosting easy. It also enables serverless application development through the integration of Cloud Functions.
2. Firebase Development History
Nearly a decade ago, Firebase was born with its predecessor Evolve. This is a simple platform that provides the necessary APIs to integrate chat functionality into the website. Besides the online messaging application, Evolve is also used by users to transmit and synchronize data for other applications such as online games, etc. Therefore, the founders have isolated the messaging system. online information and real-time data synchronization into two separate parts.
On that basis, in 2012, Firebase was born with the product provided as Backend-as-a-Service. Then, in 2014, Google acquired Firebase and evolved it into a multi-functional service used by millions of people to this day.
3. How does Firebase work?
a. Firebase Realtime Database
Like any IoT solution, Google Firebase can have inputs and sensors sending data directly into it, and a variety of client applications to view the data but Google Firebase also offers other features such as: file storage, machine learning, messaging, and server side functions.
When you sign up for an account on Firebase to create apps, you already have a real-time database. The data you receive is as JSON. At the same time, it is always synchronized in real time to all client connections.
For cross-platform applications, all clients use the same database. It is automatically updated with the latest data whenever the programmer develops the application. Finally, all of this data is transmitted over a secure SSL connection secured with a 2048-bit certificate.
In the event of a network outage, data is saved locally. So when there are any changes are automatically updated to the Firebase Server. Besides, for older local data with Server, it is automatically updated to get the latest data.
b. Freebase Authentication
The outstanding activity of Firebase is building user authentication steps by Email, Facebook, Twitter, GitHub, Google. Also anonymous authentication for applications. Authentication can help keep users' personal information safe and ensure that the account is not stolen.
c. Firebase Hosting
The final way Firebase works covered in this article is to provide hosting. Hosting is delivered via SSL security technology standard.
4. What kind of apps can be developed with Firebase?
Firebase is a fairly comprehensive and flexible platform. It allows users to develop the following types of applications:
- iOS.
- Android.
- Web.
5. User guide to initialize Firebase with Realtime Database and connect to Node-RED
1.Create a New Project Firebase
To begin log in with your Google account at https://firebase.google.com/, and select “Get Started”. I created a sample project called MyTest. After the project is created Firebase will give it a unique identifier name, such as: mytest-67e36.
note :Disable the Enable Google Analytics for this project option — this will not be needed this for this project. Finally, select Create project.
Firebase will begin setting up your project. Once completed select Continue, and you will be taken to your projects overview page on the Firebase console.
2. Set Authentication Methods
Next, You need to set authentication methods for your app.
“Most apps need to know the identity of a user. In other words, it takes care of logging in and identify the users (in this case, the ESP32). Knowing a user’s identity allows an app to securely save user data in the cloud and provide the same personalized experience across all of the user’s devices.” To learn more about the authentication methods, you can read the documentation.
There are several authentication methods like email and password, Google Account, Facebook account, and others. For testing purposes, we can select the Anonymous user (require authentication without requiring users to sign in first by creating temporary anonymous accounts). Enable that option and click Save.
3. Creating a Realtime Database
The next step is creating a Realtime Database for your project. Follow the next steps to create the database. On the left sidebar click on Realtime Database and then, click on Create Database.
Select your database location. It should be the closest to your location.
we are in Asian country so select that one.
Set up security rules for your database. For testing purposes, select Start in test mode. In later tutorials you’ll learn how to secure your database using database rules.
Your database is now created. You need to copy and save the database URL—highlighted in the following image—because you’ll need it later in your ESP32 code.
4. Get Project API Key
The Realtime Database is all set. Now, you also need to get your project API key.
To get your project’s API key, on the left sidebar click on Project Settings.
Copy the API Key to a safe place because you’ll need it later.
Now, you have everything ready to interface the ESP32 with the database.
6. Firebase service price
Firebase offers a free and usage-based service plan to its users. It also has a paid plan but no fixed and uniform pricing.
The plan offered for free is Spark, with 10 GB of storage, SSL, multiple Web sites, custom domains, and a few more services. It has some useful features like Firebase ML, Realtime Database, Cloud Firestore and Test Lab.