Skip to main content

Supabase

Overview

Supabase is an open-source Firebase alternative built on top of PostgreSQL. It provides a fully managed Postgres database with additional features like authentication, real-time subscriptions, and storage. Since Supabase uses PostgreSQL under the hood, you can connect to it using standard PostgreSQL connection methods. Rill supports connecting to Supabase databases using either individual connection parameters or a connection string/URI.

Authentication Methods

To connect to Supabase, you need your database connection credentials. You can find these in your Supabase project dashboard under Settings > Database.

  1. Use Individual Parameters (recommended for clarity)
  2. Use Connection String/URI (alternative format)

When you add data from Supabase through the Rill UI, the process follows two steps:

  1. Configure Authentication - Set up your Supabase connector with database credentials
  2. Configure Data Model - Define which table or query to execute

This two-step flow ensures your credentials are securely stored in the connector configuration, while your data model references remain clean and portable.

Using individual parameters provides clear, readable configuration for your Supabase connection.

Using the UI

  1. Click Add Data in your Rill project
  2. Select Supabase as the data source type
  3. In the authentication step:
    • Enter your host (e.g., aws-0-us-east-1.pooler.supabase.com)
    • Enter the port (default: 5432)
    • Enter your database name (default: postgres)
    • Enter your username (e.g., postgres.[your-project-ref])
    • Enter your password
  4. In the data model configuration step, enter your SQL query
  5. Click Create to finalize

After the model YAML is generated, you can add additional model settings directly to the file.

Manual Configuration

If you prefer to configure manually:

Step 1: Create connector configuration

Create connectors/supabase.yaml:

type: connector
driver: postgres

host: "aws-0-us-east-1.pooler.supabase.com"
port: "5432"
user: "postgres.[your-project-ref]"
password: "{{ .env.SUPABASE_PASSWORD }}"
dbname: "postgres"
sslmode: "require"

Step 2: Add credentials to .env

SUPABASE_PASSWORD=your_password_here
Did you know?

If this project has already been deployed to Rill Cloud and credentials have been set for this connector, you can use rill env pull to pull these cloud credentials locally (into your local .env file). Please note that this may override any credentials you have set locally for this source.

Then, create your first model.

Method 2: Connection String/URI

You can also use a connection string or URI format to configure your Supabase connection. You can find your connection string in the Supabase dashboard under Settings > Database > Connection string.

Connection URI Format

postgresql://postgres.[your-project-ref]:[password]@aws-0-[region].pooler.supabase.com:5432/postgres

Manual Configuration

Step 1: Create connector configuration

Create connectors/supabase.yaml:

type: connector
driver: postgres

dsn: "{{ .env.SUPABASE_DSN }}"

Step 2: Add credentials to .env

SUPABASE_DSN=postgresql://postgres.[your-project-ref]:[password]@aws-0-[region].pooler.supabase.com:5432/postgres

Then, create your first model.

Create Your First Model

Once your connector is configured using any method above, create a model to define what data to pull.

Create models/supabase_data.yaml:

type: model
connector: supabase
dev:
sql: SELECT * FROM my_table limit 10000

sql: SELECT * FROM my_table

After creating the model, you can add additional model settings directly to the file.

Separating Dev and Prod Environments

When ingesting data locally, consider setting parameters in your connector file to limit how much data is retrieved, since costs can scale with the data source. This also helps other developers clone the project and iterate quickly by reducing ingestion time.

For more details, see our Dev/Prod setup docs.

Deploy to Rill Cloud

When deploying a project to Rill Cloud, Rill requires you to explicitly provide the Supabase database connection credentials with access to Supabase used in your project. Please refer to our connector YAML reference docs for more information.

If you subsequently add sources that require new credentials (or if you simply entered the wrong credentials during the initial deploy), you can update the credentials by pushing the Deploy button to update your project or by running the following command in the CLI:

rill env push
Did you know?

If you've already configured credentials locally (in your <RILL_PROJECT_DIRECTORY>/.env file), you can use rill env push to push these credentials to your Rill Cloud project. This will allow other users to retrieve and reuse the same credentials automatically by running rill env pull.