Estimate Firebase costs for any project using live pricing data. Use when user asks about Firebase pricing, Firestore costs, or Google BaaS costs.
Estimate costs for Firebase-based projects using current pricing data.
IMPORTANT: Always verify tool availability before providing cost estimates.
Check if the following tools are available:
Firebase CLI (preferred):
firebase CLI for project informationfirebase projects:list - List projectsfirebase use - Select projectGCP Console / gcloud (for billing):
gcloud billing commands work for FirebaseFirebase Management API:
If Firebase CLI is not accessible, help the user set them up:
Option A: Firebase CLI
# Install Firebase CLI
npm install -g firebase-tools
# Login
firebase login
# List projects
firebase projects:list
Option B: gcloud CLI (for billing)
# Firebase billing is via GCP
gcloud auth login
# Link to Firebase project's GCP project
gcloud config set project YOUR_GCP_PROJECT_ID
# View billing
gcloud billing accounts list
Option C: Firebase Management API
# Get access token
# Use Firebase Admin SDK or Google OAuth
# List projects
curl -H "Authorization: Bearer YOUR_TOKEN" \
"https://firebase.googleapis.com/v1beta1/projects"
Ask the user which option fits their environment before proceeding.
If no tools are available and user cannot install them, use web search to fetch current pricing from:
# List all projects
firebase projects:list
# Get project details
firebase use YOUR_PROJECT_ID
# Open Firebase Console (for usage stats)
firebase open
# Firebase billing is through GCP
# Get cost breakdown
gcloud billing accounts list
# Export billing data
bq query --use_legacy_sql=false '
SELECT service.description, SUM(cost) as total_cost
FROM `PROJECT.dataset.gcp_billing_export_v1_*`
WHERE service.description LIKE "%Firebase%"
OR service.description LIKE "%Firestore%"
OR service.description LIKE "%Cloud Functions%"
GROUP BY service.description'
# Get project usage (requires Firebase Admin)
# https://console.firebase.google.com/project/PROJECT_ID/usage
# Or use the REST API
curl -H "Authorization: Bearer YOUR_TOKEN" \
"https://firebasehosting.googleapis.com/v1beta1/projects/PROJECT_ID/sites"
# Get SKUs for Firebase services
curl -H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://cloudbilling.googleapis.com/v1/services"
# Firestore service ID: example lookup
# Cloud Functions: same as GCP pricing
Can be invoked directly for cost estimation:
| Plan | Query Method |
|---|---|
| Spark (Free) | firebase.google.com/pricing |
| Blaze (Pay-as-you-go) | GCP Billing API |
| Service | GCP Service Name |
|---|---|
| Firestore | Cloud Firestore |
| Cloud Functions | Cloud Functions |
| Cloud Storage | Cloud Storage |
| Hosting | Firebase Hosting |
| Authentication | Identity Platform |
# Via GCP Monitoring
gcloud monitoring metrics list --filter="metric.type:firestore"
# Via Firebase Console
# https://console.firebase.google.com/project/PROJECT_ID/usage
# Firestore usage via API
curl -H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://firestore.googleapis.com/v1/projects/PROJECT_ID/databases/(default)"
firebase_cost_estimate:
description: "<what's being estimated>"
pricing_source: "<cli|api|web|gcp-billing>"
pricing_date: "<when pricing was fetched>"
recommended_plan: "<spark|blaze>"
usage_estimate:
firestore_reads_per_day: <N>
firestore_writes_per_day: <N>
firestore_storage_gb: <N>
function_invocations_per_month: <N>
storage_gb: <N>
bandwidth_gb: <N>
mau: <N>
free_tier_usage:
firestore_reads: "<within/exceeds>"
firestore_writes: "<within/exceeds>"
functions: "<within/exceeds>"
storage: "<within/exceeds>"
baseline_monthly:
firestore_reads: "<$X>"
firestore_writes: "<$X>"
firestore_storage: "<$X>"
cloud_functions: "<$X>"
storage: "<$X>"
hosting: "<$X>"
auth: "<$X>"
total: "<$X>"
at_10x_scale:
firestore: "<$X>"
functions: "<$X>"
total: "<$X>"
cost_drivers:
- "<primary driver>"
warnings:
- "<cost warning if applicable>"
optimization_tips:
- "<tip 1>"
- "<tip 2>"
# Enable Firestore usage tracking
# In Firebase Console: Firestore > Usage tab
# Or via GCP Monitoring
gcloud monitoring dashboards create \
--config-from-file=firestore-dashboard.json
// Enable Firestore debug logging (client-side)
firebase.firestore.setLogLevel('debug');
// Use Firebase Performance Monitoring
// Tracks Firestore operations automatically
// BAD: Fetching entire collection
const snapshot = await db.collection('users').get();
// GOOD: Paginate and limit
const snapshot = await db.collection('users')
.orderBy('createdAt')
.limit(20)
.get();
// GOOD: Select specific fields
const snapshot = await db.collection('users')
.select('name', 'email')
.get();
// Enable offline persistence
firebase.firestore().enablePersistence()
.catch((err) => console.log('Persistence failed:', err));
// Use cache-first queries where appropriate
const snapshot = await db.collection('config')
.get({ source: 'cache' });
Watch out for:
Cost traps:
When comparing costs, use the respective cost evaluator skills:
cost-supabase for comparisoncost-aws for comparison