Introduction
I recently attempted to create a simple chat application to explore Firebase's capabilities. The free tier was not what I had anticipated...
What is Firebase?
Google's BaaS (Backend as a Service) product is called Firebase. It contains several helpful services for which developers frequently need to create a lot of code. For instance, you only need a few lines of JavaScript to implement User Authentication (Sign in with Google, Email/Password, Anonymous, etc.)! It offers a wide variety of additional services, including Firestore & Realtime Database (databases), Storage (user content storage), Hosting, Cloud Functions, Machine Learning, and much more.
My Experiences
Note: Firebase has two plans, a free tier (Spark Plan) and a pay-as-you-go tier (Blaze Plan). I used their free tier, and that is what I am basing this blog on. You can look at the plans here.
Limitations
I used Firebase's free tier rather than the Firebase Blaze plan, as was previously noted. It's the most generous plan I've ever come across. You receive 20,000 writes and deletes per day and 50,000 readers per day using the Firebase Firestore Database. With Firebase Authentication, you can choose to use any of the following methods for free, Email/Password, Anonymous, Sign in with Google, Facebook, Google Play Games, Apple, Apple Game Center, GitHub, Microsoft, Twitter, and Yahoo. You are also allowed 50,000 monthly active users! All-in-all I did not consider the free tier to be limiting in any way.
Security
Firebase has a lot of different security features. For instance, if Firebase Authentication is configured, you can use Firebase Firestore Security Rules to verify a User's credentials and the data to which they have access to. Addiontially, only the websites you specify can work with your Firestore database.
Firebase Firestore Database
I utilized Firebase Firestore to store all the chat rooms and messages for the simple chat app I created. I found it quite simple to adhere to its daily write cap of 50K. Additionally, I appreciated how simple it was to set up, receive, and push data to and from it. I also appreciated how it operated using only plain JavaScript and did not require a backend language. The database queries, on the other hand, were a little challenging for me to use and understand. Writing security rules for my particular needs proved to be fairly difficult for me as well. However, the get()
can only be used to retrieve data from Firebase's Firestore database (not any of the other databases), this made my life a little bit easier. The usage of async/await by Firestore was something else I didn't like because it had strange side effects in my code, including arrays being filled with data before the await function even ran.
Firebase Authentication
To authenticate my users and ensure they could only access the chat rooms they were authorized to access, I utilized Firebase Authentication. It was far simpler to set up than Firestore. Although there were many more options for login, I just used Sign in with Google. And since I just shared the chat app link with a small number of individuals, the restriction of 50K monthly active users was really simple to meet. Additionally, I had no trouble integrating Authentication into my chat app. I had a positive experience with authentication; it had no drawbacks in my opinion.
Conclusion
Thank you for reading this article on my experiences with Firebase! Let me know your thoughts on Firebase in the comments.