Using Supabase as your Database for Remix

SaasRock uses Supabase as its PostgreSQL database provider, but there are a few things to be aware of when using supabase and remix.

  • Alexandro Martínez
    Author
    by Alexandro Martínez
    2 years ago
  • SaasRock uses Supabase as its PostgreSQL database provider, but there are a few things to be aware of when hosting in a Serverless environment like Vercel.

    Development Connection String

    Seed your remote database or test locally using the following Connection String configuration:

    DATABASE_URL="postgresql://{USER}:{PASSWORD}@{HOST}:5432/postgres"

    Production Connection String

    If you deploy your app to a serverless environment, you need to use the Connection Pooling configuration:

    DATABASE_URL=postgres://{USER}:{PASSWORD}@{HOST}:6543/postgres?pgbouncer=true

    Supabase Documentation

    Click here to learn more about this on the Supabase documentation.

    Otherwise, you could get the following error:

    Remaining connection slots are reserved for non-replication superuser connections
    Connection slots error

    Database and Hosting regions should be the same

    In my case, I'm using Fly.io as my hosting provider, in the "iad", which is us-east-1 (Virginia).

    fly-machine-regions.png

    So my database region should be somewhere close to Virginia. Both Supabase and Fly use AWS so it's the same region: us-east-1.

    supabase-regions.png


    I hope this quick guide was useful! Let me know if you have any questions.

    We respect your privacy.

    TLDR: We use cookies for language selection, theme, and analytics. Learn more.