Skip to content

Commit 9892f57

Browse files
committed
docs(firestore): Improving discoverability and giving more product context
1 parent d3f8973 commit 9892f57

File tree

7 files changed

+28
-23
lines changed

7 files changed

+28
-23
lines changed

packages/firestore/CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ contributing to the Firebase JavaScript SDK (including Cloud Firestore).
55
Follow instructions there to install dependencies, build the SDK, and set up
66
the testing environment.
77

8+
For a deep dive into the testing strategy and architecture, see [Testing Strategy](devdocs/testing.md).
9+
810
## Integration Testing
911

1012
### Setting up a project for testing

packages/firestore/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ Docs][reference-docs].
1717

1818
[reference-docs]: https://firebase.google.com/docs/reference/js/
1919

20+
## Internal Documentation
21+
22+
If you are a contributor or maintainer, please see the [Internal Developer Documentation](./devdocs/overview.md).
23+
2024
## Contributing
2125
See [Contributing to the Firebase SDK](../../CONTRIBUTING.md) for general
2226
information about contributing to the firebase-js-sdk repo and

packages/firestore/devdocs/architecture.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ The SDK is composed of several key components that work together to provide the
1212
* **Core**:
1313
* **Event Manager**: Acts as a central hub for all eventing in the SDK. It is responsible for routing events between the API Layer and Sync Engine. It manages query listeners and is responsible for raising snapshot events, as well as handling connectivity changes and some query failures.
1414
* **Sync Engine**: The central controller of the SDK. It acts as the glue between the Event Manager, Local Store, and Remote Store.
15+
* **Target**: The backend protocol's internal representation of a recurring Query. While a `Query` is a user-intent (e.g., "users where age > 18"), a `Target` is the allocated stream ID (`TargetID`) that the Watch implementation uses to track that query's state over the network. The **Coordinator** maps ephemeral user Queries to stable system Targets.
1516
* **Coordinator**: It bridges the **User World** (Query) and **System World** (Target), converting public API calls into internal `TargetIDs`.
1617
* **View Construction**: It manages the user-facing view using the formula: `View = Remote Document + Overlay`.
1718
* **Remote Document**: The authoritative state from the backend.
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
# Build Process
22

3-
This document provides a detailed explanation of the Firestore JavaScript SDK build process for the main and lite packages.
3+
> **Note**: This documentation is currently under construction and will be updated soon.
4+
5+
For current build instructions, test commands, and setup, please go to [CONTRIBUTING.md](../CONTRIBUTING.md).

packages/firestore/devdocs/overview.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,21 @@ The primary goals of this SDK are:
1616
* Offer a lightweight version for applications that do not require advanced features.
1717
* Maintain API and architectural symmetry with the [Firestore Android SDK](https://github.com/firebase/firebase-android-sdk) and [Firestore iOS SDK](https://github.com/firebase/firebase-ios-sdk). This consistency simplifies maintenance and makes it easier to port features between platforms. The public API is intentionally consistent across platforms, even if it means being less idiomatic, to allow developers to more easily port their application code.
1818

19+
## Designed for Flicker-Free Responsiveness
20+
21+
Firestore is designed to help developers build responsive front-end applications that eliminate UI flicker.
22+
23+
1. **Immediate Cache Results**: The SDK returns query results from the local cache immediately, while fetching the latest data from the server in the background.
24+
2. **Optimistic Updates**: Writes are applied to the local cache *instantly*, allowing the UI to update without waiting for network confirmation.
25+
3. **Background Synchronization**: The SDK handles the network communication to commit these changes to the backend asynchronously.
26+
27+
*This means the "Happy Path" handles latency automatically. You don't write special code to manage loading states for every interaction; the SDK provides instant feedback by default.*
28+
1929

2030
## Key Concepts & Vocabulary
2131

2232
* **Query**: The client-side representation of a data request (filters, order bys).
23-
* **Target**: The backend's representation of a Query. The SDK allocates a unique integer `TargetID` for every unique query to manage the real-time stream.
33+
2434
* **Mutation**: A user-initiated change (Set, Update, Delete). Mutations are queued locally and sent to the backend.
2535
* **Overlay**: The computed result of applying a Mutation to a Document. We store these to show "Optimistic Updates" instantly without modifying the underlying "Remote Document" until the server confirms the write.
2636
* **Limbo**: A state where a document exists locally and matches a query, but the server hasn't explicitly confirmed it belongs to the current snapshot version. The SDK must perform "Limbo Resolution" to ensure these documents are valid.
@@ -39,6 +49,9 @@ The Firestore JavaScript SDK is divided into two main packages:
3949

4050
To navigate the internals of the SDK, use the following guide:
4151

52+
### Getting Started (Build & Run)
53+
* **[Start Here: Build & Run](../CONTRIBUTING.md)**: How to set up the repo, build the SDK, and run tests.
54+
4255
### Core Concepts
4356
* **[Architecture](./architecture.md)**: The high-level block diagram of the system (API -> Core -> Local -> Remote).
4457
* **[Query Lifecycle](./query-lifecycle.md)**: The state machine of a query. **Read this** to understand how querying and offline capabilities work.
@@ -56,5 +69,4 @@ To navigate the internals of the SDK, use the following guide:
5669
* **[Code Layout](./code-layout.md)**: Maps the architectural components to specific source files and directories.
5770
* **[Build Process](./build.md)**: How to build the artifacts.
5871
* **[Testing](./testing.md)**: How to run unit and integration tests.
59-
* **[Spec Tests](./spec-tests.md)**: Deep dive into the cross-platform JSON test suite.
60-
* **[Contributing](../CONTRIBUTING.md)**: How to run unit and integration tests.
72+
* **[Spec Tests](./spec-tests.md)**: Deep dive into the cross-platform JSON test suite.

packages/firestore/devdocs/prerequisites.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Before contributing to this codebase, you should have a strong understanding of
2323

2424
### Domain Knowledge
2525

26-
* **[Google Cloud Firestore](https://firebase.google.com/docs/firestore):** A deep understanding of Firestore's data model (documents, collections, subcollections), query language, and security rules is fundamental.
26+
* **[Google Cloud Firestore](https://firebase.google.com/docs/firestore):** A general understanding of Firestore's data model (documents, collections, subcollections), query language, and security rules is fundamental.
2727
* **Databases:** A general understanding of databases, including key-value stores and relational databases, is helpful for understanding Firestore's design and trade-offs.
2828
* **Modern Web Application Architecture:** Familiarity with modern web application architecture and also server-side rendering (SSR), is beneficial for understanding how the SDK is used in practice.
2929
* **[Firebase](https://firebase.google.com/docs):** Familiarity with the Firebase platform is required, especially Firebase Auth and Firebase Functions.

packages/firestore/devdocs/testing.md

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Build Process
1+
# Testing Strategy
22

33
This document provides a detailed explanation of the Firestore JavaScript SDK testing strategy, tech stack, and patterns and practices.
44

@@ -27,21 +27,5 @@ The Firestore JS SDK employs a three-tiered testing strategy to ensure reliabili
2727
* **Purpose**: Verifying that the client protocol actually matches what the real backend server expects.
2828
* **Behavior**: These tests create real writes and listeners. They are slower and subject to network timing, but essential for catching protocol drifts.
2929

30-
## Running Tests
31-
32-
### Unit & Spec Tests
33-
Run via Karma.
34-
```bash
35-
yarn test
36-
```
37-
38-
### Integration Tests
39-
Requires the Firebase Emulator Suite running.
40-
```bash
41-
# Start emulators
42-
yarn emulators:start
43-
44-
# In another terminal, run integration tests
45-
yarn test:integration
46-
```
30+
> **Note**: For instructions on how to run these tests, see **[CONTRIBUTING.md](../CONTRIBUTING.md)**.
4731

0 commit comments

Comments
 (0)