Prepare for the PgBouncer and IPv4 deprecations on 26th January 2024

Getting Started

Framework Quickstarts

Use Supabase with Ruby on Rails

Learn how to create a Rails project and connect it to your Supabase Postgres database.


Create a Rails Project

Make sure your Ruby and Rails versions are up to date, then use rails new to scaffold a new Rails project. Use the -d=postgresql flag to set it up for Postgres.

Go to the Rails docs for more details.


rails new blog -d=postgresql


Set up the Postgres connection details

Go to and create a new Supabase project. Save your database password securely.

When your project is up and running, navigate to the database settings to find the URI connection string. Make sure Use connection pooling is checked and Session mode is selected. Then copy the URI. Replace the password placeholder with your saved database password.


export DATABASE_URL=postgres://


Create and run a database migration

Rails includes Active Record as the ORM as well as database migration tooling which generates the SQL migration files for you.

Create an example Article model and generate the migration files.


bin/rails generate model Article title:string body:text
bin/rails db:migrate


Use the Model to interact with the database

You can use the included Rails console to interact with the database. For example, you can create new entries or list all entries in a Model's table.


bin/rails console


article = "Hello Rails", body: "I am on Rails!")
_10 # Saves the entry to the database


Start the app

Run the development server. Go to in a browser to see your application running.


bin/rails server