February 10, 2023

A Comprehensive Guide to Migrate your Database From Supabase to HarperDB

Welcome to Community Posts
Click below to read the full article.
Summary of What to Expect
Table of Contents
  1. Two migration methods: Choose between downloading data from Supabase as CSV and using the HarperDB REST API for bulk insert, or use Fastify to connect to Supabase, query data, and directly upload it to HarperDB.
  2. Understand the Supabase data: Identify the specific table (e.g., "bio") and its columns (id, name, age, email, city) that you want to migrate.
  3. Create a HarperDB cloud instance: Sign up for HarperDB, provide necessary information, choose instance type (e.g., AWS or Verizon Wavelength), select a cloud provider (e.g., HarperDB Cloud on AWS), fill in instance details (e.g., name, credentials), specify RAM, size, and region.
  4. Create a schema and table in HarperDB: Set up a schema (e.g., "UserData") and a table (e.g., "bio") with a hash attribute of "id."
  5. Migrate using CSV download/upload: Download the Supabase database as a CSV file by selecting all rows and exporting it. Import the CSV file to HarperDB using either the dashboard method or the REST API method, specifying the schema, table, and CSV URL or file path.
  6. Migrate using Fastify and Harperive: Install the required packages (harperive, fastify-supabase, dotenv) and configure Supabase and HarperDB in your project. Set up a Fastify connection to Supabase, and establish a connection to HarperDB using the Harperive Node.js driver.
  7. Start migration with Fastify: Create an app.js file, set up a Fastify server, register the fastify-supabase plugin, and establish connections to Supabase and HarperDB. Use Fastify to query data from Supabase (e.g., bio table) and insert it into HarperDB using the Harperive client. Access the migration endpoint (e.g., http://localhost:3000/migrate) in your browser to initiate the migration process.
  8. Verify migration: Check your HarperDB cloud instance to ensure that the data from Supabase has been successfully migrated.