Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Add docs for integrating with Sequin

thisisgoldman55e939d7ad5b
diff --git a/apps/reference/docs/guides/integrations/sequin.mdx b/apps/reference/docs/guides/integrations/sequin.mdx
new file mode 100644
index 00000000000..3ba6e7afae9
--- /dev/null
+++ b/apps/reference/docs/guides/integrations/sequin.mdx
@@ -0,0 +1,84 @@
+---
+id: sequin
+title: 'Sequin'
+description: 'Sync platforms like Stripe and Salesforce with your Supabase database in real-time using Sequin.'
+---
+
+This guide explains how to quickly setup a sync between Sequin and a Supabase Postgres database.
+
+[Sequin](https://sequin.io) allows you to sync platforms like Stripe and Salesforce with Supabase in real-time. You'll be able to read and write to your [Stripe](https://stripe.com/) customers or [Salesforce](https://www.salesforce.com/) accounts right from the Supabase client using SQL. Here's how to get setup.
+
+## Step 1: Connect Sequin to Supabase
+
+To connect Supabase to Sequin, you'll first need to retrieve the credentials for your Supabase Postgres database:
+
+1. In the Supabase dashboard, go to the settings page and open up your **Database** settings. In the **Connection info** section, you'll find the credentials you need - like `host` and `user`:
+
+ ![TBD](/img/guides/integrations/sequin/001_supabase_dash.png)
+
+2. In the [Sequin console](https://app.sequin.io), go to your sync's configuration and open the **Destination** section. Select **Launch or Connect** and then click **Connect** to configure the connection to your Supabase Postgres:
+
+ ![TBD](/img/guides/integrations/sequin/002_connect.png)
+
+3. In the connection modal that appears, enter the `Host` and `Port` for your Supabase database and click **Continue**.
+
+ ![TBD](/img/guides/integrations/sequin/003_step_1.png)
+
+4. Now, enter the `Database name` and set the `schema` name for your sync. For instance, if your syncing Stripe, you'll likely want to name your synced schema something like `stripe`. Finally, enter the `user` and `password` for your Supabase database and then click **Continue**. Sequin will verify it can properly connect to your database with the correct permissions.
+
+ ![TBD](/img/guides/integrations/sequin/004_step_2.png)
+
+5. Sequin is now connected to your Supabase Postgres database and will ask you to confirm which database users should be able to access your synced schema. Select all of the users and click **Continue**:
+
+ ![TBD](/img/guides/integrations/sequin/005_step_3.png)
+
+6. That's it. Sequin will now create a new schema and permissions group in your Supabase database. Name the database connection in Sequin something like `Supabase` and your done!
+
+In the Supabase dashboard, you can go to the **Table Editor** and you'll see a new schema full of your synced platform data.
+
+![TBD](/img/guides/integrations/sequin/006_see_data.png)
+
+## Step 2: Grant Permissions
+
+To ensure the right users can access the synced schema Sequin manages, you'll need to run a couple permission grants.
+
+1. In the Sequin console, click the **Connect** button next to your sync and copy down your `Schema` and unique `Read Group`.
+
+ ![TBD](/img/guides/integrations/sequin/007_get_read.png)
+
+2. Now, in the Supabase dashboard, go to the **SQL Editor** and run the following permission grants:
+
+ ```sql
+ GRANT sequin_read_▒▒▒▒ TO postgres, anon, authenticated, service_role;
+
+ GRANT USAGE ON SCHEMA {{your_schema_name}} TO anon, authenticated, service_role;
+
+ GRANT ALL ON ALL TABLES IN SCHEMA {{your_schema_name}} TO anon, authenticated, service_role;
+
+ ALTER DEFAULT PRIVILEGES FOR ROLE postgres, supabase_admin IN SCHEMA {{your_schema_name}} GRANT ALL ON TABLES TO anon, authenticated, service_role;
+ ```
+
+ These permission grants ensure that the various Supabase database users can access and read all the tables in your synced schema.
+
+## Step 3: Configure the Supabase Client
+
+Finally, you'll need to define a new [Supabase client](https://supabase.com/docs/reference/javascript/initializing#api-schemas) in your application to access your synced schema. In the file where you initialized your Supabase client, define a new client with a `schema` parameter:
+
+```javascript
+export const supabase_schema = createClient(
+ 'https://xyzcompany.supabase.co',
+ 'public-anon-key',
+ {
+ schema: {{your_schema_name}},
+ }
+);
+```
+
+You'll use this client to query for data in your synced schema.
+
+## Resources
+
+- [Sequin](https://sequin.io*) official website.
+- [Sequin Console](https://app.sequin.io*).
+- [Sequin](https://docs.sequin.io/welcome) documentation.
+- [Sequin + Supabase + Stripe Tutorial](https://github.com/sequin-io/build-a-saas-with-next-js-supabase-stripe-and-sequin)
diff --git a/apps/reference/nav/_referenceSidebars.js b/apps/reference/nav/_referenceSidebars.js
index 22babce04b3..18f272594f5 100644
--- a/apps/reference/nav/_referenceSidebars.js
+++ b/apps/reference/nav/_referenceSidebars.js
@@ -217,6 +217,7 @@ const sidebars = {
'guides/integrations/pgmustard',
'guides/integrations/plasmic',
'guides/integrations/prisma',
+ 'guides/integrations/sequin',
'guides/integrations/snaplet',
'guides/integrations/stytch',
'guides/integrations/supertokens',
diff --git a/apps/reference/static/img/guides/integrations/sequin/001_supabase_dash.png b/apps/reference/static/img/guides/integrations/sequin/001_supabase_dash.png
new file mode 100644
index 00000000000..131e6c5ef54
Binary files /dev/null and b/apps/reference/static/img/guides/integrations/sequin/001_supabase_dash.png differ
diff --git a/apps/reference/static/img/guides/integrations/sequin/002_connect.png b/apps/reference/static/img/guides/integrations/sequin/002_connect.png
new file mode 100644
index 00000000000..4831449f16c
Binary files /dev/null and b/apps/reference/static/img/guides/integrations/sequin/002_connect.png differ
diff --git a/apps/reference/static/img/guides/integrations/sequin/003_step_1.png b/apps/reference/static/img/guides/integrations/sequin/003_step_1.png
new file mode 100644
index 00000000000..4d3c79d101a
Binary files /dev/null and b/apps/reference/static/img/guides/integrations/sequin/003_step_1.png differ
diff --git a/apps/reference/static/img/guides/integrations/sequin/004_step_2.png b/apps/reference/static/img/guides/integrations/sequin/004_step_2.png
new file mode 100644
index 00000000000..218b2661948
Binary files /dev/null and b/apps/reference/static/img/guides/integrations/sequin/004_step_2.png differ
diff --git a/apps/reference/static/img/guides/integrations/sequin/005_step_3.png b/apps/reference/static/img/guides/integrations/sequin/005_step_3.png
new file mode 100644
index 00000000000..c15b47099b0
Binary files /dev/null and b/apps/reference/static/img/guides/integrations/sequin/005_step_3.png differ
diff --git a/apps/reference/static/img/guides/integrations/sequin/006_see_data.png b/apps/reference/static/img/guides/integrations/sequin/006_see_data.png
new file mode 100644
index 00000000000..bf0eb9f5c6a
Binary files /dev/null and b/apps/reference/static/img/guides/integrations/sequin/006_see_data.png differ
diff --git a/apps/reference/static/img/guides/integrations/sequin/007_get_read.png b/apps/reference/static/img/guides/integrations/sequin/007_get_read.png
new file mode 100644
index 00000000000..617ad51557f
Binary files /dev/null and b/apps/reference/static/img/guides/integrations/sequin/007_get_read.png differ
diff --git a/apps/reference/static/img/guides/integrations/sequin/008_grants.png b/apps/reference/static/img/guides/integrations/sequin/008_grants.png
new file mode 100644
index 00000000000..197516ad398
Binary files /dev/null and b/apps/reference/static/img/guides/integrations/sequin/008_grants.png differ