| name | cost-firebase |
| description | Estimate Firebase costs for any project using live pricing data. Use when user asks about Firebase pricing, Firestore costs, or Google BaaS costs. |
Firebase Cost Evaluator
Estimate costs for Firebase-based projects using current pricing data.
Before Answering Firebase Cost Questions
IMPORTANT: Always verify tool availability before providing cost estimates.
Step 1: Check Available Tools
Check if the following tools are available:
Firebase CLI (preferred):
firebase CLI for project information
firebase projects:list - List projects
firebase use - Select project
GCP Console / gcloud (for billing):
- Firebase uses GCP billing
gcloud billing commands work for Firebase
Firebase Management API:
- REST API for project information
Step 2: If Tools Are Unavailable
If Firebase CLI is not accessible, help the user set them up:
Option A: Firebase CLI
npm install -g firebase-tools
firebase login
firebase projects:list
Option B: gcloud CLI (for billing)
gcloud auth login
gcloud config set project YOUR_GCP_PROJECT_ID
gcloud billing accounts list
Option C: Firebase Management API
curl -H "Authorization: Bearer YOUR_TOKEN" \
"https://firebase.googleapis.com/v1beta1/projects"
Ask the user which option fits their environment before proceeding.
Step 3: Fallback to Web Search
If no tools are available and user cannot install them, use web search to fetch current pricing from:
How to Get Live Pricing
Using Firebase CLI
firebase projects:list
firebase use YOUR_PROJECT_ID
firebase open
Using GCP Billing (Firebase uses GCP)
gcloud billing accounts list
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'
Using Firebase Console API
curl -H "Authorization: Bearer YOUR_TOKEN" \
"https://firebasehosting.googleapis.com/v1beta1/projects/PROJECT_ID/sites"
Using GCP Cloud Billing API
curl -H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://cloudbilling.googleapis.com/v1/services"
Standalone Usage
Can be invoked directly for cost estimation:
- "How much does Firebase cost for 100k users?"
- "Estimate Firestore costs for my app"
- "What's in Firebase free tier?"
Cost Estimation Process
- Identify plan (Spark free vs Blaze pay-as-you-go)
- Query current pricing using available tools
- Estimate usage based on app requirements
- Calculate costs above free tier
- Identify cost drivers (usually Firestore reads)
Pricing Structure (Query for Current Values)
Plans
| Plan | Query Method |
|---|
| Spark (Free) | firebase.google.com/pricing |
| Blaze (Pay-as-you-go) | GCP Billing API |
Service Pricing (Use GCP Billing API)
| Service | GCP Service Name |
|---|
| Firestore | Cloud Firestore |
| Cloud Functions | Cloud Functions |
| Cloud Storage | Cloud Storage |
| Hosting | Firebase Hosting |
| Authentication | Identity Platform |
Get Current Usage
gcloud monitoring metrics list --filter="metric.type:firestore"
curl -H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://firestore.googleapis.com/v1/projects/PROJECT_ID/databases/(default)"
Output Contract
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:
Cost Optimization Strategies
Monitor Firestore Usage
gcloud monitoring dashboards create \
--config-from-file=firestore-dashboard.json
Analyze Read Patterns
firebase.firestore.setLogLevel('debug');
Optimize Queries
const snapshot = await db.collection('users').get();
const snapshot = await db.collection('users')
.orderBy('createdAt')
.limit(20)
.get();
const snapshot = await db.collection('users')
.select('name', 'email')
.get();
Use Caching
firebase.firestore().enablePersistence()
.catch((err) => console.log('Persistence failed:', err));
const snapshot = await db.collection('config')
.get({ source: 'cache' });
Firebase Cost Considerations
Watch out for:
- Firestore reads scale quickly (every listener = reads)
- Realtime listeners multiply read costs
- Phone auth SMS costs ($0.01-0.06 per verification)
- Large document reads (charged per document, not size)
Cost traps:
- Listening to large collections without limits
- Not using pagination
- Fetching entire documents for small fields
- Not enabling offline persistence
Firebase vs Alternatives
When comparing costs, use the respective cost evaluator skills:
- vs Supabase: Use
cost-supabase for comparison
- vs AWS: Use
cost-aws for comparison
- Generally: Firebase cheaper for small apps, can get expensive at scale due to read costs