Firebase Tutorial || Complete Guide about Firebase

Firebase tutorial contains a complete guide about the firebase Like what is Firebase, Features of firebase, Pros and cons of Firebase, Enviourment setup for firebase.

What is Firebase

Firebase is a web and mobile application development platform created in 2011 by Firebase. Firebase then acquired by Google in 2014. Currently, the Firebase platform has 19 products which are used more than 1.5 million apps.

This means that Firebase is Google’s product which ensures quality, privacy, security, and maintenance. Overall, it is FREE

Firebase is also treated as a Backend-as-a-Service, and it is a real-time database that is basically designed for mobile applications.

Firebase can be used for iOS, Android, Web, or Unity. Firebase grew up into a rapid next-generation application development platform on GCP (Google Cloud Platform).

Firebase is a real-time database (a NoSQLjSON database) that allows storing a list of objects in the form of a tree. Data between different devices can be synchronized with this. It actually was the first product of Firebase.

Firebase progressed from Envolve. In 2011 Envolve was a startup founded by James Tamplin and Andrew Lee. Envolve provided developers an API which allowed the integration of online chat facility into their websites.

After releasing the chat service, it found that the envolve was also being used to pass application data, which were not chat messages.

Developers used Envolve to sync application to separate the real-time architecture and the chat system which powered it.

In September 2011, Tamplin and Lee then founded firebase as a new separate company. It was then finally launched to the public in April 2012.

Features of Firebase

Firebase has many features that make this platform beautifully essential. These features include cloud messaging, unlimited reporting, authentication, and hosting, etc. See below

Built-In Analytics

The analytics dashboard is one of the nicest features of the Firebase. It is free and can report 500 event types, and each with 25 attributes. The dashboard is top-notch for observing user behavior and measuring many user characteristics. Ultimately it helps us to understand how people use our app so that we can better optimize it down the line.

It has key features like – Unlimited reporting, Segmentation of audience, Integration with other services.

Easy App Development 

With Firebase, Developers can focus the time and attention on building the best possible applications for business. The operation is very strong and internal functions too.

They have nicely taken care of the Firebase Interface. Users can spend more time in developing high-quality apps that users actually want to use.

There are various features which the user can develop like – Cloud messaging, Authentication, Test Lab, Hosting, Remote configuration, Dynamic links, Crash reporting, Real-time database, & Storage

Growth and User Engagement

One of the most important aspects of application development is being able to create and engage with users over time.

Firebase has a lot of built-in features available. With the platform leading to commercial applications, it is really at the core of what makes Firebase so great.

Here are some of the user interaction aspects which make development a piece of cake:- AdWords, App Indexing, Invites, & Notifications.

Intensify Your Earnings

O! Really, the thing about having an app or any other business strategy is that we can surely increase our real earnings. With the feature of AdMob, we can monetize our application, considering the best possible user experience.

Showing real-time advertisements to millions of Google advertisers, choosing a format that suits our application to ease users, and working with more than 40 top ads networks using AdMob Mediation, we can make app development well worth it, while speaking silently with it.

Use of Firebase

  1. Firebase manages real-time data in the DB. So, it easily and quickly able to exchanges the data to and from the DB. Therefore, for developing mobile apps such as live streaming, chat messaging, etc., this can be used.
  2. It allows syncing real-time data across all the devices – iOS, Android, and Web – even without refreshing the screen.
  3. Firebase provides integration to Google Advertising, Data Studio, BigQuery DoubleClick, AdMob, Slack, and Play Store to develop our apps with efficient and accurate management and maintenance.
  4. Firebase includes everything from databases and analytics to crash reports. So, the application development team can continue their focus on improving the user experience.
  5. Applications of firebase can be deployed over a secured connection to the firebase server and it offers a simple control dashboard and a number of useful services to choose from.

Pros/Advantage of Firebase

  • It is known as a real-time database.
  • It has massive storage potential.
  • Firebase is serverless.
  • It is very secure and the most advanced hosted BaaS solution.
  • Its setup is very easy.
  • Via angular fire, it provides three-way data binding.
  • It also provides simple serialization of the application state.
  • We can easily access data, files, auth, etc.
  • There is no server infrastructure needed to power the applications with data.
  • It has JSON storage, which means there will be no barrier between data and objects.

Cons of Firebase

  • Firebase is not currently widely used, or battle-tested for enterprises.
  • Very limited querying and indexing.
  • It provides No Aggregation as a feature.
  • It has no any map-reduce functionality.
  • It cannot query or list users or stored files actually.

Firebase Environment Setup

NodeJS is the platform needed for Firebase development. If you are still willing to set up your environment for Node.js, you need the following two software available on your computer,

(a) Text Editor

(b) The Node.js installable binary.

You can download the archive of Node.js as per your current operating system needs.

Sample installation step on Linux are as follows –

Based on your available OS architecture, download and extract the archive node-v6.3.1-osname.tar.gz into /tmp, and then finally move all the extracted files into /usr/local/nodejs directory. For example:

$ cd /tmp
$ wget http://nodejs.org/dist/v6.3.1/node-v6.3.1-linux-x64.tar.gz
$ tar xvfz node-v6.3.1-linux-x64.tar.gz
$ mkdir -p /usr/local/nodejs
$ mv node-v6.3.1-linux-x64/* /usr/local/nodejs

Add /usr/local/nodejs/bin to the PATH environment variable.

export PATH=$PATH:/usr/local/nodejs/bin

Done. 

Similarly, you can check online the installation steps if you have other than Linux OS

Create Firebase Account – You can create the Firebase account from www.firebase.com

Create a Firebase App – Once login, you can create a new app from the dashboard page. Users can click the Manage App button to enter the app.

Below Steps are involved in the creation of a new project –

Step 2

Step 3

Create basic HTML/js App using Firebase

You just need to create a folder where your app will be stored or placed. Inside that folder, we will require index.html and index.js files. We will then add Firebase to the header of our app.

Index.html

<html>
   <head>
      <script src = "https://cdn.firebase.com/js/client/2.4.2/firebase.js"></script>
      <script type = "text/javascript" src = "index.js"></script>
   </head>
  
   <body>
 
   </body>
</html>

Use NPM or Bower

If you want to use your existing app, so you can use Firebase NPM or Bowers packages. Run one of the following commands from your apps’ root folder –

npm install firebase –save

OR

bower install firebase

Firebase Products

Build Application with Firebase

Cloud Firestore

Cloud Firestore is a flexible, scalable database for mobile, web, and server development from Google Cloud Platform and Firebase. Like Firebase Realtime Database,

It keeps your data in-sync across client apps through the Realtime listeners and also offers offline support for mobile and web apps so you can build responsive apps that work regardless of Internet connectivity or network latency.

Cloud Firestore also offers seamless integration with Google Cloud Platform and other Firebase products, including Cloud Functions.

ML Kit

ML Kit is a mobile SDK that brings Google’s machine learning expertise to Android and iOS applications in a powerful yet easy-to-use package.

Whether you are a new learner or experienced in machine learning, you can implement the functionality you want in just a few lines of code. There is no need to have great knowledge of neural networks or model optimization to get started.

On the other hand, ML Kit provides convenient APIs that help you use your custom TensorFlow Lite models in your mobile apps in case if you are an experienced ML developer.

Cloud Functions

For Firebase, it gives you the power to automatically run the backend code in response to events triggered by Firebase features and HTTPS requests.

Your code is stored in Google’s cloud and runs in a properly managed environment. There’s no need to manage and scale your own servers as it handles.

Authentication 

Most of the apps need to know the identity of a user to allows an app to securely save the user’s data in the cloud environment and provide the same personalized experience across devices.

Firebase Authentication provides backend services, easy-to-use SDKs, and ready-made UI libraries to authenticate users to your applications.

It supports authentication using phone numbers, passwords, popular federated identity providers like Google, Facebook and Twitter, and many more. It also leverages industry standards like OAuth 2.0 and OpenID Connect to integrate with a custom backend.

Hosting 

Hosting service of Firebase provides fast and secure hosting for your web applications, dynamic and static contents, and even the microservices.

Firebase Hosting is a production-level web content hosting for developers. With a single command, you can quickly deploy web apps and serve both static and dynamic content to a global CDNs.

You can also pair Firebase Hosting with Cloud Functions or Cloud Run to build and host microservices on Firebase easily.

Cloud Storage

Cloud Storage is built for app developers who need to store and serve user-generated content like photos or videos. Cloud Storage for Firebase is a cost-effective, powerful, simple and object storage service built for Google scale.

The Firebase SDKs for Cloud Storage adds Google security to the file uploads and downloads for your Firebase apps, regardless of network quality.

You can use our SDKs to store audio, video, images or other user-generated content. On the server, you can configure and use Google Cloud Storage, to access the same files.

Realtime Database

Realtime Database Store and sync data with our NoSQL cloud database. Data is synced across all clients in real-time and remains available when your application goes offline.

It Database is a cloud-hosted database. Data is stored as JSON and synchronized in real-time to each connected client.

When the user builds any hybrid or cross-platform applications with the Android, iOS, and JavaScript SDKs, all of your clients share a single Realtime Database instance and automatically receive the latest updates with the latest data.

Improve App Quality with firebase

Crashlytics 

It is the lightweight, real-time crash reporter which helps you track, prioritize, and fix stability issues that eat up your app quality.

Crashlytics save you troubleshooting time by intelligently grouping crashes and highlighting the circumstances that lead up to them and made easy for developers to present it.

Find out if any crash is impacting a huge no. of users. Get alerts when an issue suddenly increases the severity. Figure out which lines of code are causing crashes and this really a developer wants since long

App Distribution 

Firebase App Distribution makes distributing your apps to the trusted testers painless. By getting your apps onto testers’ devices quickly, you can get feedback quickly and often.

If you use Crashlytics in your apps, you’ll automatically get stability metrics for all your builds, so you know when you’re ready to ship and when to act on it.

Performance Monitoring 

Firebase Performance Monitoring is a service that helps you to gain insight into the performance characteristics of your Android, iOS, and web applications.

You can use the Performance Monitoring SDK to collect performance data from your app, then review and analyze that data in the Firebase console there itself.

Performance Monitoring helps you to understand when and where the performance of your app can be improved so that you can use that useful information to fix performance issues.

Test Lab 

Firebase Test Lab is a cloud-based app-testing infrastructure readily available. With one operation, you can test your Android or iOS applications across a wide variety of devices and device configurations, and see the results—including videos, logs, and screenshots—in the Firebase console.

Grow your Business with firebase

Analytics

Don’t you know this Google Analytics is a free app measurement solution that provides insight on app usage and user engagement? Google Analytics is at the heart of Firebase, a free and unlimited analytics solution.

The Analytics integrates across all the Firebase features and provides you with the power of an unlimited reporting feature for up to Five Hundred distinct events that you can define using the Firebase SDK with it.

Its reports help users to understand clearly how your users behave, which enables you to make informed decisions regarding performance optimizations and app marketing for business growth.

Extensions 

Firebase Extensions helps you to add/deploy functionality to your app quickly with pre-packaged solutions.

Once installed, a Firebase Extension performs a specific task or set of multiple tasks in response to HTTPS requests or to triggering events from other Firebase products, like Cloud Firestore or Firebase Cloud Messaging.

Predictions 

Firebase Predictions helps us and applies machine learning to your analytics data to create dynamic user segments based on your users’ predicted behavior.

These predictions are automatically available for use with Firebase Remote Config, the Notifications composer, Firebase In-App Messaging, and A/B Testing so, what else you need bro!

You can also export your app’s Predictions data to Google’s Big Query for further analysis or to push to other third-party tools.

Firebase A/B Testing

Firebase A/B Testing helps you to optimize your app experience by making it easy to run, analyze, and scale product and marketing experiments.

This clearly gives you the power to test changes made to your application’s Use Interface, features, or engagement campaigns to see if they actually move the needle on your key metrics like revenue and retention before you roll them out to wide audiences.

A/B Testing works easily with FCM so you can test different marketing messages, and with Remote Config so you can test changes within your app too.

Cloud Messaging 

Firebase Cloud Messaging (FCM) is a cross-platform messaging solution that lets you reliably send messages at no cost, I know mobile developers rarely need this introduction .

Using FCM, you can notify a client app that a new email, notification, or other data is available to sync. You can send notifications to drive user re-engagement and retention. For use cases such as instant messaging, a payload of up to 4KB can transfer to a client app through a message.

In-App Messaging 

Firebase In-App Messaging helps you engage your app’s active users by sending them contextual, targeted messages that encourage them to use key app features. For example, you could send an in-app message to get users to watch a video, subscribe, buy an item or complete a level.

You can customize messages as cards, modals, banners, or images, and set up triggers so that they appear exactly when they should benefit your users most.

Remote Config

Firebase Remote Config is a cloud service that lets you change the behavior and appearance of your app and doesn’t require users to download an app update.

When using Remote Config, you create the in-app default values that control the behavior and appearance of your application. Then, you can later use the Firebase console or the Remote Config REST API to override in-app default values for all the app users or for some segments of your user base.

Your app controls when updates are applied, and even it can frequently check for updates and then apply them with a negligible impact on performance.

Dynamic Links

Like Deep Linking – with Dynamic Links, your users can get the best available experience for the platform they open your link on. If a user opens a Dynamic Link on Android or iOS, they can be taken directly to the linked content in your native app.

If a user opens the same Dynamic Link in a desktop browser, they can be taken to the equivalent content on your website (if linked properly).

In addition to this, Dynamic Links work across app installs – if a user opens a Dynamic Link on Android or iOS and doesn’t have the app installed, he can be prompted to install it; then, after installation, the app starts and can access the link for which you were interested in and clicked on it.

App Indexing 

Firebase App Indexing gets your app easily into the Google Search. If users have your app installed in his device, they can launch your app and go directly to the content they’re searching for.

App Indexing reengages your app users by helping them find both personal and public content right on their devices, even offering query autocompletion to help them more easily and quickly find what they need.

If users don’t yet have your app, relevant queries trigger an install card for your app in Search results and then the user proceeds for install.

Best Practices

  • Avoid Nesting Data

You will get all of the child nodes when you fetch the data from Firebase. This is why deep nesting is not said to be the best practice and should be avoided.

  • Denormalize Data

When an app uses actually need deep nesting functionality, you can consider adding a couple of different collections; even when you need to add some data duplication and use more than 1 request to retrieve what you actually need.

How Firebase can help

Firebase can help us in various ways distributed in 5 areas of App – 

  1. Develop
    1. Authentication
    2. Database
      1. Realtime Database
      2. Cloud Firestore
    3. Storage – Grocery bucket that store
    4. Hosting – A fast with CDN centric
    5. Function – changing behavior of app
    6. ML Kit – A baby that can learn
  2. Quality
    1. Crashlytics 
    2. Performance 
    3. Test lab
    4. App distribution
  3. Analytics
    1. Demographic 
    2. Retention Rate
    3. Engagement
    4. Average Revenue
  4. Grow
    1. Predictions
    2. Cloud messaging
    3. In-app messaging
    4. Remote config
    5. A/B testing
    6. Dynamic links
    7. AdMob 
  5. Extension

Sample 

There are various ways to apply your knowledge and be trained in using the Firebase in any of its available products. But for now, I am sharing links of a couple of important samples which you should initially get hands dirty on. 

Realtime Database (Web sample) https://github.com/firebase/quickstart-js

Google Analytics (Android sample) https://github.com/firebase/quickstart-android

Firebase Storage (iOS sample) https://github.com/firebase/quickstart-ios

 

 

Leave a Reply

Your email address will not be published.

fifteen + nine =