/firebase-tutorials

How to migrate from Firebase to Supabase?

Migrate from Firebase to Supabase with our step-by-step guide: set up Supabase, export and transform data, update code, test your app, and decommission Firebase seamlessly.

Matt Graham, CEO of Rapid Developers

Book a call with an Expert

Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.

Book a free No-Code consultation

How to migrate from Firebase to Supabase?

 

Step 1: Set Up a Supabase Account and Project

 

  1. First, sign up for a Supabase account at https://supabase.io/. You can use your email or a GitHub account to register.

  2. Create a new project by clicking on the "New Project" button in your dashboard. You'll need to provide a project name, a database password, and select a region for your database.

  3. Note down the API URL and the anon key available in the project's settings; you’ll need them later for client-side configurations.

 

Step 2: Export Data from Firebase

 

  1. Go to your Firebase console at https://console.firebase.google.com/.

  2. Choose the project that you want to migrate and navigate to the "Firestore Database" section.

  3. Click on the "Data" tab, and then click the "Export" option. Save the exported data in a JSON format.

  4. For Firebase Realtime Database, navigate to the "Realtime Database" section, click on the three-dot menu on the top right, and choose "Export JSON".

 

Step 3: Transform Firebase Data for Supabase

 

  1. Review your exported JSON data. Supabase uses PostgreSQL, so it’s structured differently than Firebase’s NoSQL format. You may need to transform your JSON structure to match the relational database model.

  2. Create scripts to parse Firebase JSON data and generate SQL INSERT statements corresponding to the table structures in Supabase.

 

Step 4: Import Data into Supabase

 

  1. Go to your Supabase project, and navigate to the "Table Editor" to manually create tables that match your data structure or use SQL scripts to create them programmatically.

  2. Use the Supabase SQL Editor to run SQL scripts that insert your data. If you transformed your Firebase JSON into SQL INSERT statements, execute those here.

 

Step 5: Configure Supabase Authentication

 

  1. If Firebase Authentication is used, replicate the authentication setup in Supabase by navigating to the "Authentication" tab.

  2. Set up authentication providers (like Google, Facebook, etc.) similar to what was configured in Firebase by enabling the necessary options and configuring credentials.

  3. For user data, export from Firebase Authentication, transform it into SQL compatible with Supabase's auth.users table, and import it using the SQL Editor.

 

Step 6: Update Application Code

 

  1. Replace Firebase SDK calls in your client-side or server-side code with equivalent Supabase SDK calls. Install the Supabase client:

    
    npm install @supabase/supabase-js
    
  2. Initialize Supabase in your application:

    
    import { createClient } from '@supabase/supabase-js';
    
    const supabase = createClient('https://your-project-url.supabase.co', 'your-anon-key');
    
  3. Replace Firebase methods with Supabase equivalents. For instance, replace Firestore queries or Realtime Database listeners with Supabase’s from(), select(), and other available methods.

 

Step 7: Test Your Application

 

  1. Run your application and thoroughly test all functionalities to ensure they interact correctly with Supabase as they did with Firebase.

  2. Pay special attention to data retrieval, storage, and user authentication scenarios.

  3. Debug any issues that arise, checking logs in the Supabase console for more details if needed.

 

Step 8: Decommission Firebase

 

  1. Once you’ve confirmed the application is functioning correctly with Supabase, you can begin the process of decommissioning your Firebase resources.

  2. Be sure to backup any remaining Firebase data you might need, then proceed to remove the Firebase projects from your console.

 

Want to explore opportunities to work with us?

Connect with our team to unlock the full potential of no-code solutions with a no-commitment consultation!

Book a Free Consultation

Client trust and success are our top priorities

When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.

Rapid Dev was an exceptional project management organization and the best development collaborators I've had the pleasure of working with. They do complex work on extremely fast timelines and effectively manage the testing and pre-launch process to deliver the best possible product. I'm extremely impressed with their execution ability.

CPO, Praction - Arkady Sokolov

May 2, 2023

Working with Matt was comparable to having another co-founder on the team, but without the commitment or cost. He has a strategic mindset and willing to change the scope of the project in real time based on the needs of the client. A true strategic thought partner!

Co-Founder, Arc - Donald Muir

Dec 27, 2022

Rapid Dev are 10/10, excellent communicators - the best I've ever encountered in the tech dev space. They always go the extra mile, they genuinely care, they respond quickly, they're flexible, adaptable and their enthusiasm is amazing.

Co-CEO, Grantify - Mat Westergreen-Thorne

Oct 15, 2022

Rapid Dev is an excellent developer for no-code and low-code solutions.
We’ve had great success since launching the platform in November 2023. In a few months, we’ve gained over 1,000 new active users. We’ve also secured several dozen bookings on the platform and seen about 70% new user month-over-month growth since the launch.

Co-Founder, Church Real Estate Marketplace - Emmanuel Brown

May 1, 2024 

Matt’s dedication to executing our vision and his commitment to the project deadline were impressive. 
This was such a specific project, and Matt really delivered. We worked with a really fast turnaround, and he always delivered. The site was a perfect prop for us!

Production Manager, Media Production Company - Samantha Fekete

Sep 23, 2022