What's the difference between Firestore and the Realtime Database?
Short Answer
Firestore is a newer, document/collection-based database with richer querying, automatic multi-region scaling, and better offline support; the Realtime Database is a simpler single JSON tree, cheaper for very high-frequency small writes but with weaker querying.
Firestore organizes data into documents (JSON-like objects) grouped into collections, and supports compound queries, indexing, and pagination natively. It scales horizontally across regions automatically and its offline persistence layer is more robust — queries work offline and sync seamlessly when reconnected.
The Realtime Database stores everything as one large JSON tree. It's historically been favored for use cases needing extremely low-latency, high-frequency updates (like live cursor positions or presence systems) because its WebSocket-based sync can be marginally faster for tiny, frequent writes, and its pricing model (bandwidth-based) can be cheaper at that specific workload shape. For most new apps, Google now recommends Firestore by default unless you have that specific high-frequency-small-write profile.
Common Mistakes
- ×Assuming Realtime Database is deprecated — it isn't, it's just recommended for narrower use cases now.
- ×Trying to run Firestore-style compound queries against the Realtime Database's flatter query model.
Related Questions
How do you implement Firebase Authentication in Flutter?
Add the `firebase_auth` package, initialize Firebase in `main()`, then use `FirebaseAuth.instance` to sign users in (email/password, Google, etc.) and listen to `authStateChanges()` to react to login/logout across the app.
What is Firebase Remote Config used for?
Remote Config lets you change app behavior and appearance — feature flags, A/B test variants, default values — without shipping a new app release, by fetching key/value parameters from the Firebase backend at runtime.