What is Firebase and why it's worth getting to know it




Firebase is a cloud-based database that allows users to store and retrieve stored information, and has convenient tools and methods to interact with it.

Firebase stores text data in JSON format and provides convenient methods for reading, updating and retrieving data. Also, Firebase can help with registration and authorization of users, storage of sessions (authorized users), media files to which are easily accessible thanks to Cloud Storage.

Naturally, Firebase cannot be completely free. Some of the coolest functionality remains behind the scenes for those who do not want to pay. But the most basic and hotly demanded functions of registration, authorization and text storage are available to everyone after registration in the system.

Why do you need Firebase, because there are other databases ...

The only reason I was initially interested in Firebase was the flexibility and speed of deployment to the project.

Take a look: the programming languages ​​Python and JavaScript are flexible (and very popular) in themselves. Thanks to this, we (developers) get a powerful tool for creating a website, web application, mobile or even desktop application in the shortest possible time.

Firebase allows you to maintain this speed. There is no need to be distracted by some other things (creating a database, writing an API for receiving and receiving data). The entire server part falls on the shoulders of this service. Thanks to such a powerful tool, you can add the functionality of any module with reading, saving data and show the customer a functional example in one evening.

Well, if you have a small SPA application or a simple mobile application, where it all comes down to manipulating some text values, you can use Firebase as the main database. And you don't even have to pay.

Firebase dashboard

Moving on to practical acquaintance, let's feel everything with our hands. We'll take a look at what's inside the Firebase Developer Console, get familiar with some interesting methods, and send a couple of test requests. I will show examples in JavaScript in a project using Webpack and the npm package manager. The core is JavaScript, though, so don't be intimidated.

First you need to go to the website and register with Firebase. You can use your Google mail for quick registration.

Click on the big button “Add project”. Optionally, we connect Google Analytics. Perhaps (I do not know if this is still in the new version), you will be asked to select the location of the project, just select your country.

Inside the console, today we are only interested in 3 things: project settings, database and authentication. If my article interests you, then you can familiarize yourself with the rest of Firebase functions. I will leave all the links. For example, Storage is a storage for media files, but we will not work with it today.

Installation in a project in 60 seconds

There is a gear in the left menu, here we need the project settings. In the settings, we need configuration data. We will have to insert this data into our project.

Before adding this code to your project, you need to install Firebase in your application. This is done very easily with the command:

npm install firebase --save

On Mac or Linux, add sudo before npm.

P.S: If you do not take into account that the packages will be installed for about 3-4 minutes, the section header fully justifies itself. Well, it's true, it's quite possible to connect Firebase in 60 seconds.

And don't forget to add firebase to your project.


import firebase from 'firebase / app'

import 'firebase / auth'

import 'firebase / database'

import 'firebase / storage'

import 'firebase / messaging'


You can, of course, just add one line:

import firebase from 'firebase / app'

But then the weight of the source dist.js file, which is built using webpack for the prodaction version of the application, will be unrealistically large. Therefore, I just chose what is useful for me as an example.

Now we insert the code from the configuration and run the firebase.initializeApp () method, in the argument of which we add the config object. We do all this during the initialization (start of work) of your application. An example from my project:

example of setting a configuration to a project

That's all. Let's take a look at the full power of this tool. Now you can proceed to registering users.

Source: 





You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>