Master Firebase Suite
Streamline your workflow with this firebase, gives, complete, backend. Includes structured workflows, validation checks, and reusable patterns for development.
Firebase Development Skill
A Claude Code skill for building applications with the Firebase platform — covering Authentication, Firestore, Cloud Functions, Storage, Hosting, and real-time data synchronization patterns.
When to Use This Skill
Choose this skill when:
- Building applications with Firebase as the backend
- Implementing authentication with Firebase Auth (email, social, phone)
- Designing Firestore data models and security rules
- Writing Cloud Functions for server-side logic
- Setting up real-time data listeners and offline persistence
- Configuring Firebase Hosting with custom domains
Consider alternatives when:
- You need a relational database (use PostgreSQL/MySQL)
- You need complex server-side logic (use a traditional backend)
- You need fine-grained access control beyond Firestore rules (use a custom auth service)
Quick Start
# Install Firebase tools npm install firebase firebase-admin npm install -g firebase-tools # Initialize Firebase in your project firebase init # Start local emulators for development firebase emulators:start
// Initialize Firebase client import { initializeApp } from 'firebase/app'; import { getFirestore, collection, doc, setDoc, onSnapshot } from 'firebase/firestore'; import { getAuth, signInWithEmailAndPassword } from 'firebase/auth'; const app = initializeApp({ apiKey: process.env.NEXT_PUBLIC_FIREBASE_API_KEY, authDomain: 'myapp.firebaseapp.com', projectId: 'myapp', storageBucket: 'myapp.appspot.com', }); const db = getFirestore(app); const auth = getAuth(app);
Core Concepts
Firebase Services
| Service | Purpose | Use Case |
|---|---|---|
| Auth | User authentication | Sign-in, sign-up, social login, phone auth |
| Firestore | NoSQL document database | Real-time data, offline support |
| Cloud Functions | Serverless backend | Triggers, API endpoints, background jobs |
| Storage | File storage | User uploads, images, documents |
| Hosting | Web hosting | Static sites, SPAs, SSR with Cloud Functions |
| FCM | Push notifications | Mobile and web push messages |
Firestore Data Modeling
// Document structure for a project management app // /users/{userId} interface User { name: string; email: string; photoURL: string; createdAt: Timestamp; } // /organizations/{orgId} interface Organization { name: string; ownerId: string; memberIds: string[]; // Denormalized for queries } // /organizations/{orgId}/projects/{projectId} interface Project { name: string; status: 'active' | 'archived'; createdBy: string; createdAt: Timestamp; } // Real-time listener const unsubscribe = onSnapshot( collection(db, 'organizations', orgId, 'projects'), (snapshot) => { const projects = snapshot.docs.map(doc => ({ id: doc.id, ...doc.data() })); setProjects(projects); } );
Firestore Security Rules
rules_version = '2'; service cloud.firestore { match /databases/{database}/documents { match /users/{userId} { allow read: if request.auth != null; allow write: if request.auth.uid == userId; } match /organizations/{orgId} { allow read: if request.auth.uid in resource.data.memberIds; allow write: if request.auth.uid == resource.data.ownerId; match /projects/{projectId} { allow read: if request.auth.uid in get(/databases/$(database)/documents/organizations/$(orgId)).data.memberIds; allow create: if request.auth.uid in get(/databases/$(database)/documents/organizations/$(orgId)).data.memberIds; } } } }
Configuration
| Parameter | Type | Default | Description |
|---|---|---|---|
project_id | string | — | Firebase project ID (required) |
use_emulators | boolean | true | Use local emulators in development |
emulator_ports | object | { auth: 9099, firestore: 8080 } | Emulator port configuration |
region | string | "us-central1" | Cloud Functions deployment region |
offline_persistence | boolean | true | Enable Firestore offline cache |
multi_tab_persistence | boolean | false | Enable multi-tab Firestore sync |
storage_rules | string | "storage.rules" | Path to Storage security rules |
Best Practices
-
Design Firestore data for your queries, not your entities — Firestore doesn't support joins; denormalize data into the document structure that matches how you read it, even if that means duplicating some fields.
-
Always develop with Firebase emulators — the emulator suite provides local versions of Auth, Firestore, Functions, and Storage; this prevents accidental production writes and lets you test without network latency.
-
Write security rules before deploying — Firestore and Storage are open by default in test mode; deploy rules that enforce authentication and authorization before any real user touches the app.
-
Use batched writes for multi-document operations — Firestore batch writes are atomic (all succeed or all fail); use them when creating related documents that must be consistent.
-
Keep Cloud Functions small and focused — each function should do one thing; large functions are slower to cold-start, harder to debug, and more expensive to run.
Common Issues
Firestore reads are expensive on nested data — Each document read is billed; reading a parent document doesn't include subcollections. Denormalize frequently-accessed child data into the parent document to reduce reads.
Cloud Functions cold start is slow — First invocations after idle periods take 5-10 seconds. Minimize dependencies, use minInstances: 1 for critical functions, and keep function packages small.
Security rules block legitimate requests — Rules are deny-by-default. Use the Firebase console's Rules Playground to test rules with specific user contexts before deploying, and check request.auth structure carefully.
Reviews
No reviews yet. Be the first to review this template!
Similar Templates
Full-Stack Code Reviewer
Comprehensive code review skill that checks for security vulnerabilities, performance issues, accessibility, and best practices across frontend and backend code.
Test Suite Generator
Generates comprehensive test suites with unit tests, integration tests, and edge cases. Supports Jest, Vitest, Pytest, and Go testing.
Pro Architecture Workspace
Battle-tested skill for architectural, decision, making, framework. Includes structured workflows, validation checks, and reusable patterns for development.