mrkeyoor.com_
Sat 19 Sept 08:53 UTC
npmInfraupdated 19 Sept 2026

firebase review

firebase 12.18.0 is the umbrella browser SDK for Google's hosted Authentication, Firestore, Realtime Database, Storage, Functions, Messaging, App Check, Analytics, Remote Config, Data Connect, and AI products. Applications initialize one Firebase app, then import individual products through paths such as firebase/auth or firebase/firestore. Release 12.18 adds HTTP status and URL details to FunctionsError, fixes App Check tokens in SQL Connect realtime requests, and removes Imagen methods because those models were shut down. It also updates the component packages shipped behind the top-level dependency.

Verdict

firebase 12.18.0 took 14.8 seconds and 183 MB to install in our sandbox, while both root import styles and a broad browser bundle failed, so adopt it through tested product subpaths rather than as one generic SDK import. It earns its weight when Auth, rules, listeners, and managed Firebase services are an intentional platform choice.

We installed it

Lab card: what happened when we installed firebaseScreenshot of firebase documentation
Install✓ · 14.8s104 packages on disk · 183 MB
ImportESM import fails · require() fails · CommonJS package with exports map
Browsern/acould not be bundled for the browser (Node-only code, most likely)
TypesTypeScript types bundled
Known vulns00 critical · 0 high · 0 moderate · 0 low (npm audit)

Answers from our run

Does firebase install cleanly?

Yes. In a fresh container with an empty cache, npm install firebase finished in 15 seconds, leaving 104 packages and 183 MB on disk. npm audit reported no known vulnerabilities.

Can firebase run in a browser?

Not directly: esbuild could not bundle it for the browser in our run, which normally means it depends on Node built-ins. Use it on the server, or find a browser-targeted alternative.

Does firebase work with both ESM and CommonJS?

Neither plain import nor require succeeded in our sandbox, so it needs a bundler or extra setup.

Does firebase include TypeScript types?

Yes, type declarations ship inside the package, so no @types install is needed.

firebase or @supabase/supabase-js: which should you use?

@supabase/supabase-js: @supabase/supabase-js 2.x fits apps that want hosted Postgres, SQL-oriented data, authentication, and storage behind one client. firebase 12.18.0 took 14.8 seconds and 183 MB to install in our sandbox, while both root import styles and a broad browser bundle failed, so adopt it through tested product subpaths rather than as one generic SDK import.

When should you not use firebase?

A small client cannot absorb our measured 183 MB install tree with 104 packages and 28 direct dependencies before bundling.

API stability3/5The modular initializeApp, getAuth, getFirestore, document reference, query, and listener APIs have been the documented route since version 9, and compat packages remain available for older namespace code. Product APIs still move independently inside the umbrella release. Version 12.18 removes Imagen methods after service shutdown, while 12.17 changed App Check initialization and AI backend naming, so upgrades require reading per-product notes rather than trusting the top-level major alone.
Docs5/5Firebase's official documentation has separate setup, API, security-rule, emulator, quota, index, offline-cache, authentication-provider, and deployment material for each web product. Error pages often connect directly to remediation, such as Firestore's missing-index link. The volume is the drawback: a working quickstart can omit production decisions about rules, billing, listener cleanup, regional placement, and the distinction between browser SDK and Admin SDK.
Maintenance5/5npm published version 12.18.0 on August 19, 2026, and GitHub shows a push on August 26, 2026. The repository is active and not archived, with 728 open issues and pull requests across many products. The current changelog identifies a SQL Connect App Check fix, richer Functions errors, removed Imagen APIs, and exact internal package versions, giving maintainers enough detail to target regression tests.
Ecosystem5/5npm counted 9,974,767 downloads in the latest completed week, and GitHub reports 5,139 stars for the JavaScript SDK repository. Firebase connects browser libraries to Auth providers, Firestore, Realtime Database, Storage, Functions, emulators, App Check, hosting, analytics, and Google Cloud services. That breadth also increases coupling: rules, indexes, identities, local tooling, billing, and regional service behavior live beyond the npm dependency.

Use it if

  • firebase 12.18.0 fits a browser app that needs Firebase Auth plus one or more Firebase data or storage products under the same project identity.
  • Firestore listeners, offline cache, and security rules match an application built around documents rather than relational joins.
  • The team will test rules and client behavior against the Firebase Emulator Suite before deploying indexes and rules.
  • A modular import per product is acceptable, and the build already has browser-specific entry handling for the Firebase SDK.
Skip it if

Setup reality

We installed firebase 12.18.0 in a fresh Node 22 Bookworm sandbox. npm took 14.8 seconds, left 104 packages, and consumed 183 MB. The umbrella package reports 28 direct dependencies, no peers, and 54916 KB unpacked. npm audit found 0 known vulnerabilities, and TypeScript declarations are included. package.json describes CommonJS with an exports map, yet require() and ESM import both failed under Node 22.23.2.

Our esbuild browser test of a broad package import also failed. That result does not mean the Firebase browser products are Node-only; it means the root-import check is a poor fit for this multi-product package. Start with initializeApp from firebase/app, then import exact modules such as firebase/auth and firebase/firestore. Measure the entry points your application uses because the 183 MB installed tree says nothing about the final tree-shaken browser chunk.

Copy the registered web app config from the Firebase console. Those values will be shipped to users. Protection belongs in Firestore, Realtime Database, and Storage rules, with App Check as another abuse signal where supported. Enable each Auth provider separately. Compound Firestore queries may require an index deployed through the console or Firebase CLI. The Emulator Suite is installed through firebase-tools, outside this package.

Auth state restores asynchronously, and Firestore listeners stay live until unsubscribed. Connect emulators before the first product call, and initialize persistent cache before getFirestore creates the default instance. Release 12.18.0 removes Imagen APIs and changes callable Functions errors to include HTTP status and URL details, so code matching old error messages or importing Imagen symbols needs a focused upgrade test.

Patterns

Initialize one browser app initialize-app

import { initializeApp } from 'firebase/app';

export const app = initializeApp({
  apiKey: '...',
  authDomain: 'my-app.firebaseapp.com',
  projectId: 'my-app',
  storageBucket: 'my-app.appspot.com',
  appId: '...',
});

The web config identifies a Firebase app and is visible in browser code. Access control comes from identity and product rules.

Render after auth restoration observe-auth

import { getAuth, onAuthStateChanged } from 'firebase/auth';

const stop = onAuthStateChanged(getAuth(app), (user) => {
  renderRoute(user ? 'account' : 'login');
});

// later
stop();

currentUser may be null before the first callback because persisted credentials restore asynchronously.

Sign in with an enabled provider sign-in-password

import { getAuth, signInWithEmailAndPassword } from 'firebase/auth';

const result = await signInWithEmailAndPassword(getAuth(app), email, password);
console.log(result.user.uid);

Email and password sign-in must be enabled in the console. Otherwise this call returns auth/operation-not-allowed.

Merge selected Firestore fields merge-document

import { getFirestore, doc, setDoc } from 'firebase/firestore';

const db = getFirestore(app);
await setDoc(doc(db, 'users', uid), { plan: 'pro' }, { merge: true });

Without merge: true, setDoc replaces the document fields. Security rules evaluate the proposed write either way.

Run an indexed Firestore query query-documents

import { collection, query, where, orderBy, limit, getDocs } from 'firebase/firestore';

const q = query(collection(db, 'posts'), where('authorId', '==', uid), orderBy('createdAt', 'desc'), limit(20));
const snapshot = await getDocs(q);

This filter plus sort may need a composite index. The runtime error includes a Firebase console link to create it.

Dispose a live document listener listen-document

import { doc, onSnapshot } from 'firebase/firestore';

const unsubscribe = onSnapshot(doc(db, 'games', gameId), (snap) => {
  render(snap.exists() ? snap.data() : null);
});

// route cleanup
unsubscribe();

onSnapshot keeps reading changes until unsubscribe runs. Bind cleanup to the route or component lifecycle.

Upload an object and read its URL upload-file

import { getStorage, ref, uploadBytes, getDownloadURL } from 'firebase/storage';

const target = ref(getStorage(app), `avatars/${uid}.png`);
await uploadBytes(target, file, { contentType: file.type });
const url = await getDownloadURL(target);

Storage rules are independent of Firestore rules. Permission to a user document does not grant this object path.

Connect products before first use connect-emulators

import { connectAuthEmulator } from 'firebase/auth';
import { connectFirestoreEmulator } from 'firebase/firestore';

if (location.hostname === 'localhost') {
  connectAuthEmulator(auth, 'http://127.0.0.1:9099');
  connectFirestoreEmulator(db, '127.0.0.1', 8080);
}

Call emulator connectors before any network operation. The Emulator Suite itself comes from firebase-tools.

Alternatives

PackageRegistryPick it when
@supabase/supabase-jsnpm@supabase/supabase-js 2.x fits apps that want hosted Postgres, SQL-oriented data, authentication, and storage behind one client.
appwritenpmUse Appwrite when its self-hosting option and document database model matter more than Firebase's managed product depth.
pocketbasenpmUse the PocketBase client for a small project backed by one deployable PocketBase server and a simpler operational footprint.

More infra guides

boto3 · opentelemetry-api · @opentelemetry/api · psutil · distro · @aws-sdk/client-s3 · the whole shelf →

How this guide is made: grounded in the library's documentation, release notes, changelog, and issue history, on a fixed rubric — not a hands-on install of every release. The 50 most-downloaded entries are additionally install-verified in clean containers. Corrections: contact the desk.