The Short Answer
Migrating from Firebase to Supabase involves three main phases: converting your Firestore document data to PostgreSQL relational tables, migrating Firebase Auth users with their credentials intact, and transferring files from Firebase Storage to Supabase Storage. Plan for 2-4 weeks depending on your data complexity.
Why Teams Migrate From Firebase to Supabase
Before diving into the how, it helps to understand the common motivations that drive this migration:
- Cost predictability: Firebase pricing scales with reads/writes, which can spike unexpectedly. A viral feature or a misconfigured listener can generate a $10,000 bill overnight. Supabase charges based on database size and compute, which scales more predictably
- PostgreSQL power: Firestore's NoSQL model limits complex queries, joins, and aggregations. PostgreSQL gives you full SQL, foreign keys, views, stored procedures, and extensions like PostGIS for geospatial data
- Data ownership: Supabase is open source. You can self-host and own your entire infrastructure if needed. Firebase locks you into Google Cloud
- Row-level security: Supabase's RLS policies in PostgreSQL are more expressive and testable than Firestore security rules
- Pricing at scale: For applications with significant database usage, Supabase's Pro plan at $25/month often replaces Firebase bills of $200+/month
Data Migration: Firestore to PostgreSQL
This is the most complex part of the migration because you are converting from a document/collection model to relational tables.
Step 1: Schema design. Map your Firestore collections to PostgreSQL tables. Key decisions:
- Nested documents become separate tables with foreign key relationships
- Firestore arrays often become junction tables for many-to-many relationships
- Document subcollections become related tables with parent references
- Firestore's flexible schema requires you to define explicit column types
Step 2: Export Firestore data. Use the Firebase Admin SDK to export your collections:
- Write a Node.js script that reads each collection and subcollection
- Export to JSON files organized by collection
- Handle Firestore-specific types: Timestamps become ISO strings, GeoPoints become PostGIS geometry or separate lat/lng columns, References become foreign keys
Step 3: Transform and import. Write transformation scripts that:
- Flatten nested objects into separate related rows
- Generate consistent UUIDs or preserve Firestore document IDs as text primary keys
- Handle null values and missing fields (Firestore documents in the same collection can have different fields)
- Use Supabase's bulk insert API or PostgreSQL's
COPYcommand for large datasets
Step 4: Validate. Compare record counts between Firestore and PostgreSQL. Spot-check specific records for data integrity. Run your application's most common queries against the new database to verify correctness.
Authentication Migration
Firebase Auth users can be migrated to Supabase Auth, but password hashes require special handling.
Export Firebase Auth users using the Firebase CLI: firebase auth:export users.json --format=json. This exports email, password hash, salt, and metadata for each user.
Import into Supabase Auth: Supabase supports importing Firebase's scrypt-hashed passwords. Use the Supabase Auth Admin API to create users with their existing password hashes so users do not need to reset passwords.
OAuth providers: If users signed in with Google, GitHub, or other OAuth providers via Firebase, configure the same providers in Supabase Auth. Users will need to re-authenticate once, but their accounts will link based on email address.
Migration checklist for auth:
- Export all user records including metadata and custom claims
- Map Firebase custom claims to Supabase user metadata or app_metadata
- Configure email templates in Supabase to match your existing communications
- Test the login flow for email/password, OAuth, and magic link users
- Set up a fallback redirect for users who have old Firebase session tokens
Storage Migration and Common Pitfalls
Storage migration is straightforward but time-consuming for large file sets:
- List all files in Firebase Storage using the Admin SDK
- Download files maintaining their path structure
- Upload to Supabase Storage buckets using the Supabase client library
- Update all file URL references in your database to point to Supabase Storage URLs
Common pitfalls to avoid:
- Running both systems in parallel: Plan a maintenance window for the final data sync rather than trying to keep both databases in sync indefinitely
- Ignoring Firestore real-time listeners: Map out every real-time subscription in your codebase and replace with Supabase Realtime channels
- Forgetting security rules: Convert every Firestore security rule to a PostgreSQL Row Level Security policy. Test these thoroughly
- Underestimating client-side changes: Every
firebase.firestore()call needs to become a Supabase client call. Use find-and-replace cautiously and test every affected component - Not testing edge cases: Empty collections, documents with missing fields, and deeply nested data all need special handling
How UniqueSide Can Help
At UniqueSide, we have handled multiple Firebase to Supabase migrations and know exactly where teams get stuck. Our deep experience with both platforms, plus PostgreSQL database design, means we can plan and execute your migration with minimal downtime and zero data loss.
Our 15-day delivery at $8,000 can cover a complete migration including schema redesign, data transformation scripts, auth migration, storage transfer, and client-side code updates. We leave you with a fully functional application on Supabase with proper RLS policies and optimized queries.
Explore our MVP development services or review our technology expertise to learn more.
Frequently Asked Questions
How long does a Firebase to Supabase migration take?
For a typical application with 10-20 Firestore collections and under 100,000 documents, expect 2-4 weeks. The timeline increases with data complexity (deeply nested documents, many subcollections) and the number of Firebase-specific features in use (Cloud Functions, FCM, Remote Config).
Can I migrate incrementally or do I need a full cutover?
Incremental migration is possible but adds complexity. You can run both systems in parallel by migrating one feature at a time, but you will need to handle data synchronization between Firestore and PostgreSQL during the transition. A planned cutover with a maintenance window is simpler and less error-prone for most applications.
Will my users need to create new accounts after migration?
No. Firebase Auth password hashes can be imported into Supabase Auth, so users keep their existing email and password. OAuth users (Google, GitHub) will need to re-authenticate once after migration, but their accounts will be preserved based on their email address.








