Firebase for Mobile Apps: A Beginner's Guide
Firebase is Google's suite of backend services that lets indie developers ship production-grade features without running their own servers. I have used it on dozens of apps — including the ones in our own store — and this guide is the mental model I wish someone had handed me before the first project: what each product is for, when you actually need it, and the pricing traps that catch beginners.
Authentication — Identity Done Right
Email/password, Google sign-in, phone OTP, and anonymous auth are all a few lines of code away with Firebase Authentication. It also links accounts — a user can sign up with email and later sign in with Google, keeping one identity. Start every app that needs accounts here; it also powers security rules in the database.
Enable anonymous auth early even if you do not expose it in the UI. It lets users try your app before creating an account, and later you can upgrade the anonymous session to a real account without losing their data — the smoothest onboarding you can build.
Cloud Firestore — The Flexible Database
Firestore is a NoSQL, real-time, serverless database. Data is stored as documents in collections, and your security rules decide who can read and write what. Because it streams updates live, it is perfect for chat, collaborative apps, and dashboards. Its offline support means the app still works on a flaky connection and syncs when back online.
Design your data shape around your screens, not around relational normalization. Duplicating data across documents is normal in Firestore — a "posts" collection and a "user profiles" collection that share display fields are fine. Write security rules that are least-privilege by default and test them with the rules simulator before launch; a misconfigured rule is a silent data leak.
Cloud Storage
User-generated content — profile pictures, media, uploads — belongs in Cloud Storage. You can enforce file types and sizes, restrict access with the same security-rule language as Firestore, and generate resumable uploads so big files survive bad connections.
Set a download URL pattern that includes the upload time or a UUID, and think about cleanup: Firebase Storage charges for storage, so a "delete account" flow should also delete the user's stored files, or you pay forever for abandoned content.
Analytics and Crashlytics
Analytics is free, unlimited, and the backbone for every other Firebase decision — it tells you where users come from and what they do. Crashlytics reports every crash with stack traces grouped by severity, so you fix what breaks most users first. Enable both on day one; retrofitting analytics is painful.
Beyond the defaults, log the five or six custom events that map to your funnel: signup_started, signup_completed, first_purchase, and so on. Analytics without custom events is just vanity numbers. Define the events when you define the screens, not after launch.
Cloud Functions — Logic Without a Server
When you need server-side logic — sending emails, processing payments, reacting to database events — Cloud Functions runs JavaScript/TypeScript in response to triggers. It scales to zero, so you pay nothing when idle. Use it for operations that must not run on the client, like validating a purchase receipt server-side.
The cold-start tradeoff is real: a function that has been idle for a while can take a second to spin up. Keep functions small, set memory to the minimum you need, and reserve heavy cold-start operations for background tasks rather than user-facing requests.
Remote Config and In-App Messaging
Remote Config changes your app's behavior without a store release — flip feature flags, adjust prices or content A/B. In-App Messaging shows targeted banners and surveys to specific user segments. Together they turn a static release into a dynamic experiment.
Use Remote Config for your ad placement timing and your subscription price points. Being able to change an interstitial frequency or a monthly price from a dashboard, without waiting for store approval, is a superpower for a small team running monetization experiments.
Pricing Traps to Avoid
- Firestore charges per read/write — a poorly indexed dashboard query that scans collections on every load will surprise you on the bill.
- Cloud Functions, Storage and messaging have free tiers, but usage adds up; set budget alerts in the Firebase console from day one.
- Your Spark (free) plan stops serving above quotas — apps that spike during a launch event can go read-only at the worst moment. Know your quota headroom before a big push.
When Not to Use Firebase
The honest advice: Firebase is not always the right backend — complex relational data and heavy server-side computation might suit a traditional stack. But for the vast majority of mobile apps, Firebase lets a small team ship a secure, scalable product in weeks instead of months. Start with it, outgrow it deliberately if you ever need to, and you will have shipped in a fraction of the time a bespoke backend would have cost.