Skip to content

Commit 5d012d9

Browse files
dean-journeyappsjoshua-journey-appsmichaelbarnes
authored
Readme setup instructions (#6)
* fixed minimum node version requirement for vite 7 * remove unnecessary .degitignore * update README to include demo GIF and enhance project description * update README with correct links for PowerSync and Supabase sign-up * fix: update demo GIF link in README * chore: update README for improved link formatting and clarity in setup instructions * removed demo.gif * enhance README: reorganize setup instructions for PowerSync, swopping the order of setting up PowerSync through the dashboard and cli. Also added quick access links for Supabase settings * refactor(README): convert all HTML links back to standard Markdown hyperlinks --------- Co-authored-by: joshua-journey-apps <joshua@journeyapps.com> Co-authored-by: Michael Barnes <michael@journeyapps.com>
1 parent b6ab625 commit 5d012d9

1 file changed

Lines changed: 129 additions & 48 deletions

File tree

README.md

Lines changed: 129 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -13,73 +13,126 @@ A templated Vite, TS, React, PowerSync and Supabase project to get you started q
1313
| Supabase | Active project/account | [Sign up here](https://supabase.com/dashboard/sign-up) |
1414

1515

16-
## Getting Started
16+
# Getting Started
1717

18-
You have 4 options to get started with this template.
19-
We recommend using the first option for a quick start.
18+
You have 4 options to get started with this template. We recommend using the first option for a quick start.
2019

21-
1. Generate a repository from this [template](https://github.com/powersync-community/vite-react-ts-powersync-supabase/generate)
22-
2. Use [degit](https://github.com/Rich-Harris/degit) to scaffold the project:
20+
<details>
21+
<summary><strong>1. Generate from template (Recommended)</strong></summary>
2322

24-
```bash
25-
npx degit powersync-community/vite-react-ts-powersync-supabase
26-
```
23+
Generate a repository from this [template](https://github.com/powersync-community/vite-react-ts-powersync-supabase/generate).
24+
25+
</details>
26+
27+
<details>
28+
<summary><strong>2. Use degit</strong></summary>
29+
30+
Use [degit](https://github.com/Rich-Harris/degit) to scaffold the project:
31+
32+
```bash
33+
npx degit powersync-community/vite-react-ts-powersync-supabase
34+
```
2735

2836
> **Note**: `degit` is a tool that downloads the latest version of a repository without the git history, giving you a clean starting point. Add a second argument to specify your project name (e.g., my-app).
2937
30-
3. Clone the repository directly and install dependencies:
38+
</details>
3139

32-
```bash
33-
git clone https://github.com/powersync-community/vite-react-ts-powersync-supabase.git
34-
```
40+
<details>
41+
<summary><strong>3. Clone the repository</strong></summary>
3542

36-
4. Start the project using [bolt.new](https://bolt.new):
43+
Clone the repository directly and install dependencies:
44+
45+
```bash
46+
git clone https://github.com/powersync-community/vite-react-ts-powersync-supabase.git
47+
```
48+
49+
</details>
50+
51+
<details>
52+
<summary><strong>4. Start with bolt.new</strong></summary>
53+
54+
Start the project using [bolt.new](https://bolt.new):
3755

3856
- Open this [link](https://bolt.new/github.com/powersync-community/vite-react-ts-powersync-supabase/tree/main) to load the project.
39-
- You will see a configuration error in the preview window because the `.env` file has not yet been defined.
40-
- Create a new `.env` file and populate it with the appropriate Supabase and PowerSync credentials, as specified in the `.env.local.template` file included in this repository.
57+
- You will see a configuration error in the preview window because the `.env.local` file has not yet been defined.
58+
- Create a new `.env.local` file and populate it with the appropriate Supabase and PowerSync credentials, as specified in the `.env.local.template` file included in this repository (refer to step 4 "Set up environment").
4159
- Save the file — the app should launch automatically.
4260

61+
</details>
62+
4363
## Usage
4464

4565
After cloning the repository, navigate to the project directory and install the dependencies:
4666

47-
```bash
48-
cd vite-react-ts-powersync-supabase
49-
npm install
50-
npm run dev
51-
```
67+
```bash
68+
cd vite-react-ts-powersync-supabase
69+
npm install
70+
npm run dev
71+
```
5272

53-
## Setup Backend
73+
# Setup Backend
5474

55-
### 1. Setup Supabase
75+
## 1. Setup Supabase
5676
Follow these steps to set up your backend with Supabase and PowerSync (Or you can follow the [guide](https://docs.powersync.com/integration-guides/supabase-+-powersync)).
5777

58-
#### Setup using the Supabase Dashboard
78+
<details>
79+
<summary><strong>Option 1: Setup using the Supabase Dashboard</strong></summary>
80+
5981
1. [Create a new project on the Supabase dashboard](https://supabase.com/dashboard/projects).
60-
2. Go to the Supabase SQL Editor for your new project and execute the SQL statements in [`database.pgsql`](database.pgsql) to create the database schema, database functions, and publication needed for PowerSync.
82+
2. Go to the Supabase SQL Editor for your new project and execute the SQL statements in [database.pgsql](database.pgsql) to create the database schema, database functions, and publication needed for PowerSync.
6183
3. Enable "anonymous sign-ins" for the project [here](https://supabase.com/dashboard/project/_/auth/providers) (demo specific)
6284

63-
#### Setup using the Supabase CLI (optional)
85+
</details>
86+
87+
<details>
88+
<summary><strong>Option 2: Setup using the Supabase CLI</strong></summary>
89+
6490
If you prefer using the Supabase CLI, you can set up your project as follows:
6591
1. Login to your Supabase Account `npx supabase login`
6692
2. Initialize your project `npx supabase init`
6793
3. Enable "anonymous sign-ins" for the project [here](https://supabase.com/dashboard/project/_/auth/providers)
6894
4. Copy your project ID from the Supabase dashboard [here](https://supabase.com/dashboard/project/_/settings/general)
6995
5. Link your local project `npx supabase link --project-ref <project-id>`
70-
6. Create your first migration with `npx supabase migration new create_powersync_tables` and then copy the contents of [`database.pgsql`](database.pgsql) into the newly created migration file in the `supabase/migrations` directory.
96+
6. Create your first migration with `npx supabase migration new create_powersync_tables` and then copy the contents of [database.pgsql](database.pgsql) into the newly created migration file in the `supabase/migrations` directory.
7197
7. Push your tables to the cloud db
7298
```shell
7399
npx supabase db push
74100
```
75101

76-
### 2. Create PowerSync Instance and Connect to Supabase
102+
</details>
103+
104+
# Setup PowerSync
105+
106+
## 2. Create PowerSync Instance and Connect to Supabase
77107

78108
You can set up your PowerSync instance using either the Dashboard or CLI approach:
79109

80-
#### Option 1: Using PowerSync [CLI](https://docs.powersync.com/usage/tools/cli)
110+
<details>
111+
<summary><strong>Option 1: Setup using the PowerSync Dashboard</strong></summary>
112+
113+
If you prefer using the web interface:
114+
115+
1. In the [PowerSync dashboard](https://powersync.journeyapps.com/), create a new PowerSync instance:
116+
- Right-click on 'PowerSync Project' in the project tree on the left and click "Create new instance"
117+
- Pick a name for the instance e.g. "PowerSyncDemoInstance" and proceed.
118+
119+
2. In the "Edit Instance" dialog that follows, click on the "Connections" tab:
120+
- Click on the "+" button to create a new database connection.
121+
- Input the credentials from the project you created in Supabase. In the Supabase dashboard, under your project you can go to "Project Settings" and then "Database" and choose "URI" under "Connection string", **untick the "Use connection pooling" option** to use the direct connection, and then copy & paste the connection string into the PowerSync dashboard "URI" field, and then enter your database password at the "Password" field.
122+
- Click the "Test connection" button and you should see "Connection success!"
123+
124+
3. Click on the "Credentials" tab of the "Edit Instance" dialog:
125+
- Tick the "Use Supabase Auth" checkbox and configure the JWT secret.
126+
- Click "Save" to save all the changes to your PowerSync instance. The instance will now be deployed — this may take a minute or two.
127+
128+
</details>
129+
130+
<details>
131+
<summary><strong>Option 2: Setup using the PowerSync CLI</strong></summary>
81132

82-
> This PowerSync CLI only works with **PowerSync Cloud instances.**
133+
See [PowerSync CLI docs](https://docs.powersync.com/usage/tools/cli).
134+
135+
> This PowerSync CLI only works with **PowerSync Cloud instances.**
83136
> The CLI currently does not support **self-hosted PowerSync instances.**
84137
85138
If you don't have a PowerSync account yet, [sign up here](https://accounts.journeyapps.com/portal/powersync-signup).
@@ -116,29 +169,57 @@ Follow the prompts to configure:
116169

117170
> After deploying sync rules via CLI, the changes might not be reflected in the dashboard. If you want to see them in the dashboard, simply copy the contents of your `sync-rules.yaml` file and paste them into the dashboard's sync-rules editor, then redeploy.
118171
119-
#### Option 2: Using PowerSync Dashboard
172+
</details>
120173

121-
If you prefer using the web interface:
174+
## 3. Deploy Sync Rules
122175

123-
1. In the [PowerSync dashboard](https://powersync.journeyapps.com/), create a new PowerSync instance:
124-
- Right-click on 'PowerSync Project' in the project tree on the left and click "Create new instance"
125-
- Pick a name for the instance e.g. "Yjs Demo Test" and proceed.
126-
127-
2. In the "Edit Instance" dialog that follows, click on the "Connections" tab:
128-
- Click on the "+" button to create a new database connection.
129-
- Input the credentials from the project you created in Supabase. In the Supabase dashboard, under your project you can go to "Project Settings" and then "Database" and choose "URI" under "Connection string", **untick the "Use connection pooling" option** to use the direct connection, and then copy & paste the connection string into the PowerSync dashboard "URI" field, and then enter your database password at the "Password" field.
130-
- Click the "Test connection" button and you should see "Connection success!"
176+
<details>
177+
<summary><strong>Option 1: Using CLI (if you used CLI setup above)</strong></summary>
131178

132-
3. Click on the "Credentials" tab of the "Edit Instance" dialog:
133-
- Tick the "Use Supabase Auth" checkbox and configure the JWT secret.
134-
- Click "Save" to save all the changes to your PowerSync instance. The instance will now be deployed — this may take a minute or two.
179+
The sync rules are already deployed if you followed the CLI setup steps above.
135180

136-
### 3. Deploy Sync Rules
181+
</details>
137182

138-
#### Option 1: Using CLI (if you used CLI setup above)
139-
The sync rules are already deployed if you followed the CLI setup steps above.
183+
<details>
184+
<summary><strong>Option 2: Using Dashboard</strong></summary>
140185

141-
#### Option 2: Using Dashboard
142-
1. Open the [`sync-rules.yaml`](sync-rules.yaml) in this repo and copy the contents.
186+
1. Open the [sync-rules.yaml](sync-rules.yaml) in this repo and copy the contents.
143187
2. In the [PowerSync dashboard](https://powersync.journeyapps.com/), paste that into the 'sync-rules.yaml' editor panel.
144-
3. Click the "Deploy sync rules" button and select your PowerSync instance from the drop-down list.
188+
3. Click the "Deploy sync rules" button and select your PowerSync instance from the drop-down list.
189+
190+
</details>
191+
192+
## 4. Set up environment
193+
194+
First, copy the environment template file:
195+
```bash
196+
cp .env.local.template .env.local
197+
```
198+
199+
Then set the following environment variables in your `.env.local` file:
200+
201+
```bash
202+
VITE_SUPABASE_URL=
203+
VITE_SUPABASE_ANON_KEY=
204+
VITE_POWERSYNC_URL=
205+
```
206+
207+
### How to get these values:
208+
209+
**VITE_SUPABASE_URL & VITE_SUPABASE_ANON_KEY:**
210+
211+
**Quick Access:** For convenience, you can access both settings directly:
212+
- [API Settings & URL](https://supabase.com/dashboard/project/_/settings/api)
213+
- [API Keys](https://supabase.com/dashboard/project/_/settings/api-keys)
214+
215+
**Detailed Instructions:**
216+
1. Go to your [Supabase Dashboard](https://app.supabase.com)
217+
2. Select your project
218+
3. For the URL: Navigate to Project Settings → Data API and copy the "Project URL" for `VITE_SUPABASE_URL`
219+
4. For the key: Navigate to Project Settings → API Keys and copy the "anon public" key for `VITE_SUPABASE_ANON_KEY`
220+
221+
**VITE_POWERSYNC_URL:**
222+
1. Go to your [PowerSync Dashboard](https://powersync.journeyapps.com/)
223+
2. Select your project
224+
3. Navigate to your PowerSync instance
225+
4. Copy the "Instance URL" for `VITE_POWERSYNC_URL`

0 commit comments

Comments
 (0)