Firebase JavaScript SDK

repository·main·Indexed 26 days ago

https://github.com/firebase/firebase-js-sdk

Client-side libraries for integrating Firebase services such as Firestore, Auth, and Storage into web applications. The SDK supports modern features like tree-shaking and provides specialized functionality for Data Connect, including query and mutation execution via action shortcuts or reference functions. It includes both a modular API and a compatibility layer for v8-style environments.

Tokens
199.4K
Snippets
767
Records
1.6K
Agent score
88%

What's inside firebase-js-sdk

  1. Overview of Firebase JS SDK Packages

    main

    The Firebase JavaScript SDK is composed of several modular packages that allow you to integrate various Firebase services into your web applications.

    Note on Environment Compatibility: Several SDKs (Analytics, Installations, Messaging, Performance, and Remote Config) are designed specifically for web environments and do not work in a Node.js environment.

  2. Use WriteBatch for atomic Firestore writes

    main

    A WriteBatch allows you to perform multiple write operations (set, update, delete) as a single atomic unit. None of the writes are committed or visible locally until commit() is called.

    Note on Offline Behavior: If the client is offline, commit() will fail. For features like local modifications or buffering writes until the client is online, use the full Firestore SDK instead of WriteBatch.

  3. Use @firebase/template for new Firebase JS SDK packages

    main

    The @firebase/template package serves as a foundation for developers creating new packages within the Firebase JS SDK ecosystem. It provides out-of-the-box support for:

    • TypeScript Support: Ensures new packages remain consistent with the rest of the SDK by enforcing TypeScript usage.
    • Isomorphic Testing and Coverage: Configures tests to run in both Node.js and Browser environments, with coverage collected from both runtimes.