The Firebase JavaScript SDK provides a comprehensive client-side library for interacting with Google's Firebase platform, suitable for web, mobile-web (e.g., React Native, Ionic), and Node.js desktop (e.g., Electron) applications. The current stable version is 12.12.0, with minor versions released frequently, often weekly or bi-weekly, reflecting continuous development and updates across its sub-packages. It offers a suite of services including Authentication, Cloud Firestore, Realtime Database, Cloud Storage, Cloud Functions, Messaging, Performance Monitoring, Analytics, Remote Config, App Check, and AI capabilities. A key differentiator since version 9 is its modular, tree-shakable API, which significantly improves application bundle sizes. This SDK is distinct from the Firebase Admin Node.js SDK, which is designed for privileged server environments and administrative access.
npm install firebaseVerified import paths — ran on the pinned version, not inferred.
Initializes a Firebase app and demonstrates adding a document to Cloud Firestore using the modular API.
Migrate your application to the modular API by importing specific functions from service modules (e.g., 'firebase/app', 'firebase/auth') and using functional patterns (e.g., getAuth(), signInWithEmailAndPassword()). Refer to the Firebase 'Upgrade to Version 9' guide.
Users of `@firebase/ai` should plan to migrate their applications to alternative AI models or services by June 2026. Consult Firebase documentation for recommended replacements.
Instead of the deprecated methods, use the new methods that have been added to the `LiveSession` class for streaming media. Review the `@firebase/ai` changelog for the specific new API.
Ensure `react-native-async-storage` is installed and updated to version 2 or higher in your React Native project when using Firebase Auth. Run `npm install --save react-native-async-storage@^2.0.0` or `yarn add react-native-async-storage@^2.0.0`.
Ensure `initializeApp(firebaseConfig)` is called once at the start of your application's lifecycle before any Firebase service-specific functions are invoked. This call should typically be near your app's entry point.
Verify that your import statements are correct for the modular API (e.g., `import { getAuth } from 'firebase/auth';`). If you intend to use the compat API, explicitly import from `firebase/compat/auth`.Switch all Firebase imports to the ES Module syntax (e.g., `import { initializeApp } from 'firebase/app';`). Ensure your bundler configuration (e.g., Webpack, Rollup, Vite) is correctly set up to handle ESM.