Firebase
Overview
Firebase is Google's Backend-as-a-Service platform that bundles authentication, NoSQL databases (Cloud Firestore and the older Realtime Database), serverless Cloud Functions, static/SSR Hosting, Cloud Storage, and messaging behind client SDKs and a single CLI. It removes the need to run your own backend for most app features. Read this when adding auth, real-time data sync, file storage, push notifications, or deploying functions/hosting from the Firebase CLI.
Official sources
Install / setup
npm install -g firebase-tools
firebase login
firebase init
Source: https://firebase.google.com/docs/cli
Core concepts
- Project — top-level container; one project holds all Firebase products and maps to a Google Cloud project.
- Cloud Firestore — scalable document/collection NoSQL DB with real-time listeners and offline cache; preferred over Realtime Database for new apps.
- Authentication — managed identity (email/password, Google, Apple, phone, anonymous, OIDC/SAML) issuing ID tokens verified by Security Rules.
- Security Rules — declarative server-side access control evaluated per request for Firestore, Storage, and Realtime Database.
- Cloud Functions — serverless Node/Python handlers triggered by HTTPS, Firestore/Auth events, schedules, or Pub/Sub.
- Hosting — global CDN for static assets and SSR frameworks (Next.js/Angular), wired to functions via rewrites.
- Emulator Suite — local emulators for Auth, Firestore, Functions, Hosting for offline development and CI.
Best practices
Common pitfalls
- Default-open or test-mode Security Rules left in production → leaked/writable data; deploy least-privilege rules before launch.
- Missing composite indexes for compound queries → query fails at runtime; create the suggested index from the error link.
- Per-document write contention on hot Firestore documents → throttling; shard counters or distribute writes.
Examples
import { initializeApp } from "firebase/app";
import { getFirestore, collection, addDoc } from "firebase/firestore";
const app = initializeApp({ projectId: "demo", apiKey: "..." });
const db = getFirestore(app);
await addDoc(collection(db, "messages"), {
text: "hello",
createdAt: Date.now(),
});
Further reading
Related skills
- ../appwrite — open-source self-hosted BaaS alternative
- ../amplify — AWS fullstack BaaS with similar auth/data/functions
1---2name: firebase3description: Firebase is Google's Backend-as-a-Service platform (Auth, Firestore, Realtime Database, Cloud Functions, Hosting, Cloud Storage, FCM). Consult when building serverless app backends, adding Google/email auth, syncing NoSQL data in real time, deploying static/SSR hosting, writing Cloud Functions, or using the Firebase CLI/emulator suite.4domain: stack5category: baas6tags: [firebase, baas, google, firestore, auth, serverless, cloud-functions]7official_sources:8 - https://firebase.google.com/docs9 - https://github.com/firebase/firebase-tools10 - https://www.npmjs.com/package/firebase-tools11verified: 2026-06-1712metadata:13 source: https://skillmd.com/skills/gabriel7silva/firebase14---1516# Firebase1718## Overview19Firebase is Google's Backend-as-a-Service platform that bundles authentication, NoSQL databases (Cloud Firestore and the older Realtime Database), serverless Cloud Functions, static/SSR Hosting, Cloud Storage, and messaging behind client SDKs and a single CLI. It removes the need to run your own backend for most app features. Read this when adding auth, real-time data sync, file storage, push notifications, or deploying functions/hosting from the Firebase CLI.2021## Official sources22- Docs: https://firebase.google.com/docs23- Repo: https://github.com/firebase/firebase-tools24- Install: https://www.npmjs.com/package/firebase-tools2526## Install / setup27```bash28npm install -g firebase-tools29firebase login30firebase init31```32Source: https://firebase.google.com/docs/cli3334## Core concepts35- **Project** — top-level container; one project holds all Firebase products and maps to a Google Cloud project.36- **Cloud Firestore** — scalable document/collection NoSQL DB with real-time listeners and offline cache; preferred over Realtime Database for new apps.37- **Authentication** — managed identity (email/password, Google, Apple, phone, anonymous, OIDC/SAML) issuing ID tokens verified by Security Rules.38- **Security Rules** — declarative server-side access control evaluated per request for Firestore, Storage, and Realtime Database.39- **Cloud Functions** — serverless Node/Python handlers triggered by HTTPS, Firestore/Auth events, schedules, or Pub/Sub.40- **Hosting** — global CDN for static assets and SSR frameworks (Next.js/Angular), wired to functions via rewrites.41- **Emulator Suite** — local emulators for Auth, Firestore, Functions, Hosting for offline development and CI.4243## Best practices44- Write and test Security Rules first; never rely on client-side checks alone (https://firebase.google.com/docs/rules).45- Develop against the Emulator Suite before touching production data (https://firebase.google.com/docs/emulator-suite).46- Model Firestore data for your queries — denormalize and avoid unbounded collection scans (https://firebase.google.com/docs/firestore/data-model).47- Keep API keys/config public but lock data with Rules and App Check (https://firebase.google.com/docs/app-check).4849## Common pitfalls50- Default-open or test-mode Security Rules left in production → leaked/writable data; deploy least-privilege rules before launch.51- Missing composite indexes for compound queries → query fails at runtime; create the suggested index from the error link.52- Per-document write contention on hot Firestore documents → throttling; shard counters or distribute writes.5354## Examples55```javascript56import { initializeApp } from "firebase/app";57import { getFirestore, collection, addDoc } from "firebase/firestore";5859const app = initializeApp({ projectId: "demo", apiKey: "..." });60const db = getFirestore(app);6162await addDoc(collection(db, "messages"), {63 text: "hello",64 createdAt: Date.now(),65});66```6768## Further reading69- https://firebase.google.com/docs/firestore — Cloud Firestore guide70- https://firebase.google.com/docs/functions — Cloud Functions reference71- https://firebase.google.com/docs/cli — Firebase CLI reference7273## Related skills74- ../appwrite — open-source self-hosted BaaS alternative75- ../amplify — AWS fullstack BaaS with similar auth/data/functions