Skip to content

Commit 917aa52

Browse files
authored
Supabase guide improvements (#108)
* Bring supabase guide instructions in line with updated video * Update another image
1 parent 8296252 commit 917aa52

16 files changed

+50
-48
lines changed
138 KB
Loading
11.2 KB
Loading

images/installation/edit-instance.png

269 KB
Loading
Loading
1.52 MB
Loading
65.6 KB
Loading
845 KB
Loading
147 KB
Loading

images/integration-5.png

-48.9 KB
Binary file not shown.

images/integration-6.png

-26.4 KB
Binary file not shown.

images/integration-7.png

-35.8 KB
Binary file not shown.
Binary file not shown.

integration-guides/supabase-+-powersync.mdx

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ sidebarTitle: Overview
66

77
import CreateCloudInstance from '/snippets/create-cloud-instance.mdx';
88
import SupabaseConnection from '/snippets/supabase-database-connection.mdx';
9+
import ConfigureSyncRules from '/snippets/configure-sync-rules.mdx';
910

1011
<Frame caption="Video walkthrough of the integration guide.">
1112
<iframe width="1005" height="420" src="https://www.youtube.com/embed/Xg5FTYGPn5U?si=4TjdYEACDR2g98yh" 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></Frame>
@@ -118,35 +119,7 @@ create publication powersync for table public.lists, public.todos;
118119
<SupabaseConnection />
119120

120121
### Configure Sync Rules
121-
122-
[Sync Rules](/usage/sync-rules) allow developers to control which data gets synced to which user devices using a SQL-like syntax in a YAML file. For the demo app, we're going to specify that each user can only see their own to-do lists and list items.
123-
124-
1. To update your sync rules, open the `sync-rules.yaml` file.
125-
126-
<Frame>
127-
<img src="/images/integration-5.png" />
128-
</Frame>
129-
130-
2. Replace the `sync-rules.yaml` file's contents with the below:
131-
132-
```yaml
133-
bucket_definitions:
134-
user_lists:
135-
# Separate bucket per To-Do list
136-
parameters: select id as list_id from lists where owner_id = request.user_id()
137-
data:
138-
- select * from lists where id = bucket.list_id
139-
- select * from todos where list_id = bucket.list_id
140-
```
141-
142-
3. In the top right, click **"Validate sync rules"** and ensure there are no errors. This validates your sync rules against your Postgres database.
143-
4. In the top right, click **"Deploy sync rules"** and select your instance.
144-
5. Confirm in the dialog and wait a couple of minutes for the deployment to complete.
145-
146-
<Tip>
147-
- For additional information on PowerSync's Sync Rules, refer to the [Sync Rules](/usage/sync-rules) documentation.
148-
- If you're wondering how Sync Rules relate to Supabase Postgres [RLS](https://supabase.com/docs/guides/auth/row-level-security), see [this subsection](/integration-guides/supabase-+-powersync/rls-and-sync-rules).
149-
</Tip>
122+
<ConfigureSyncRules />
150123

151124
## Test Everything (Using Our Demo App)
152125

@@ -234,7 +207,7 @@ SUPABASE_ANON_KEY=foo
234207
2. For the value of `powersyncUrl`, click the copy icon on your instance to copy its URL:
235208

236209
<Frame>
237-
<img src="/images/integration-7.png" width="60%"/>
210+
<img src="/images/installation/copy-instance-url.png" width="60%"/>
238211
</Frame>
239212
#### Run the app
240213

snippets/configure-sync-rules.mdx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[Sync Rules](/usage/sync-rules) allow developers to control which data gets synced to which user devices using a SQL-like syntax in a YAML file. For the demo app, we're going to specify that each user can only see their own to-do lists and list items.
2+
3+
1. The final step is to replace the Sync Rules file's contents with the below:
4+
5+
```yaml
6+
bucket_definitions:
7+
user_lists:
8+
# Separate bucket per To-Do list
9+
parameters: select id as list_id from lists where owner_id = request.user_id()
10+
data:
11+
- select * from lists where id = bucket.list_id
12+
- select * from todos where list_id = bucket.list_id
13+
```
14+
15+
<Frame>
16+
<img src="/images/installation/overview-sync-rules.png" />
17+
</Frame>
18+
19+
3. Click **"Validate sync rules"** and ensure there are no errors. This validates your sync rules against your Postgres database.
20+
4. Click **"Save and deploy"** to deploy your Sync Rules.
21+
22+
<Tip>
23+
- Your Sync Rules can be updated by navigating to the **Manage instances** workspace and selecting the `sync-rules.yaml` file.
24+
<img src="/images/installation/update-sync-rules.png" width="60%" />
25+
- For additional information on PowerSync's Sync Rules, refer to the [Sync Rules](/usage/sync-rules) documentation.
26+
- If you're wondering how Sync Rules relate to Supabase Postgres [RLS](https://supabase.com/docs/guides/auth/row-level-security), see [this subsection](/integration-guides/supabase-+-powersync/rls-and-sync-rules).
27+
</Tip>

snippets/create-cloud-instance.mdx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
1. In the [PowerSync Dashboard](/usage/tools/powersync-dashboard) Project tree, click on "**Create new instance**":
2-
3-
<Frame>
4-
<img src="/images/installation/create-new-instance.png" width="60%" />
5-
</Frame>
6-
1+
1. In the **Overview** workspace of the [PowerSync Dashboard](/usage/tools/powersync-dashboard) you will be prompted to create your first instance:
2+
<Frame>
3+
<img src="/images/installation/overview-create-instance.png" />
4+
</Frame>
5+
<Note>
6+
If you previously created an instance, you can create a secondary instance by navigating to the **Manage instances** workspace and clicking on **Create new instance**.
7+
<img src="/images/installation/create-new-instance.png" width="40%" />
8+
</Note>
79
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), AU (Australia) or BR (Brazil) if desired.
10+
3. [Optional] You can change the default cloud region from US to EU, JP (Japan), AU (Australia) or BR (Brazil) if desired.
911
* Note: Additional cloud regions will be considered on request, especially for customers on our Enterprise plan. Please [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.
12+
4. [Optional] You can opt in to using the Beta version of the Service, which may contain early access or experimental features. Always use the Stable version in production.
13+
5. Click **Next**.

snippets/supabase-database-connection.mdx

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,19 @@
1919
Your connection settings should look similar to this:
2020

2121
<Frame>
22-
<img src="/images/integration-guides/powersync-supabase-connection.png" />
22+
<img src="/images/installation/overview-connection-details.png" />
2323
</Frame>
2424

2525
2. Verify your setup by clicking **Test Connection** and resolve any errors.
2626

27-
3. Configure authentication:
28-
* Navigate to the **Client Auth** tab
29-
* Enable **Use Supabase Auth**
30-
* Enter your Supabase **JWT Secret**
27+
3. Click **Next**.
28+
4. PowerSync will detect the Supabase connection and prompt you to enable Supabase auth. To enable it, copy your JWT Secret from the Supabase Dashboard's API settings and paste it into the form:
29+
<img src="/images/installation/overview-supabase-auth.png" width="60%" />
30+
5. Click **Enable Supabase auth** to finalize your connections settings.
3131

32-
<Frame caption="PowerSync will use this secret to validate Supabase JWTs">
33-
<img src="/images/authentication/use-supabase-auth.png" />
34-
</Frame>
35-
36-
4. Click **Save and deploy** to apply your changes.
32+
<Tip>
33+
You can update your instance settings by navigating to the **Manage instances** workspace, opening your instance options and selecting **Edit instance**.
34+
<img src="/images/installation/edit-instance.png" width="60%" />
35+
</Tip>
3736

3837
PowerSync will now create an isolated cloud environment for your instance. This process typically takes a few minutes.

0 commit comments

Comments
 (0)