> ## Documentation Index
> Fetch the complete documentation index at: https://sequinstream.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Connecting to Supabase

> Elevate your Supabase project with reliable Postgres change data capture (CDC). Use Sequin to replace webhooks and trigger edge functions.

This guide provides step-by-step instructions to connect your Supabase [Postgres database](https://supabase.com/docs/guides/database) to Sequin.

## Connect Sequin to your Supabase database

<Steps titleSize="h3">
  <Step title="Get your database connection details">
    Login to Supabase and navigate to the database settings page ("Project Settings" > "Database").
  </Step>

  <Step title="Copy your database connection details">
    In the "Connection string" section, copy the connection string for your database (e.g. `postgresql://<username>:<password>@<host>:5432/<database>?sslmode=require`).
  </Step>

  <Step title="Enter the connection details in Sequin">
    In Sequin web console, navigate to the "Databases" tab and click on the "Connect Database" button. Click the "Autofill with Connection String" button and paste the connection string you copied in the previous step.

    Click "Autofill" to have Sequin prefill the connection details.

    <Note>
      Your database password is not included in the Supabase connection string, so you'll need to enter your password in the "Password" field.
    </Note>
  </Step>

  <Step title="Create a publication">
    In the Supabase SQL editor, execute the following SQL query to create a publication:

    ```sql theme={null}
    CREATE PUBLICATION sequin_pub FOR TABLE table1, table2, table3 WITH (publish_via_partition_root = true);
    ```

    If you want to publish changes from all tables, you can use:

    ```sql theme={null}
    CREATE PUBLICATION sequin_pub FOR ALL TABLES WITH (publish_via_partition_root = true);
    ```
  </Step>

  <Step title="Create a replication slot">
    Next, create a replication slot to capture changes from the publication:

    ```sql theme={null}
    SELECT pg_create_logical_replication_slot('sequin_slot', 'pgoutput');
    ```
  </Step>

  <Step title="Enter the replication slot details in Sequin">
    Back in the Sequin Console, enter the name of the replication slot (e.g. `sequin_slot`) and publication (e.g. `sequin_pub`) you just created. Then, name your database and click **Create Database**.
  </Step>
</Steps>

## Create sinks to replace database webhooks and triggers

With your Supabase database connected to Sequin, you can create sinks to replace your database webhooks and triggers. Follow one of our guides below to get started:

<CardGroup cols={2}>
  <Card title="Migrate Supabase Webhooks" icon="bolt" href="/guides/supabase-webhooks">
    Move your existing Supabase webhooks to Sequin for better reliability and observability
  </Card>

  <Card title="Trigger Supabase Edge Functions" icon="bolt" href="/guides/supabase-function">
    Trigger Supabase edge functions from database changes with retries and filtering
  </Card>

  <Card title="Stream to Redis Streams" icon="layer-group" href="/how-to/stream-postgres-to-redis-stream">
    Stream changes to Redis Streams for real-time data processing and caching
  </Card>

  <Card title="Stream to SQS" icon="aws" href="/how-to/stream-postgres-to-sqs">
    Send changes to AWS SQS queues to trigger Lambda functions and other AWS services
  </Card>
</CardGroup>
