You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/firestore/devdocs/architecture.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,6 +12,7 @@ The SDK is composed of several key components that work together to provide the
12
12
***Core**:
13
13
***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.
14
14
***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.
15
16
***Coordinator**: It bridges the **User World** (Query) and **System World** (Target), converting public API calls into internal `TargetIDs`.
16
17
***View Construction**: It manages the user-facing view using the formula: `View = Remote Document + Overlay`.
17
18
***Remote Document**: The authoritative state from the backend.
Copy file name to clipboardExpand all lines: packages/firestore/devdocs/overview.md
+15-3Lines changed: 15 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,11 +16,21 @@ The primary goals of this SDK are:
16
16
* Offer a lightweight version for applications that do not require advanced features.
17
17
* 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.
18
18
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
+
19
29
20
30
## Key Concepts & Vocabulary
21
31
22
32
***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
+
24
34
***Mutation**: A user-initiated change (Set, Update, Delete). Mutations are queued locally and sent to the backend.
25
35
***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.
26
36
***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:
39
49
40
50
To navigate the internals of the SDK, use the following guide:
41
51
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
+
42
55
### Core Concepts
43
56
***[Architecture](./architecture.md)**: The high-level block diagram of the system (API -> Core -> Local -> Remote).
44
57
***[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:
56
69
***[Code Layout](./code-layout.md)**: Maps the architectural components to specific source files and directories.
57
70
***[Build Process](./build.md)**: How to build the artifacts.
58
71
***[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.
Copy file name to clipboardExpand all lines: packages/firestore/devdocs/prerequisites.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,7 @@ Before contributing to this codebase, you should have a strong understanding of
23
23
24
24
### Domain Knowledge
25
25
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.
27
27
***Databases:** A general understanding of databases, including key-value stores and relational databases, is helpful for understanding Firestore's design and trade-offs.
28
28
***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.
29
29
***[Firebase](https://firebase.google.com/docs):** Familiarity with the Firebase platform is required, especially Firebase Auth and Firebase Functions.
Copy file name to clipboardExpand all lines: packages/firestore/devdocs/testing.md
+2-18Lines changed: 2 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# Build Process
1
+
# Testing Strategy
2
2
3
3
This document provides a detailed explanation of the Firestore JavaScript SDK testing strategy, tech stack, and patterns and practices.
4
4
@@ -27,21 +27,5 @@ The Firestore JS SDK employs a three-tiered testing strategy to ensure reliabili
27
27
***Purpose**: Verifying that the client protocol actually matches what the real backend server expects.
28
28
***Behavior**: These tests create real writes and listeners. They are slower and subject to network timing, but essential for catching protocol drifts.
29
29
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)**.
0 commit comments