Skip to content

Commit 37e3d9a

Browse files
authored
Use snippets, and Flutterflow polish (#43)
* Fix numbering * Use snippets
1 parent d59c927 commit 37e3d9a

File tree

5 files changed

+64
-105
lines changed

5 files changed

+64
-105
lines changed

installation/database-connection.mdx

Lines changed: 11 additions & 36 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,37 +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".**
40-
41-
<Note>
42-
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
43-
</Note>
20+
<SupabaseConnection/>
4421

45-
PowerSync deploys and configures an isolated cloud environment for you, which can take a few minutes to complete.
46-
47-
### Troubleshooting
22+
### Troubleshooting
4823

49-
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.
5025

51-
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:
5227

53-
```sql
54-
select slot_name, pg_drop_replication_slot(slot_name) from pg_replication_slots where active = false;
55-
```
28+
```sql
29+
select slot_name, pg_drop_replication_slot(slot_name) from pg_replication_slots where active = false;
30+
```
5631
</Accordion>
5732
<Accordion title="AWS RDS">
5833
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 & 35 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,37 +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>
84-
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".**
80+
### Create a PowerSync Cloud Instance
81+
<CreateCloudInstance />
10282

103-
<Note>
104-
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
105-
</Note>
106-
107-
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 />
10885

10986
### Configure Sync Rules
11087

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

677654
1. It's not currently possible to use the FlutterFlow Web Editor to test your app due to limitations with FlutterFlow.
678655
2. When trying to compile any of the PowerSync Custom Actions, you will see errors — these can be safely ignored:
679-
680656
<Frame>
681657
<img src="/images/integration-67.png" width="60%" />
682658
</Frame>
683659
<Frame>
684660
<img src="/images/integration-69.png" width="60%" />
685661
</Frame>
686-
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.
687-
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:
688664
1. Download the code from FlutterFlow
689665
2. Open the `Podfile` located in the `ios/`directory
690666
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)
691667
4. After removing that option, clean the build folder and build the project again.
692668
5. You should now be able to submit to the App Store
693-
3. Exporting the code from FlutterFlow using the "Download Code" action in FlutterFlow requires the same workaround listed in 4\. above.
694-
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 & 34 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,43 +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
112-
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.
125112

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".**
113+
## Configuring PowerSync
140114

141-
<Note>
142-
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
143-
</Note>
115+
### Create a PowerSync Cloud Instance
116+
<CreateCloudInstance />
144117

145-
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 />
146120

147121
### Configure Sync Rules
148122

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)