This is a demo of the widget displayed on the PowerSync homepage and demonstrates how data flows from one PowerSync client to another. It also includes an implementation of Supabase's anonymous auth feature.
Note that some of the UI components are generated from elements created in (Webflow's Devlink)[https://webflow.com/devlink]. They can be found under src/devlink
. To make it easier to modify this project, these generated components are wrapped in facade components. The implementation detail of the facades can easily be changed to your own version that doesn't depend on devlink.
Note that this setup guide has minor deviations from the Supabase + PowerSync integration guide. Below we refer to sections in this guide where relevant.
In the repo directory, use pnpm to install dependencies:
pnpm install
pnpm build:packages
This demo app uses Supabase as its Postgres database and backend:
- Create a new project on the Supabase dashboard.
- Go to the Supabase SQL Editor for your new project and execute the SQL statements in
database.sql
to create the database schema, row level security (RLS) rules, and publication needed for PowerSync.
For ease of demoing, this app uses Supabase's anonymous sign-in feature.
Ensure that it is enabled under "Project Settings" -> "Authentication" in Supabase and confirming Allow anonymous sign-ins
is toggled on. Click "Save" if you toggled this setting.
The RLS rules defined in the database.sql
script are setup to only allow the anonymous user CRUD access to their pebbles.
Follow the Connect PowerSync to Your Supabase section.
Create sync rules by following the Configure Sync Rules section.
The sync rules for this demo are defined in sync-rules.yaml
in this directory. Copy its contents and paste it into the 'sync-rules.yaml' file in the Dashboard as described in the guide.
To set up the environment variables for the demo app, copy the .env.local.template
file:
cp .env.local.template .env.local
And then edit .env.local
to insert your credentials for Supabase and PowerSync.
In this directory, run the following to start the development server:
pnpm dev
Open http://localhost:5173 with your browser to try out the demo.