What is Firebase? Why and How to Setup Firebase?

What is Firebase?

Firebase is a real-time database using cloud technology. That permits you to make an application without server-side coding and Rest APIs. All the database related action will be managed by firebase. So, you just need to focus on the Front side. The rest of all the back end side will be managed by firebase services like user management, user authentication, database management, Synchronization of data, etc. We just need to do some settings on our website or mobile apps for using Firebase services. So, here in this article, we will be going to learn about how to setup firebase.

What Are The Advantages And Disadvantages Of Firebase Cloud Database?

Firebase Pros:

  • First of all, If your app does run of a centralized DB, and it is used by a lot of users and update data frequently – than Firebase is more capable of handling the Real-Time data updates between devices.
  • Your data will be stored in the cloud so it’s available anywhere.
  • Firebase is more suitable when you develop Cross-Platform API like Ionic, PhoneGap, Xamarin.
  • Finally, If you are storing lots of data, you don’t need to worry about hardware.

Firebase Cons:

  • First of all, Unless your app runs on one centralized database and your user base is vast than it’s overkill to update data.
  • The storage format of firebase is totally different from SQL, firebase uses JSON format so it’s not easy to migrate.
  • You won’t get any Reporting tools like standard SQL.
  • The cost of firebase is Limited to 50 Connections and 100mb of Storage.
  • If any small update comes from the firebase side then you need to update your app and Republish it.
  • It is not possible to send a push notification campaign using firebase.
  • Finally, Limited programming over server-side.

When to use Firebase?

Firebase database is useful when your app requires simple authentication like email, Facebook, google. And your product doesn’t require to provide API. the app doesn’t have large data to display. And there is no use of a complex query. Your application has a limited user base because firebase becomes costly when your user base is increased.

Here is the Best Example.

like simple chat App, Restaurant app, simple product listing app like Boneta, Chrono24.

When not to use firebase?

Firebase is not much use when your user base is vast, products provide API, products have a large amount of data. Then, there are no reporting tools available like SQL, and your app needs a complex query for the result than the firebase is not suitable for your application. The Example is Amazon, Flipkart, Uber.

Why firebase not feasible for Large applications?

  • Firebase downloads all subtrees on load so it’s cause some performance issue.
  • The problem with data migration.
  • The complex query is not possible to write
  • Not able to provide API for your product
  • A small update in firebase needs to change and publish your app again.
  • No Reporting tools available so you don’t have a chance to check the performance of a query.
  • Rest API of firebase cannot be implemented quickly
  • Custom code not supported by firebase
  • Suitable for Time application only

What other choice do we have?

  • Ionic Cloud: IonicDB is a secure, cloud-hosted, real-time database. It utilizes a JSON storage so you’ll already be comfortable working with data, and of course, we’ve already integrated it with Ionic Auth, so the only thing you need to focus on is what matters. They have not declared pricing, During the private access period, IonicDB will be free.
  • Microsoft Azure DocumentDB: Microsoft Azure DocumentDB is a NoSQL service for highly available, globally distributed apps. It provides native support for MongoDB wire protocol and Restful HTTP API.
  • Custom web app using MVC and SQL Server.
  • Meteor: Meteor is an open-source web development tool using Node.js to build a real-time application as this feature is there in its core. With Meteor you can develop frontend, backend and a database for Cross-platform application. Like Android, iOS and the web. A meteor is a development tool using web framework and MongoDB as backend there is no restriction in programming you can build anything, you can host app only using Meteor.
  • Deployd (Deployd is built on **Node.js** and **MongoDB**)
  • MongoDB
  • Parse server: Parse server is open source and provides self-hosting or parse hosting and also there is no limit for local testing and deploying. Parse server totally supports custom code and Has a huge relationship-based database, It also allows to send push notification campaign, there is no restricted time limit and no file storage limit. It’s developed by Facebook and suitable for General application.

Setup Requirement

You need to install node.js on your PC. And you need to sign up with firebase and create your application and Setup firebase with your application.

how to setup firebase

How to setup Firebase database in your mobile app?

Step 1: Include some javascript in your Index.html page

<script src=”https://cdn.firebase.com/js/client/2.2.4/firebase.js”></script>
<script src=”https://cdn.firebase.com/libs/angularfire/1.2.0/angularfire.min.js”></script>
<script src=”https://www.gstatic.com/firebasejs/live/3.0/firebase.js”></script> 

Step 2: Initialize Firebase using below code in your Index.html page

<script>
// Initialize Firebase
// TODO: Replace with your project’s customized code snippet
var config = {
apiKey: “<API_KEY>”,
authDomain: “<PROJECT_ID>.firebaseapp.com”,
databaseURL: “https://<DATABASE_NAME>.firebaseio.com”,
storageBucket: “<BUCKET>.appspot.com”,
messagingSenderId: “<SENDER_ID>”,
};
firebase.initializeApp(config);
</script> 

Step 3: Include firebase reference in the app.js file.

angular.module(‘mychat’,

[‘ionic’, ‘firebase’])

Step 4: Now you are ready for performing database action using firebase

The following code is for Insert data into firebase refer below code.

var playersRef = firebase.database().ref(“players/”);
console.log(“playersRef :” + playersRef);
playersRef.set({
Test Employee 1: {
number: 3,
age: 30
},
Test Employee 2: {
number: 4,
age: 27
}
}); 

Refer This link for More detail tutorial

https://www.tutorialspoint.com/firebase/firebase_write_data.htm

Conclusion | How To Setup Firebase

Firebase is realtime-database with facilitate online-offline sync and provide you with all backend facility.

It’s not enough feasible for a Large application. And you can use it for a small application which has less amount of user base and data.

For the latest tech news and reviews, follow Geeknous on TwitterFacebook, and subscribe to our YouTube channel.

Geeknous Staff

Geeknous Staff

The resident bot. If you email me, a human will respond.

Leave a Comment