These are my personal study notes from learning and working with Cloud Firestore. They collect the core concepts, JavaScript examples, security decisions, and practical checks I want to keep in one dependable reference.
The notes use the Firebase modular JavaScript SDK and focus on Firestore for web applications. They begin with documents and collections, then build through writes, queries, data modeling, Security Rules, offline behavior, testing, and production operations.
This repository records what I study and practice while working with Firestore. Each chapter explains a core idea in plain language, then connects it to practical JavaScript examples and common decisions made in an application.
The examples use fictional records and project names. Firebase web configuration identifies a project but does not protect data. Client access must be controlled by Security Rules, and privileged server work must be protected with server-side authorization and IAM.
- Firestore projects, databases, locations, and the JavaScript SDK
- Collections, documents, paths, field types, and references
- Creating, updating, deleting, and batching writes
- Reading documents, filtering, ordering, and query limits
- Indexes, cursors, pagination, and real-time listeners
- Transactions, atomic batches, and concurrent changes
- Security Rules, authentication, and field validation
- Data modeling, subcollections, denormalization, and cleanup
- Offline cache, synchronization, aggregation, and summaries
- Emulator testing, performance, cost, operations, and release checks
-
Firestore fundamentals and database setup Understand what Firestore is, how databases and projects relate, and what to decide before creating a database.
-
JavaScript SDK and project configuration Install the modular SDK, initialize Firestore once, and select the right Firebase project for each environment.
-
Documents, collections, fields, and paths Read Firestore paths and learn how documents, collections, fields, and subcollections fit together.
-
Data types, field values, and references Choose suitable field types for dates, arrays, maps, references, and server-generated values.
-
Create, update, delete, and write patterns Add and change data with document references, merge options, field transforms, and safe delete flows.
-
Reading data and building queries Fetch one document or a query result and build clear filters, ordering, and bounded reads.
-
Query indexes, pagination, and listeners Understand index requirements, cursor pagination, live snapshots, and listener cleanup.
-
Transactions, batches, and concurrency Choose between a transaction and a batch, handle concurrent updates, and keep atomic work reliable.
-
Security Rules, authentication, and validation Restrict client reads and writes with ownership checks, field validation, and emulator tests.
-
Data modeling, relationships, and cleanup Model related records with subcollections or references and plan duplication and deletion behavior.
-
Offline data, cache, and conflicts Understand local reads, cached queries, pending writes, synchronization, and web persistence choices.
-
Aggregation and summary data Count and summarize matching records while balancing current values, query cost, and maintained counters.
-
Import, export, backups, and retention Plan data movement, managed backups, retention, and safe restore checks.
-
Emulator, Rules testing, and debugging Run the Firestore emulator, test allowed and denied access, and investigate rule and query failures.
-
Performance, cost, and scalability Reduce unnecessary reads, design for indexes and contention, and monitor usage as data grows.
-
Production operations and release checklist Review environments, access, monitoring, recovery, and the checks that protect a production release.
- All code samples collects JavaScript and Rules examples from the core chapters.
- Complete questions and answers gathers review questions from all core chapters with clear answers.
Read the chapters in order when learning Firestore, or open the section that answers a question from your current project. Try examples with fictional data and use the Firestore emulator to check Security Rules before applying them to a live database.
- Cloud Firestore documentation
- Firestore data model
- Add and update data
- Read and query data
- Firestore Security Rules
- Firestore offline data
- Firestore pricing
- Portfolio: https://www.ashishranjan.net
- GitHub: https://github.com/a2rp
- CodePen: https://codepen.io/ash1198
- LinkedIn: https://www.linkedin.com/in/aashishranjan
- Facebook: https://www.facebook.com/theash.ashish/
- YouTube: https://www.youtube.com/@ashishranjan-ashz?sub_confirmation=1
- Email: mailto:ash.ranjan09@gmail.com
- Support: https://a2rp-donation-page.netlify.app/
- Buy Me a Coffee: https://buymeacoffee.com/ashishranjan
- Patreon: https://www.patreon.com/ashishranjan