How to NOT get a 30K Firebase Bill

TL;DR
Startup faced $30k bill due to incorrect Firestore query setup, reduced to $25 by optimizing client and server-side code.
Transcript
imagine if you woke up one day and you're fired based bill went from zero to thirty thousand US dollars well that's exactly what happened to a start-up in Colombia that scaled up to about two million daily active users they really just made one seemingly minor mistake and with this video I want to show you how we can take their thirty thousand doll... Read More
Key Insights
- 🫠Efficient optimization of client-side code using RxJS can significantly reduce document reads in Firestore.
- 🛟 Utilizing Firebase Cloud Functions for server-side processing can help in managing data efficiently and reducing billing costs.
- 😫 Setting up billing alerts on Google Cloud Platform for Firebase projects is essential to monitor and detect billing spikes early.
- 🫠Optimizing reads versus writes balance in Firestore can lead to significant cost savings.
- 🫠Proper aggregation of data can reduce document reads and improve UI performance.
- 😒 The use of Firebase Cloud Functions in conjunction with Firestore can streamline data processing.
- 🆘 Anticipating pricing scenarios in Firestore can help in planning and optimizing costs effectively.
Install to Summarize YouTube Videos and Get Transcripts
Explore YouTube Video Summarizer or Get YouTube Transcript Extractor
Questions & Answers
Q: How did a startup end up with a $30k Firebase bill?
The startup made a mistake by calculating the total for every crowdfunding campaign by reading every single document in a collection for every user on the site, resulting in a massive number of document reads.
Q: What is the key takeaway for Firebase billing optimization?
Setting up a billing alert on Google Cloud Platform for a Firebase project can help detect billing spikes early, but optimizing the code is crucial to reduce costs significantly.
Q: What client-side optimization technique was used to reduce document reads?
By using RxJS to share a single observable for calculating the total and average amounts, document reads were reduced from 300 to 100, making the code more efficient.
Q: How did server-side optimization help in reducing costs?
By using Firebase Cloud Functions to update an aggregated document with essential information, only one document read was required instead of multiple reads, drastically lowering the bill.
Summary & Key Takeaways
-
Startup faced $30k bill due to inefficient Firestore query setup.
-
Mistake: Calculating total for every crowdfunding campaign by reading every document.
-
Solution: Optimize client-side code using RxJS & server-side using Firebase Cloud Functions to reduce bill to $25.
Read in Other Languages (beta)
Share This Summary 📚
Summarize YouTube Videos and Get Video Transcripts with 1-Click
Try YouTube Summary with ChatGPT & Claude or YouTube Transcript Generator
Explore More Summaries from Fireship 📚






Summarize YouTube Videos and Get Video Transcripts with 1-Click
Try YouTube Summary with ChatGPT & Claude or YouTube Transcript Generator