Firebase PlaygroundFirestore simulator · 23 lessons · No account needed
1 / 23
Getting StartedAdd your first document

addDoc() adds a new document to a collection with an auto-generated ID. You pass a CollectionRef (from collection(db, "name")) and a plain JavaScript object — Firestore stores it as a document.

Each document lives at a path like users/{autoId}. The returned reference contains the generated id so you can refer to the document later.

Lesson Code
Ctrl+Enter
Console Output
Click Run to execute the code
Key takeaways
  • `addDoc()` auto-generates a unique document ID
  • The first argument is a CollectionRef, not a string path
  • The returned ref gives you the generated ID immediately
1 / 23

Firebase Playground — Learn Firestore in Your Browser with a Full Simulator

Updated May 21, 2026
Share & Support

What's included

Features

Complete in-browser Firestore simulator — all operations run locally, no Firebase account or API key needed — the NoSQL counterpart to the MongoDB playground
23 structured lessons across 11 chapters, beginner to pro — from first document to transactions, auth, and security rules; pair with the JavaScript playground for async/await fundamentals
Cursor pagination (orderBy + startAfter + limit) and document counting with getCountFromServer()
Atomic batched writes (writeBatch) and read-then-write transactions (runTransaction) with worked examples
Data modeling lessons — denormalization and array-vs-subcollection — for the NoSQL, JOIN-free mindset
Firebase Authentication flow — sign up, sign in, sign out, and onAuthStateChanged guarding
Security rules taught with real firestore.rules syntax (ownership and validation) modeled in runnable JS
Live Firestore State panel — visual collapsible tree of all collections, documents, and fields after each run; sketch your collections first in the database schema designer
Full document write API — addDoc() with auto ID, setDoc() with custom ID, setDoc() with merge option
Document read API — getDoc() with DocumentSnapshot pattern, getDocs() with QuerySnapshot and forEach()
Partial update and delete — updateDoc() for field-level changes, deleteDoc() with subcollection caveat
Query support — query() with where(), orderBy("asc"|"desc"), and limit() constraints
All Firestore operators — ==, !=, <, <=, >, >=, in, not-in, array-contains in where() clauses
Atomic special values — serverTimestamp(), increment(n), arrayUnion(), arrayRemove()
Real-time listener pattern — onSnapshot() fires callback immediately with current snapshot
Subcollection support — collection(docRef, "name") for nested document hierarchies
Console output panel — captured console.log lines shown with line numbers and Firebase orange colour
Chapter and lesson sidebar — 6 chapters, 12 lessons with active highlighting and collapsible sidebar
Takeaways section — 2–3 bullet key points for each lesson to reinforce learning
Lesson position saved to localStorage — resumes on the last active lesson across sessions
Keyboard shortcut — Ctrl+Enter to run lesson code without clicking the Run button

About this tool

Learn Firebase Firestore Without a Firebase Account — Run Real Firestore Operations Instantly in Your Browser

Firebase Firestore is the most widely-used NoSQL document database for web and mobile apps. It powers real-time features in millions of applications — yet learning it traditionally requires creating a Firebase project, enabling Firestore in the console, configuring security rules, and wiring up SDK credentials before writing a single document. This playground removes every barrier so you can focus entirely on understanding how Firestore works.

All Firestore operations run entirely in your browser — no data is sent to Firebase servers. Open any lesson and the code is already there. Click Run and the simulator executes against an in-memory Firestore engine built in JavaScript. Every addDoc(), setDoc(), getDoc(), query(), and onSnapshot() call works exactly as it does in the real Firebase SDK — and the live document tree on the right shows the resulting Firestore state after every run.

How the document tree works: After clicking Run, the Firestore State panel on the right renders a collapsible tree of all collections, documents, and fields in the in-memory store. Collection nodes show in Firebase orange with a document count badge. Each document expands to show its fields with values colour-coded by type — strings in green, numbers in amber, booleans in purple, arrays as comma-separated lists. Subcollections appear nested under their parent document. This visual makes the Firestore data model immediately clear: collections contain documents, documents contain fields, and subcollections live inside documents.

The 23-lesson curriculum spans 11 chapters and takes you from your first document to production patterns. Getting Started introduces addDoc() — which auto-generates a unique document ID — and setDoc(), which writes to a path you specify. Understanding the difference between these two is the first fundamental Firestore concept.

Reading Data covers getDoc() for single document reads with the DocumentSnapshot pattern (always call .exists() before .data()) and getDocs() for fetching all documents in a collection as a QuerySnapshot with .docs, .size, .empty, and .forEach().

Updating & Deleting teaches updateDoc() for partial field updates without touching other fields — critical for safe multi-client writes — and deleteDoc() for document removal, including the important caveat that subcollections are not automatically deleted.

Querying introduces the functional query composition pattern: query(collectionRef, ...constraints) builds a query descriptor, then getDocs() executes it. The where(field, op, value) constraint supports all Firestore operators — ==, !=, <, <=, >, >=, in, not-in, and array-contains. orderBy(field, direction) sorts results, and limit(n) caps the number returned. Constraints combine in a single query() call.

Special Values covers the three atomic sentinel values that make Firestore safe for concurrent updates: serverTimestamp() writes the server's actual time instead of the client clock; increment(n) atomically adjusts a numeric field without a read-modify-write race; arrayUnion() and arrayRemove() add or remove array items without duplicates and without reading the full array first.

Advanced lessons cover onSnapshot() for real-time listeners — which fire immediately with the current state and then on every subsequent change — and subcollections using collection(docRef, "name") for one-to-many relationships like posts and their comments.

Then the curriculum moves into production territory. Pagination & Aggregation teaches cursor pagination with orderBy() + startAfter() + limit() (Firestore paginates with cursors, never offsets) and counting documents efficiently with getCountFromServer(). Transactions & Batches covers atomic writeBatch() (all-or-nothing writes for things like money transfers) and runTransaction() (safe read-then-write for counters and inventory, with automatic retries). Data Modeling teaches the NoSQL mindset — denormalizing hot fields to avoid extra reads since Firestore has no JOINs, and choosing between an array field and a subcollection for one-to-many data.

Authentication covers the full email/password flow with createUserWithEmailAndPassword(), signInWithEmailAndPassword(), signOut(), and reacting to onAuthStateChanged() to guard protected pages. Finally, Security Rules shows the real firestore.rules syntax for ownership checks and data validation, modeled in runnable JavaScript so you can test the access decisions — because client SDK calls are only as safe as the rules running on Google's servers.

Why Use Firebase?

Firebase is a backend-as-a-service that lets you ship a complete app without managing servers. Firestore gives you a real-time NoSQL database that syncs across every connected client automatically; Authentication handles sign-up, sign-in, and sessions out of the box; Security Rules enforce access control server-side; and the whole platform scales automatically with a generous free tier, plus hosting and cloud functions when you need them. That combination lets a solo developer or small team launch a production-grade app remarkably fast — which is why Firebase powers millions of web and mobile apps. This playground teaches both the everyday Firestore API and the professional concerns (transactions, pagination, auth, rules) that separate a prototype from a production app. It pairs naturally with the MongoDB Playground for comparing NoSQL models and the JavaScript Playground for the async/await fundamentals every Firebase call relies on.

Step by step

How to Use

  1. 1
    Choose a lesson from the sidebarThe left sidebar lists all 23 lessons organised into 11 chapters. Start at "Add your first document" if you are new to Firestore, or jump to a pro chapter — Transactions & Batches, Authentication, or Security Rules — that matches your level. Your last active lesson is remembered when you return.
  2. 2
    Read the concept explanationA collapsible panel above the code explains the Firestore concept for that lesson. It describes what the API does, when to use it, and how it relates to real Firestore behaviour. Inline code markers highlight method names, and bold text flags key distinctions like the difference between addDoc and setDoc.
  3. 3
    Click Run to execute the codeThe lesson code is shown in a read-only panel so you can focus on understanding each example. Click the orange Run button or press Ctrl+Enter to execute it against the in-memory Firestore simulator. The code runs asynchronously — all await calls resolve as they would in a real Firestore app.
  4. 4
    Read the console outputThe Console Output panel below the code shows each console.log line numbered in sequence. Values are stringified — objects display as formatted JSON, arrays as comma-separated, primitives as plain text. If the code throws an error, it appears in red with the error message.
  5. 5
    Inspect the Firestore State treeThe Firestore State panel on the right renders a live visual tree of all documents created during the run. Collections appear in orange with a document count. Click any collection or document to expand or collapse it. Fields show their values colour-coded by type — this tree makes the Firestore data model tangible and is one of the most effective ways to understand how data is organised.

Real-world uses

Common Use Cases

🔥
React and Next.js developers adding Firestore to a project
Most web developers discover Firestore when they need a real-time data layer for a React or Next.js app. This playground lets you learn the SDK API without setting up a Firebase project first — understand addDoc, setDoc, queries, and listeners, then apply that knowledge directly to your real project with the actual Firebase SDK.
{}
Developers learning NoSQL document modelling
Firestore's document-collection model differs from SQL tables and MongoDB in important ways — especially around subcollections, denormalisation, and query limitations. The playground's live document tree makes these differences visible: you can see exactly how your data structure choices affect the resulting document hierarchy.
Students following Firebase courses and tutorials
Firebase courses on Udemy, YouTube, or Coursera move quickly through the SDK. This playground provides a zero-setup environment to follow along, test examples from the course, and experiment with variations — all without needing to pause the video to configure a Firebase project.
Developers debugging Firestore data model designs
When designing the Firestore data model for a new feature, sketch it out in the playground first. Try different approaches — top-level collection vs subcollection, flat document vs nested map — and see how queries behave against each structure. Catch data modelling mistakes before writing production code.
Teams onboarding engineers to Firebase
When a backend or mobile engineer joins a team that uses Firebase, the playground provides a structured path through the API. Work through all 23 lessons to understand the complete surface — writes, reads, queries, listeners, pagination, transactions, batched writes, auth, and security rules — before touching the production database.
Quick reference for Firestore API patterns
Forget the exact syntax for arrayUnion? Not sure whether to use updateDoc or setDoc with merge? Jump to the relevant lesson for a working code example. The playground doubles as a fast interactive reference — more memorable than documentation and faster than searching Stack Overflow.

Got questions?

Frequently Asked Questions

No. Everything runs in your browser against an in-memory JavaScript simulator. No Firebase account, API key, or project is needed. All Firestore operations run entirely in your browser — no data is sent to Firebase servers.

Beginner to pro across 23 lessons: addDoc, setDoc (with merge), getDoc, getDocs, updateDoc, deleteDoc, query with where/orderBy/limit, onSnapshot listeners, serverTimestamp, increment, arrayUnion/arrayRemove, subcollections, cursor pagination with startAfter, getCountFromServer aggregation, batched writes (writeBatch), transactions (runTransaction), data modeling, Firebase Authentication, and security rules.

Firebase is a backend-as-a-service: a real-time Firestore database that syncs across clients, Authentication out of the box, server-side Security Rules, and automatic scaling on a generous free tier — so small teams ship production apps without managing servers. The playground teaches both the everyday API and production concerns like transactions, pagination, auth, and rules.

A batch (writeBatch) groups up to 500 writes that commit atomically but does not read. A transaction (runTransaction) reads first, then writes based on the read, retrying if the data changed. Use a batch for consistent related writes (a money transfer); use a transaction when the new value depends on the current one (a counter or inventory). Both are runnable lessons.

Yes — completely free, no account, no sign-up, no limits. All 23 lessons are available immediately.

After you click Run, the Firestore State panel on the right renders all collections, documents, and fields in the in-memory store. Collections show as orange folder nodes with a count badge, documents show their ID and fields colour-coded by type, and subcollections appear nested under their parent document.

addDoc() auto-generates a unique random ID. setDoc() writes to a path you specify using doc(db, "col", "your-id"). setDoc() overwrites the document by default; pass { merge: true } to only update supplied fields. Use addDoc() when the ID does not matter, setDoc() when it does.

serverTimestamp() is replaced by the server's actual time on write. increment(n) atomically adjusts a number field — safe for counters with concurrent clients. arrayUnion() adds items without duplicates. arrayRemove() removes items. All are atomic and safe for concurrent writes.

Build a query with query(colRef, ...constraints) — constraints are where(), orderBy(), and limit(). Then pass the query to getDocs() to execute it. The simulator supports all Firestore where operators: ==, !=, <, <=, >, >=, in, not-in, and array-contains.

The simulator covers the core API accurately. Differences: operations complete synchronously in memory (no network), onSnapshot fires once rather than subscribing to ongoing changes, compound queries need no composite indexes, transactions do not truly retry under contention, and security rules are taught as runnable JS models rather than enforced on a server. Ideal for learning the API and patterns before connecting to a real Firebase project.