Skip to main content

Supabase

This guide explains how to connect Supabase to a PolyScale cache. Supabase is a Postgres compatible database that can be connected to PolyScale just like any other database. Read on for details of working with Supabase and PolyScale.

tip

PolyScale does not currently support connectivity to Supabase using the Supabase Javascript client. Presently, to use Supabase with PolyScale, you must make a TCP connection to the database. In the near future, PolyScale plans to introduce an HTTP API. See here to follow the progress.

The video below illustrates how to get connected. Or you can read the steps below.

Step 0: Create a PolyScale account

If you do not already have a PolyScale account, you can create an account here. PolyScale offers a free tier and no credit card is required.

Step 1: Create your PolyScale Cache

1.1 Retrieve your Supabase Host

In your Supabase project, click on Settings > Database and scroll down to the Connection info section to copy your database Host.

supabase-host

1.2 Configure your PolyScale Cache

  • In your PolyScale account, click on the New Cache button
  • Give the cache a Name
  • Select PostgreSQL for the Type
  • Enter the Host from Step 1.1 above
  • Enter 5432 for the Port
  • Click Create
Create Cache

Your cache is now created. PolyScale automatically checks to see that your database is accessible from all our global PoPs.

Step 2: Connect to your PolyScale Cache

Using your PolyScale cache is simple -- instead of connecting to your Supabase database directly, you'll replace your original connection string with the PolyScale connection string in your application.

For example, if your original connection string was: postgres://postgres:zqGHFAbPLvVCKw@db.rogpiubvixysbakciwqz.supabase.co:5432/employees

Your PolyScale connection string would be: postgres://postgres:zqGHFAbPLvVCKw@psedge.global:5432/employees?application_name=a645cb93-fa53-46b2-9d6c-227e357e5bfb

That's it.