Skip to content

docs: add database.sql and sync-rules.yaml to react-supabase-todolist demo#921

Open
JexanJoel wants to merge 3 commits intopowersync-ja:mainfrom
JexanJoel:fix/react-supabase-todolist-setup-files
Open

docs: add database.sql and sync-rules.yaml to react-supabase-todolist demo#921
JexanJoel wants to merge 3 commits intopowersync-ja:mainfrom
JexanJoel:fix/react-supabase-todolist-setup-files

Conversation

@JexanJoel
Copy link
Copy Markdown

@JexanJoel JexanJoel commented Apr 4, 2026

Fixes #860

The react-supabase-todolist demo was missing the Supabase database setup file and PowerSync sync rules that other demos in this repo include (e.g. react-native-web-supabase-todolist).

This PR adds:

  • database.sql - creates the lists and todos tables, enables RLS with policies scoped to owner_id, and creates the powersync publication
  • sync-rules.yaml - defines the user_lists bucket scoped per authenticated user
  • Updates README.md with numbered step-by-step setup instructions referencing these new files

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 4, 2026

⚠️ No Changeset found

Latest commit: efdc7b2

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Copy Markdown
Contributor

@simolus3 simolus3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

@@ -0,0 +1,7 @@
bucket_definitions:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use the Sync Stream syntax for this? Also, we should perhaps rename this to sync-streams.yaml.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes we can. btw done Renamed the file to sync-streams.yaml and updated the content to use the sync_streams syntax.

);

-- Create PowerSync role for replication access
CREATE ROLE powersync_role REPLICATION LOGIN;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we should also add a note to set a password then?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a comment with instructions to set a password for the role.

@@ -0,0 +1,7 @@
sync_streams:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a valid configuration file, it should be something like this:

config:
  edition: 3

streams:
  user_data:
    auto_subscribe: true
    queries:
      # Separate stream per todo list, scoped to the authenticated user
      - SELECT * FROM lists WHERE owner_id = auth.user_id()
      - SELECT todos.* FROM todos INNER JOIN lists ON todos.list_id = lists.id WHERE lists.owner_id = auth.user_id()

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to use the new format with config: edition: 3 and streams syntax, scoped to the authenticated user. Any changes?

@benitav
Copy link
Copy Markdown
Contributor

benitav commented Apr 8, 2026

I realize we're not consistent with all our demos in this repo yet, but for easier maintainability going forward (not having to update instructions in 20+ demo app Readmes) and approach we adopted in several of the Supabase-based demo app Readmes here is to link to these sections in the docs which should cover all required steps to run the demo (including setting Sync Streams):

Prerequisites:

  • To run this demo, you need to have properly configured Supabase and PowerSync projects. Follow the instructions in our Supabase<>PowerSync integration guide:

I'm curious if you just missed these, or if there's an issue with those instructions, or another reason?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The react-supabase-todolist demo project is missing setup steps.

3 participants