Skip to content

Latest commit

 

History

History
52 lines (33 loc) · 1.88 KB

File metadata and controls

52 lines (33 loc) · 1.88 KB

PowerSync CLI Demo App

This demo features a CLI-based table view that stays live using a watch query, ensuring the data updates in real time as changes occur. To run this demo, you need to have one of our Node.js self-host demos (Postgres | MongoDB | MySQL) running, as it provides the PowerSync server that this CLI's PowerSync SDK connects to.

Changes made to the backend's source DB or to the self-hosted web UI will be synced to this CLI client (and vice versa).

Connection Options

By default, this demo uses the NodeConnector for connecting to the PowerSync server. However, you can swap this out with the SupabaseConnector if needed

  1. Copy the .env.template file to a new .env file:

    # On Linux/macOS
    cp .env.template .env
    
    # On Windows
    copy .env.template .env
  2. Replace the necessary fields in the .env file with your Supabase and PowerSync credentials.

Authentication

This essentially uses anonymous authentication. A random user ID is generated and stored in local storage. The backend returns a valid token which is not linked to a specific user. All data is synced to all users.

Note for Supabase users:
If you are using USE_SUPABASE=true, this demo expects a valid, already existing Supabase user.
You must provide their credentials via the .env file using SUPABASE_USERNAME and SUPABASE_PASSWORD.

Getting Started

In the repo root, run the following to download the PowerSync extension:

dotnet run --project Tools/Setup    

Then switch into the demo's directory:

Install dependencies:

dotnet restore

To run the Command-Line interface:

dotnet run Demo