Firebase Firestore: Realtime Apps and Security Rules
A managed document database where the query limits shape your schema, the security rules are your only server, and every read is a line on the bill.
Firestore is a fully managed document database with two features that make it genuinely different from everything else in this programme: **realtime listeners**, which push changes to clients as they happen, and **Security Rules**, which let a client application talk to the database directly with no server in between.
Overview
The third thing to internalise: **Firestore's query language is deliberately limited, and the limits are the product.** There is no `OR` across different fields in the general case, no `JOIN`, no aggregation beyond count, sum and average, no full-text search, and only one range or inequality filter per query in the classic model. Every query is guaranteed to scale with the size of the *result set*, not the collection - which is why it is fast at any size, and why you must **design the schema around the queries you can actually express**. Denormalisation is not a performance optimisation here; it is the normal way to model.
Seven modules, about 75 hours. The capstone is a realtime chat application with offline support, membership rules and cost and load tests.
Introduction
**Use the Firebase Local Emulator Suite for everything you can.** `firebase emulators:start` runs Firestore, Auth and the Rules engine locally: no cost, no quota, instant resets, and - crucially - **it is the only sane way to test Security Rules**, because the rules unit testing library runs against it. Developing rules against a live project is slow, expensive and risky. The emulator is not a lesser version for learning; it is what professional Firestore development uses.
You also want a real Firebase project on the free Spark plan for Modules 5 and 6, because some things - billing alerts, App Check, real latency, actual index building - only exist in the cloud.
One note on which Firestore. Google offers **Firestore in Native mode** (what this course covers) and **Datastore mode** (the older API). Also note that Firestore now has an **Enterprise edition** with MongoDB API compatibility. This course is about Native mode, which is what "Firestore" means in practice.
What you will be able to do
- Set up a Firebase project and run the full Local Emulator Suite
- Explain collections, documents and subcollections, and the limits of each
- Use the client and Admin SDKs, and state the crucial difference between them
- Write queries within Firestore's constraints and name those constraints precisely
- Design composite indexes, and explain index fanout and its write cost
- Use collection group queries and know when they are the right tool
- Denormalise deliberately, and keep denormalised copies consistent
- Build realtime listeners and reason about their cost
- Use offline persistence, and explain what a pending write means for the UI
- Write transactions and batched writes, and explain when each applies
- Identify a hot document and fix it with a distributed counter
- State the per-document and per-collection write limits that bound a design
- Write Security Rules that enforce real authorisation, and unit test them
- Explain how the Admin SDK bypasses rules, and what follows for architecture
- Configure App Check, IAM, billing alerts and quotas
- Produce a cost model that predicts the bill before it arrives
What each level covers
5 levels · 7 lessons
-
Beginner - Foundations
The data model and the emulator; then queries, indexes and the denormalisation they force.
2 lessons 14 min of reading
Start with Projects, the Emulator, Collections and Documents → -
Intermediate - Application Behaviour
Listeners, offline persistence, and the write primitives - with the cost of each made explicit.
1 lesson 6 min of reading
Start with Realtime Listeners, Offline Persistence and Transactions → -
Advanced - Performance and Reliability
Hot documents, distributed counters and the real cost of a design; then what managed availability does and does not give you.
2 lessons 14 min of reading
Start with Hot Documents, Distributed Counters and Cost → -
Expert - Security and Production Architecture
Security Rules as the real backend, App Check, IAM, and quotas that cap the damage.
1 lesson 6 min of reading
Start with Auth, Security Rules, App Check and Quotas → -
Capstone
One realtime chat application, defended on rules, measured reads and a predicted bill.
1 lesson 6 min of reading
Start with Capstone - Realtime Chat with Offline Support →
Guides and articles
Longer reading about this subject, written alongside the course.
Before you start
- Node.js 20 or later
- Firebase CLI, and the Local Emulator Suite
- A Firebase project on the free Spark plan
- JavaScript, including promises and async/await
- The programme's shared foundations
Common questions
- What does the Firebase Firestore: Realtime Apps and Security Rules course cover?
- It is 5 levels and 7 lessons: Beginner - Foundations; Intermediate - Application Behaviour; Advanced - Performance and Reliability; Expert - Security and Production Architecture; Capstone. Each level ends with a quiz, and the last one is an exam over the whole course.
- How long does it take?
- About 46 minutes of reading and exercises - roughly 0.8 hours. It is self-paced with no cohort and no start date, so you can leave and come back and the site remembers where you were.
- What do I need to know first?
- Node.js 20 or later. Firebase CLI, and the Local Emulator Suite. A Firebase project on the free Spark plan. JavaScript, including promises and async/await. The programme's shared foundations.
- Is it free?
- Yes. Every lesson, example and quiz in this course is free to read, and you do not need an account to read them. Signing in only adds progress tracking and quiz results.
- What will I be able to do afterwards?
- Set up a Firebase project and run the full Local Emulator Suite. Explain collections, documents and subcollections, and the limits of each. Use the client and Admin SDKs, and state the crucial difference between them. Write queries within Firestore's constraints and name those constraints precisely. Design composite indexes, and explain index fanout and its write cost. Use collection group queries and know when they are the right tool. Denormalise deliberately, and keep denormalised copies consistent. Build realtime listeners and reason about their cost. Use offline persistence, and explain what a pending write means for the UI. Write transactions and batched writes, and explain when each applies. Identify a hot document and fix it with a distributed counter. State the per-document and per-collection write limits that bound a design. Write Security Rules that enforce real authorisation, and unit test them. Explain how the Admin SDK bypasses rules, and what follows for architecture. Configure App Check, IAM, billing alerts and quotas. Produce a cost model that predicts the bill before it arrives.