Hi, I am pragadeesh, Today let’s just get started to code in FIREBASE, which is an awesome database. Let’s get into it.
Before creating a web app, let’s create a project in firebase console.
- Go to Firebase console and create a project, Here i have created a project with a name “sample”

- you will be then redirected to the project Dashboard.

- You can use firebase for building Android, iOS and web applications, for now let’s begin with web app, In future i will show you how to convert this web app to android and iOS using cordova.
- Now let’s get the firebase web SDK . Just click the option “Add firebase to web app”, a dialog box appears with SDK credentials which you will be using to configure with your web app.

- copy the script and add it in your Web app Script , Now you have integrated the firebase SDK to your web app and you’re ready to go. It’s simple right.
- Here’s the sample code
<!DOCTYPE html>
<html>
<head>
<meta name=”format-detection” content=”telephone=no”>
<meta name=”msapplication-tap-highlight” content=”no”>
<meta name=”viewport” content=”user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width”>
<title>Sample</title>
</head>
<body>
</body>
</html>
Add this to your script src tag “https://www.gstatic.com/firebasejs/4.3.1/firebase.js”
Create a script and add the below credentials
// Use your config instead of this one
var config = {
apiKey: “AIzaSyCuXlfTMDrC3rXdPb442CkMEwNhYqYHu-U”,
authDomain: “sample-c7c91.firebaseapp.com”,
databaseURL: “https://sample-c7c91.firebaseio.com”,
projectId: “sample-c7c91”,
storageBucket: “sample-c7c91.appspot.com”,
messagingSenderId: “219135436098”
};
firebase.initializeApp(config);
Note : In firebase SDK you will be adding a external file like https://www.gstatic.com/firebasejs/4.3.1/firebase.js , this is their SDK which will include all features like authentication, database and messaging etc.
To use a feature individually in your web app then you can use just their particular SDK for example
- Firebase App – https://www.gstatic.com/firebasejs/4.3.0/firebase-app.js
- Firebase Authentication – https://www.gstatic.com/firebasejs/4.3.0/firebase-auth.js
- Firebase Database – https://www.gstatic.com/firebasejs/4.3.0/firebase-database.js
- Firebase Messaging – https://www.gstatic.com/firebasejs/4.3.0/firebase-messaging.js
To use all this SDK to one, then you can use https://www.gstatic.com/firebasejs/4.3.1/firebase.js
Now your file should look like this.

In next post, let’s see how to write in database.
Leave a comment