Skip to content

Commit c9c7ee2

Browse files
author
Hein
committed
Merge remote-tracking branch 'origin/docs' into feat/tutorials
2 parents c3f54b7 + 37e3d9a commit c9c7ee2

File tree

8 files changed

+104
-130
lines changed

8 files changed

+104
-130
lines changed

installation/authentication-setup/supabase-auth.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ You can implement various types of auth:
1717
* [Example](https://github.com/powersync-ja/powersync-jwks-example/)
1818
* Experimental: We've also heard from the community that Supabase's newly released [support for external auth providers works](https://supabase.com/blog/third-party-auth-mfa-phone-send-hooks), but we don't have any examples for this yet.
1919

20+
<Note>
21+
The "Supabase Auth" setting no longer works for Supabase projects created after 25 November 2024. While we are working with Supabase on a fix, please apply this workaround: https://releases.powersync.com/announcements/important-notice-for-supabase-users-using-supabase-jwts
22+
</Note>
23+
2024
To implement either Supabase Auth or Anonymous Sign-Ins, enable the "Use Supabase Auth" setting on the PowerSync instance. (This is also [covered in the Supabase & PowerSync integration guide](/integration-guides/supabase-+-powersync#configuring-powersync))
2125

2226
Internally, Supabase auth signs the token using HS256, using a secret available as `current_setting('app.settings.jwt_secret')` on the database.

installation/database-connection.mdx

Lines changed: 11 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,12 @@ title: "Database Connection"
33
description: "Connect a PowerSync Cloud instance to your backend database."
44
---
55

6-
## Create a PowerSync Instance
6+
import CreateCloudInstance from '/snippets/create-cloud-instance.mdx';
7+
import SupabaseConnection from '/snippets/supabase-database-connection.mdx';
78

8-
1. In the [PowerSync Dashboard](/usage/tools/powersync-dashboard) project tree (PowerSync Cloud), click on "**Create new instance**":
9+
## Create a PowerSync Cloud Instance
910

10-
<Frame>
11-
<img src="/images/usage-12.png"/>
12-
</Frame>
13-
14-
1. Give your instance a name, such as "Todolist Testing".
15-
2. Under the "**General**" tab, you can change the default cloud region from "US" to "EU", "JP" (Japan), or "AU" (Australia) if desired (more cloud regions are available, [contact us](/resources/contact-us) if you need a different region).
16-
3. Under the **"DB Connections"** tab, click on the **+** icon.
11+
<CreateCloudInstance/>
1712

1813
Each provider has their quirks when it comes to specifying connection details, so we have documented provider-specific instructions below.
1914

@@ -22,33 +17,17 @@ Each provider has their quirks when it comes to specifying connection details, s
2217
Select your Postgres hosting provider for steps to connect your Postgres database to the newly created PowerSync instance:
2318
<AccordionGroup>
2419
<Accordion title="Supabase">
25-
1. Get your connection details from Supabase:
26-
* In your Supabase dashboard, navigate to **"Project Settings"** \-> **"Database" -> "Connection string**" and select the "URI" tab.
27-
* Uncheck the "**Display connection pooler**" checkbox. PowerSync needs to connect to the database directly and cannot use the pooler.
28-
<Frame>
29-
<img src="/images/usage-13.avif"/>
30-
</Frame>
31-
* Copy the connection string. The hostname should be `db.<PROJECT-ID>.supabase.co`, and not, for example, `aws-0-us-west-1.pooler.supabase.com`.
32-
* Paste this URI into the connection URI field.
33-
* Enter the password for the `postgres` user in your Supabase database
34-
* Supabase also [refers to this password](https://supabase.com/docs/guides/database/managing-passwords) as the _database password_ or _project password_.
35-
* PowerSync has the Supabase CA certificate pre-configured — `verify-full` SSL mode can be used directly, without any custom certificates.
36-
* If you want to query your database via the PowerSync dashboard, enable "_Allow querying in the editor?_".
37-
1. Click **"Test Connection"** and fix any errors.
38-
2. Under the **"Client Auth"** tab, enable **"Use Supabase Auth".**
39-
3. Click **"Save".**
20+
<SupabaseConnection/>
4021

41-
PowerSync deploys and configures an isolated cloud environment for you, which can take a few minutes to complete.
42-
43-
### Troubleshooting
22+
### Troubleshooting
4423

45-
Supabase is configured with a maximum of 4 logical replication slots, with one often used for Supabase Realtime.
24+
Supabase is configured with a maximum of 4 logical replication slots, with one often used for Supabase Realtime.
4625

47-
It is therefore easy to run out of replication slots, resulting in an error such as "All replication slots are in use" when deploying. To resolve this, delete inactive replication slots by running this query:
26+
It is therefore easy to run out of replication slots, resulting in an error such as "All replication slots are in use" when deploying. To resolve this, delete inactive replication slots by running this query:
4827

49-
```sql
50-
select slot_name, pg_drop_replication_slot(slot_name) from pg_replication_slots where active = false;
51-
```
28+
```sql
29+
select slot_name, pg_drop_replication_slot(slot_name) from pg_replication_slots where active = false;
30+
```
5231
</Accordion>
5332
<Accordion title="AWS RDS">
5433
1. [Locate the connection details from RDS](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER%5FConnectToPostgreSQLInstance.html):

integration-guides/flutterflow-+-powersync.mdx

Lines changed: 11 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ description: "Integration guide for creating offline-first apps with FlutterFlow
44
sidebarTitle: Overview
55
---
66

7+
import CreateCloudInstance from '/snippets/create-cloud-instance.mdx';
8+
import SupabaseConnection from '/snippets/supabase-database-connection.mdx';
9+
710
<Frame caption="Video walkthrough of the integration guide.">
811
<iframe width="1005" height="420" src="https://www.youtube.com/embed/eUcBCyPfVok?si=WFPfEp-86Dr_3qh_" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
912
</Frame>
@@ -74,33 +77,11 @@ create publication powersync for table public.lists;
7477

7578
## Configure PowerSync
7679

77-
### Connect PowerSync to Your Supabase
78-
79-
1. In the [PowerSync dashboard](/usage/tools/powersync-dashboard) Project tree, click on "**Create new instance**":
80-
81-
<Frame>
82-
<img src="/images/integration-20.png" width="60%"/>
83-
</Frame>
80+
### Create a PowerSync Cloud Instance
81+
<CreateCloudInstance />
8482

85-
1. Give your instance a name, such as "Supabase Testing".
86-
2. Under the "**General**" tab, you can change the default cloud region from US to EU, JP (Japan), or AU (Australia) if desired (more cloud regions are available, [contact us](/resources/contact-us) if you need a different region).
87-
3. Under the "DB Connections" tab, click on the + icon.
88-
4. Now we get the connection details from Supabase:
89-
* In your Supabase dashboard, navigate to **"Project Settings"** \-> **"Database" -> "Connection string**" and select the "URI" tab.
90-
* Uncheck the "**Display connection pooler**" checkbox. PowerSync needs to connect to the database directly and cannot use the pooler.
91-
<Frame>
92-
<img src="/images/integration-21.png"/>
93-
</Frame>
94-
It is important to uncheck this checkbox
95-
* Copy the connection string. The hostname should be `db.<PROJECT-ID>.supabase.co`, and not, for example, `aws-0-us-west-1.pooler.supabase.com`.
96-
* Paste this URI in PowerSync the instance **URI** field.
97-
* Enter the password for the `postgres` user in your Supabase database: (Supabase also [refers to this password](https://supabase.com/docs/guides/database/managing-passwords) as the _database password_ or _project password_).
98-
* PowerSync has the Supabase CA certificate pre-configured — `verify-full` SSL mode can be used directly, without any custom certificates.
99-
1. Click **"Test Connection"** and fix any errors.
100-
2. Under the **"Client Auth"** tab, enable **"Use Supabase Auth".**
101-
3. Click **"Save".**
102-
103-
PowerSync deploys and configures an isolated cloud environment for you, which will take a few minutes to complete.
83+
### Connect PowerSync to Your Supabase
84+
<SupabaseConnection />
10485

10586
### Configure Sync Rules
10687

@@ -672,19 +653,18 @@ Below is a list of known issues and limitations.
672653

673654
1. It's not currently possible to use the FlutterFlow Web Editor to test your app due to limitations with FlutterFlow.
674655
2. When trying to compile any of the PowerSync Custom Actions, you will see errors — these can be safely ignored:
675-
676656
<Frame>
677657
<img src="/images/integration-67.png" width="60%" />
678658
</Frame>
679659
<Frame>
680660
<img src="/images/integration-69.png" width="60%" />
681661
</Frame>
682-
1. Using `watch()` queries creates a [StreamSubscription](https://api.flutter.dev/flutter/dart-async/StreamSubscription-class.html) and it's important to regularly call `.cancel()` on these to avoid multiple subscriptions for the same query running.
683-
2. Deploying to the Apple App Store currently requires some workarounds due to limitations in FlutterFlow:
662+
3. Using `watch()` queries creates a [StreamSubscription](https://api.flutter.dev/flutter/dart-async/StreamSubscription-class.html) and it's important to regularly call `.cancel()` on these to avoid multiple subscriptions for the same query running.
663+
4. Deploying to the Apple App Store currently requires some workarounds due to limitations in FlutterFlow:
684664
1. Download the code from FlutterFlow
685665
2. Open the `Podfile` located in the `ios/`directory
686666
3. The following option in the `Podfile` needs to be updated from `use_frameworks! :linkage => :static` to `use_frameworks!` (remove everything after the exclamation sign)
687667
4. After removing that option, clean the build folder and build the project again.
688668
5. You should now be able to submit to the App Store
689-
3. Exporting the code from FlutterFlow using the "Download Code" action in FlutterFlow requires the same workaround listed in 4\. above.
690-
4. Other common issues and troubleshooting techniques are documented here: [Troubleshooting](/resources/troubleshooting)
669+
5. Exporting the code from FlutterFlow using the "Download Code" action in FlutterFlow requires the same workaround listed in 4\. above.
670+
6. Other common issues and troubleshooting techniques are documented here: [Troubleshooting](/resources/troubleshooting)

integration-guides/supabase-+-powersync.mdx

Lines changed: 8 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ description: "Tutorial-style integration guide for creating offline-first apps w
44
sidebarTitle: Overview
55
---
66

7+
import CreateCloudInstance from '/snippets/create-cloud-instance.mdx';
8+
import SupabaseConnection from '/snippets/supabase-database-connection.mdx';
9+
710
<Frame caption="Video walkthrough of the integration guide.">
811
<iframe width="1005" height="420" src="https://www.youtube.com/embed/80mnzGkeNgw?si=uVbQusPi3C2yy0Cu" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
912
</Frame>
@@ -106,39 +109,14 @@ create publication powersync for table public.lists, public.todos;
106109
<Info>
107110
**Note:** this guide uses the default `postgres` user in your Supabase account for replicating changes to PowerSync, since elevating custom roles to replication [has been disabled](https://github.com/orgs/supabase/discussions/9314) in Supabase. If you want to use a custom role for this purpose, contact the Supabase support team.
108111
</Info>
109-
## Configuring PowerSync
110-
111-
### Connect PowerSync to Your Supabase
112112

113-
1. In the [PowerSync Dashboard](/usage/tools/powersync-dashboard) Project tree, click on "**Create new instance**":
114-
115-
<Frame>
116-
<img src="/images/integration-2.png" width="60%" />
117-
</Frame>
118-
119-
2. Give your instance a name, such as "Supabase Testing".
120-
3. Under the "**General**" tab, you can change the default cloud region from US to EU, JP (Japan), or AU (Australia) if desired (more cloud regions are available, [contact us](/resources/contact-us) if you need a different region).
121-
4. Under the **"DB Connections"** tab, click on the **+** icon.
122-
5. Now we get the connection details from Supabase:
123-
* In your Supabase dashboard, navigate to **"Project Settings"** \-> **"Database" -> "Connection string**" and select the "URI" tab.
124-
* Uncheck the "**Display connection pooler**" checkbox. PowerSync needs to connect to the database directly and cannot use the pooler.
113+
## Configuring PowerSync
125114

126-
<Frame>
127-
<img src="/images/integration-3.png"/>
128-
</Frame>
129-
It is important to uncheck this checkbox
130-
* Copy the connection string. The hostname should be `db.<PROJECT-ID>.supabase.co`, and not, for example, `aws-0-us-west-1.pooler.supabase.com`.
131-
* Paste this URI in PowerSync instance URI field.
132-
* Enter the password for the `postgres` user in your Supabase database: (Supabase also [refers to this password](https://supabase.com/docs/guides/database/managing-passwords) as the _database password_ or _project password_).
133-
* PowerSync has the Supabase CA certificate pre-configured — `verify-full` SSL mode can be used directly, without any custom certificates.
134-
6. Click **"Test Connection"** and fix any errors.
135-
7. Under the **"Client Auth"** tab, enable **"Use Supabase Auth".**
136-
<Frame caption="PowerSync fetches the Supabase JWT key directly from the database.">
137-
<img src="/images/integration-4.png"/>
138-
</Frame>
139-
8. Click **"Save".**
115+
### Create a PowerSync Cloud Instance
116+
<CreateCloudInstance />
140117

141-
PowerSync deploys and configures an isolated cloud environment for you, which will take a few minutes to complete.
118+
### Connect PowerSync to Your Supabase
119+
<SupabaseConnection />
142120

143121
### Configure Sync Rules
144122

snippets/create-cloud-instance.mdx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
1. In the [PowerSync Dashboard](/usage/tools/powersync-dashboard) Project tree, click on "**Create new instance**":
2+
3+
<Frame>
4+
<img src="/images/integration-2.png" width="60%" />
5+
</Frame>
6+
7+
2. Give your instance a name, such as "Testing".
8+
3. Under the "**General**" tab, you can change the default cloud region from US to EU, JP (Japan), or AU (Australia) if desired.
9+
* Note: More cloud regions are available, [contact us](/resources/contact-us) if you need a different region.
10+
4. Under the **"DB Connections"** tab, click on the **+** icon and select your database technology.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
1. Copy the database connection details from Supabase:
3+
* In your Supabase dashboard, navigate to **"Project Settings"** \-> **"Database" -> "Connection string**" and select the "URI" tab.
4+
* Uncheck the "**Display connection pooler**" checkbox. PowerSync needs to connect to the database directly and cannot use the pooler.
5+
<Frame caption="It is important to uncheck this checkbox">
6+
<img src="/images/integration-3.png"/>
7+
</Frame>
8+
* Copy the connection string. The hostname should be `db.<PROJECT-ID>.supabase.co`, and not, for example, `aws-0-us-west-1.pooler.supabase.com`.
9+
* Paste this URI in PowerSync instance **URI** field.
10+
* Enter the **Password** for the `postgres` user in your Supabase database.
11+
* Supabase also [refers to this password](https://supabase.com/docs/guides/database/managing-passwords) as the _database password_ or _project password_.
12+
* PowerSync has the Supabase CA certificate pre-configured — `verify-full` SSL mode can be used directly, without any custom certificates.
13+
2. Click **"Test Connection"** and fix any errors.
14+
3. Under the **"Client Auth"** tab, enable **"Use Supabase Auth"**:
15+
<Frame caption="PowerSync fetches the Supabase JWT key directly from the database.">
16+
<img src="/images/integration-4.png"/>
17+
</Frame>
18+
4. Click **"Save".**
19+
20+
<Note>
21+
The "Supabase Auth" setting no longer works for Supabase projects created after 25 November 2024. While we are working with Supabase on a fix, please apply this workaround: https://releases.powersync.com/announcements/important-notice-for-supabase-users-using-supabase-jwts
22+
</Note>
23+
24+
PowerSync deploys and configures an isolated cloud environment for you, which will take a few minutes to complete.

0 commit comments

Comments
 (0)