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.

Book a call with an Expert
Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.
Step 1: Set Up a Supabase Account and Project
First, sign up for a Supabase account at https://supabase.io/. You can use your email or a GitHub account to register.
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.
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
Go to your Firebase console at https://console.firebase.google.com/.
Choose the project that you want to migrate and navigate to the "Firestore Database" section.
Click on the "Data" tab, and then click the "Export" option. Save the exported data in a JSON format.
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
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.
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
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.
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
If Firebase Authentication is used, replicate the authentication setup in Supabase by navigating to the "Authentication" tab.
Set up authentication providers (like Google, Facebook, etc.) similar to what was configured in Firebase by enabling the necessary options and configuring credentials.
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
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
Initialize Supabase in your application:
import { createClient } from '@supabase/supabase-js';
const supabase = createClient('https://your-project-url.supabase.co', 'your-anon-key');
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
Run your application and thoroughly test all functionalities to ensure they interact correctly with Supabase as they did with Firebase.
Pay special attention to data retrieval, storage, and user authentication scenarios.
Debug any issues that arise, checking logs in the Supabase console for more details if needed.
Step 8: Decommission Firebase
Once you’ve confirmed the application is functioning correctly with Supabase, you can begin the process of decommissioning your Firebase resources.
Be sure to backup any remaining Firebase data you might need, then proceed to remove the Firebase projects from your console.
When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.