How to Migrate from Firebase to Supabase: Complete Step-by-Step Guide
🔍 Want the best deal? Check current prices and availability.
Compare Prices →When you buy through links on our site, we may earn a commission.
If you've been working with Firebase for a while, you've probably felt the pain. Bizarre billing surprises, vendor lock-in, and a NoSQL database that becomes a nightmare as your app grows. I've been there.
Supabase has emerged as the leading open-source alternative, and migrating from Firebase to Supabase is easier than most people think. In this guide, I'll walk through the entire process—exporting your data, porting authentication, moving storage, and setting up real-time subscriptions—with production-proven steps.
Let's get to it.
Why Migrate from Firebase to Supabase?
Firebase isn't bad. It's great for prototypes. But once you hit scale, the problems stack up:
- Billing unpredictability — Firestore reads/writes cost per operation. One runaway query and your bill jumps $500.
- No SQL — Complex aggregations, joins, and relational queries require workarounds or separate indexing services.
- Vendor lock-in — Firebase Authentication, Firestore, and Cloud Functions are deeply tied to Google Cloud. Porting out feels like a hostage negotiation.
- Limited self-hosting — You cannot run Firebase on your own infrastructure.
Supabase solves all of that. It wraps PostgreSQL—a battle-tested relational database—with authentication, storage, real-time subscriptions, and auto-generated APIs. It's open-source, has predictable pricing, and you can self-host if needed.
Feature Comparison: Firebase vs Supabase
| Feature | Firebase | Supabase |
|---|---|---|
| Database | NoSQL (Firestore/Realtime) | PostgreSQL (Relational) |
| Query capabilities | Limited, no JOINs | Full SQL — JOINs, aggregations, window functions |
| Auth | Built-in, proprietary | Built-in, open-source (GoTrue) |
| Storage | Cloud Storage (GCS) | S3-compatible (MinIO, Backblaze, or local) |
| Real-time | WebSocket-based (Realtime DB) | PostgreSQL replication via Realtime |
| Self-hostable | No | Yes |
| Pricing (1GB DB) | Free tier, then pay-per-operation (~$25+/mo for small apps) | Free tier, then $25/mo for 8GB DB, 50GB bandwidth |
| Export tooling | Manual JSON/CSV export | Import scripts, pg_dump, direct migration tools |
| Open-source | No (client SDKs only) | Yes (MIT license) |
| Functions | Cloud Functions (Node.js, Python) | Edge Functions (Deno) or custom API routes |
Prerequisites
Before you start, Make sure you have:
- A Supabase project (create one free at supabase.com)
- A Firebase project with data you want to move
- Node.js installed (v18+)
- The Firebase Admin SDK credentials (a service account JSON file)
- Your Supabase project URL and
service_rolekey
Pro tip: Create a dedicated migration branch in your Supabase project. This isolates your work and lets you roll back if something breaks.
Step 1: Export Firestore Data
Firestore stores data as collections of documents. We'll export everything as JSON files.
# Install firebase-tools if you haven't already
npm install -g firebase-tools
Export all Firestore data
firebase firestore:export ./firestore-export --project YOUR_FIREBASE_PROJECT_ID
This creates a folder structure like:
firestore-export/
users/
all_namespaces/
kind_users/
output-0
posts/
all_namespaces/
kind_posts/
output-0
Each output-0 file contains JSON lines with document IDs and data. For smaller exports (under 500MB total), you can also use the Firebase Console to export manually
🔍 Want the best deal? Check current prices and availability.
Compare Prices →