This blog is about what Firebase is, what you can use it for, and how to set it up.
I. What is Firebase?
Firebase is a NoSQL database that allows users to store data in key and value fields. Firebase supports authentication, where users can sign in using a variety of authentication services. Another great feature of Firebase is its support for a real-time database. The real-time database allows for fast hosting and isn’t too difficult to set up.
II. Setting Up Firebase
Navigate to: https://firebase.google.com/
You’ll need to log in using your Google account. In the top right of the screen, you’ll see ‘Go to Console’. If you press that, you’ll be redirected to a page where you can see your projects or add new ones. When you press ‘Add a Project’, you’ll be instructed to give your project a name. I often name my projects the same as the code repository I’m working with, just to keep myself organized, but this is not a requirement. Once you’ve named your project, you can have to option to enable Google Analytics. Google Analytics could be helpful if you want to track activity.
Once your project has been created, you can see on the left navbar, under ‘Build’, a list of features you can add to your project.
Authentication is the first Firebase feature you could add to your project. It’s very easy to add authentication and authorization to your projects using Firebase, so I’d certainly recommend checking out its authentication features.
To get started, click ‘authentication’ and then ‘get started.’ This will bring you to a list of sign-in methods you can add to your project. You can have people sign in using an email and password, Google account, social media account, and much more. Click the sign-in methods you’d like. I won't go into how to implement the sign-in features into your app, but I’ll post some resources at the bottom.
IV. Cloud Firestore
One of Firebase’s coolest features is their Firestore database which makes it easy to add models to your apps. To get started, click “create database”. You’ll then be asked whether you’d like to start your database in production mode or test mode. You can start in test mode if you’re just learning. Just note that your database will be unable to be accessed in 30 days if starting in test mode.
Once your database is set up, you can manually add collections such as users or watch a tutorial on how to link it up to your app. An important point to note with Firebase is that it will ask you to put your Firebase keys and tokens in a file in your app. When you do this, make sure you put your Firebase information in a .env file for security reasons and you can use the dotenv NPM package to export out important information.
Firebase can be a convenient way for you to add authentication and a minimal backend to your project. Check it out!
Save the date - Google I/O returns May 18-20. Register to get the most out of the digital experience: Build your…