Peeking into Google Firebase

Peeking into Google Firebase

·

8 min read

Firebase is undoubtedly one of the coolest technologies developed by Google. Few days back I participated in a hackathon for which I created and deployed a website on Firebase. I read so many blogs and spent so much time asking questions to chat gpt and searching for answers in stack overflow.
In this blog I am going to Compile everything for you so when you want to learn Firebase, you can refer to this blog.

What is Firebase?

Okay instead of bombarding definitions towards you, I just wanna give you an example. Imagine you are creating a website or let us say you are creating a startup that sells something, let us say cool t-shirts. So you are creating a website for that, just think what are the requirements of that website. If you even have a vague idea of web development, you can create a list of things required for this website. First of all Front end, I mean Imagine a website that doesn’t have a front end. Obviously you can’t Imagine any such, because no such websites exist. Then Comes backend, but think of what are the things you require in the backend. Firstly an authenticator system for your user, whenever the user login you have to check his email and password. You also need a database to store the data of your users as well as the products, you also want to update this data in real-time.
What else?

Storage??

To store the data or images for your user/website!!

What else??

You also want to send notifications/emails to your customers. So basically an email/notification sending system!!

And just in case you are trying to make a recommender system for your customers you also need Machine Learning( A very fancy term. Isn’t it? )

And finally, if I am not missing anything you also want to host your website.
Now, let us figure out how you will execute all these features on your website.

  1. Authentication: For this, you will need a database to store the data of your user. And if you’re a JS person, you will have to write code in Node, and Express and check the thing on the server side. In the case of Python, Django might help you. Search yourself for other languages :)

  2. Database: MongoDB, SQL, PostgreSQL, etc.

  3. Storage: Read this and you will realize it’s not that easy

  4. Email notification: Well there are multiple ways to send emails to your users but it’s not very easy.

  5. Machine Learning: Python 🫥

  6. Hosting How will you host your website? It depends upon your requirement, for free there is Vercel and Netlify. If you have cash, there are AWS and GCP also. (Azure Crying in the corner)

    Azure also.

This involves a considerable amount of work and you need a lot of knowledge to code this website.

But is there any other way?

Yes exactly as Obama said the problem is you are not using firebase. Then use it na.

So what is Firebase? Okh definition this time!

Firebase is a comprehensive platform developed by Google that provides a variety of tools and services for building and managing web and mobile applications. It offers a range of features that help developers handle various aspects of development, including backend infrastructure, database management, authentication, hosting, and more. So basically for web developers, Firebase is BaaS( Backend as a Service).

Firebase can solve all your problems and provides you with a platform to set up everything in one Place. You can use Firebase auth for authentication of your users. Firebase Realtime database/Firestore to store the data, Firebase Storage, Cloud Messaging (FCM), Hosting and the fancy term(ML). Firebase can help you build a fully functional website without writing much code.
Don’t ask me about the front end, that you have to do by yourself.

Creating Firebase Account

You’re a developer, you can figure that out.

Creating the project

Once, you have created the firebase account you have to create the firebase project where you will be getting all the backend services. You can create multiple firebase projects and implement the functions in that. You can also invite collaborators to work on that project.

Authentication

Firebase authentication is one of the easiest ways to authenticate users for your websites. You can write some functions given in docs of Firebase and you can set-up the authentication for your website.

You can create the authentication system by User email/password, user’s Google account, Facebook, Twitter(X btw), Microsoft etc.

Imagine doing this without Firebase, very hectic. You can also add email verification, SMS verification and multi-factor authentication.

You can also add a reCaptcha verifier before login.

All of this can be done simply by using some Firebase functions.

Realtime Database

Once you are done with authentication, I will suggest you to also store the information of your user in a realtime database, because if you want to use this information you won’t be able to access it from the authenticator. Keep in mind, that Firebase Database and Authenticator are two different things, you can’t connect these with each other. So if your user is creating an account in your website you should use the authenticator to authenticate their information upon login and should also store their information in a database so that you can access it in the future. And if you just want to know how will you know which user has logged in, so for that the authenticator returns a uid upon login/signup. You can use that uid to store the data of your user in the database.

Realtime database stores data in json format, so if you know JSON, this is a piece of cake.

It stores data in a tree-like structure so when you want to access the child you first have to know about the parent.

One of the biggest features that I see of Realtime database is when you want to perform operations offline. Yes it can do that.

Wanna write some code ? Read this

Firestore

Firestore is a cloud-hosted NoSQL database provided by Firebase. Firestore is designed to store and synchronise data for web and mobile applications. It offers a more advanced and feature-rich solution compared to the Firebase Realtime Database. Firestore offers more powerful and advanced querying and it is more scalable. And guess what it also offers real time updates like realtime database.

Hope this helped.

Write some code

Cloud Storage

Heard of google drive? Yep that’s what cloud storage is! You can store your videos/images/audios in the cloud storage and access it whenever required. It’s basically a google cloud product to store your files. Cloud storage for firebase provide you a SDK to upload and download files directly from Cloud bucket. Cloud Storage for Firebase lets you securely upload these files directly from mobile devices and web browsers, handling spotty networks with ease.

In my personal opinion, this feature is easiest to integrate into your website.

Here are the docs: Storage

The Fancy Term

Well if you don’t know Machine Learning, no worries. Firebase is here to help you.

Firebase ML provides developers with tools to integrate machine learning capabilities into their mobile and web applications without requiring in-depth knowledge of machine learning concepts.Whether you're new or experienced in machine learning, you can implement the functionality you need in just a few lines of code.

For example, You want to launch your website in china, you can’t translate your website, Firebase ML kit can.

Features in ML Kit

  • Text recognition

  • Face detection

  • Barcode scanning

  • Model Management

  • Image labeling

  • Landmark recognition

  • Language detection

  • Smart reply

  • Using custom TensorFlow Lite models

  • On-Device and Cloud APIs

Read Docs

Cloud Functions

It’s not free.

Still Reading??

You can pay??

Okh okh.

So basically Google Cloud function is also a service of Google Cloud platform that can be used through Firebase, for example you want to send email notifications to your customers, how can you do that??

Yes, that’s where cloud functions are used. You can trigger Google Cloud functions whenever required and they will perform the functions for you. You just have to create functions and deploy them.

Here’s how you can deploy:

firebase deploy --only functions

Hosting

Firebase is a Platform that provides you hosting services for free(Yay).

Firebase Hosting offers developers a robust and secure platform for hosting web applications, whether they contain static or dynamic content, as well as microservices. It provides a high-quality solution for hosting web content suitable for production environments. With just a single command, you can effortlessly and rapidly deploy web applications, making them accessible through a global content delivery network. Additionally, Firebase Hosting seamlessly integrates with Cloud Functions and Cloud Run, enabling you to create and host microservices within the Firebase ecosystem.

In Firebase, you can host your website and you get the domain for free(Given that it is available)

Here's How You Can deploy your website: Deploy Now

Okh, so more or less these are the features of Firebase. There are more Like :

  • Performance Monitoring

  • Crashlytics

  • App Distribution

  • AdMob

  • Firebase Extensions

  • etc......

In Conclusion, I just wanna say Firebase is cool if you want to create your backend fast and easily. You just need to know Firebase basic functions and you're good to go.

So what are you waiting for?

Get Started

I hope you enjoyed reading this blog! :)

Refrences