You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: demos/react-supabase-todolist/README.md
+20-13Lines changed: 20 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,33 +8,42 @@ This demo uses [Sync Streams](https://docs.powersync.com/usage/sync-streams). Bo
8
8
9
9
## Run Demo
10
10
11
-
Prerequisites:
12
-
* To run this demo, you need to have properly configured Supabase and PowerSync projects. Follow the instructions in our Supabase<>PowerSync integration guide:
Create a new Supabase project, then run the contents of [`database.sql`](./database.sql) in the [Supabase SQL editor](https://supabase.com/dashboard/project/_/sql). This will:
14
+
15
+
- Create the `lists` and `todos` tables
16
+
- Enable Row Level Security (RLS) so users can only access their own data
17
+
- Create a `powersync` publication for replication
18
+
19
+
### 2. PowerSync Setup
20
+
21
+
Create a new PowerSync instance connected to your Supabase project ([instructions here](https://docs.powersync.com/integration-guides/supabase-+-powersync#connect-powersync-to-your-supabase)).
22
+
23
+
In the PowerSync dashboard, go to **Sync Streams** (shown as **Sync Rules** if using legacy Sync Rules) and paste the contents of [`sync-streams.yaml`](./sync-streams.yaml).
24
+
25
+
### 3. Install Dependencies
17
26
27
+
Switch into the demo's directory:
18
28
```bash
19
29
cd demos/react-supabase-todolist
20
30
```
21
31
22
32
Use [pnpm](https://pnpm.io/installation) to install dependencies:
23
-
24
33
```bash
25
34
pnpm install
26
35
```
27
36
28
-
Set up the Environment variables: Copy the `.env.local.template` file:
37
+
### 4. Configure Environment Variables
29
38
39
+
Copy the `.env.local.template` file:
30
40
```bash
31
41
cp .env.local.template .env.local
32
42
```
33
43
34
-
And then edit `.env.local` to insert your credentials for Supabase.
35
-
36
-
Run the development server:
44
+
Edit `.env.local` to insert your Supabase URL, anon key, and PowerSync URL.
37
45
46
+
### 5. Run the Development Server
38
47
```bash
39
48
pnpm dev
40
49
```
@@ -46,13 +55,11 @@ Open [http://localhost:5173](http://localhost:5173) with your browser to see the
46
55
This demo is PWA compatible, and works fully offline. PWA is not available in development (watch) mode. The manifest and service worker is built using [vite-plugin-pwa](https://vite-pwa-org.netlify.app/).
47
56
48
57
Build the production codebase:
49
-
50
58
```bash
51
59
pnpm build
52
60
```
53
61
54
62
Run the production server:
55
-
56
63
```bash
57
64
pnpm preview
58
65
```
@@ -63,4 +70,4 @@ Open a browser on the served URL and install the PWA.
63
70
64
71
Check out [the PowerSync Web SDK on GitHub](https://github.com/powersync-ja/powersync-js/tree/main/packages/web) - your feedback and contributions are welcome!
65
72
66
-
To learn more about PowerSync, see the [PowerSync docs](https://docs.powersync.com).
73
+
To learn more about PowerSync, see the [PowerSync docs](https://docs.powersync.com).
0 commit comments