Skip to content

Commit 0957246

Browse files
Tb/deved 105 add usage file (#6)
* added USAGE.md * updated supabase url env * updated guides
1 parent a764722 commit 0957246

File tree

7 files changed

+88
-6
lines changed

7 files changed

+88
-6
lines changed

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
SUPABASE_URL=
1+
SUPABASE_DATABASE_URL=
22
SUPABASE_ANON_KEY=

USAGE.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Set up Supabase with Netlify Remix template
2+
3+
In this guide we’re going to install and configure the Supabase Netlify extension, create Supabase project and fill the database with data.
4+
5+
## Set up Supabase database
6+
7+
1. Create Supabase account at [Supabase.com](https://supabase.com).
8+
2. After signing up to your Supabase account, click New project from your dashboard. Select your organization, give the project a name, generate a new password for the database, and select the us-east-1 region.
9+
10+
## Create the members table
11+
12+
Once the database is provisioned, we can create the **members** table. From your project dashboard, open the SQL editor.
13+
14+
![Create the members table](/public/guides/supabase-netlify-sql-editor.png)
15+
16+
Run the following commands in the SQL editor to create the **members** table.
17+
18+
```sql
19+
CREATE TABLE members (
20+
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
21+
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
22+
avatar_url TEXT NOT NULL,
23+
name TEXT NOT NULL,
24+
email TEXT NOT NULL,
25+
location TEXT NOT NULL
26+
);
27+
```
28+
29+
## Add data
30+
31+
Next, let’s add some starter data to the **members** table. From the Table Editor in Supabase (1), choose the **members** table from the list (2) and then select **Insert > Import** data from CSV (3).
32+
33+
![Create the members table](/public/guides/supabase-netlify-import-csv.png)
34+
35+
Paste the following data:
36+
37+
```sql
38+
id,created_at,avatar_url,name,email,location
39+
14c8afd0-50cc-4aca-9547-c997ed306065,2025-02-21 12:29:21.704945+00,https://i.pravatar.cc/120?img=7,Ethan Reynolds,ethanreynolds@demoemail.com,United States
40+
33a9549c-d436-4f53-ab61-86612c812fda,2025-02-21 12:29:59.907726+00,https://i.pravatar.cc/120?img=52,Eero Virtanen,virtanen@demoemail.com,Finland
41+
4badfc0a-3ec0-4282-833a-6f90604f3e54,2025-02-21 12:28:50.565559+00,https://i.pravatar.cc/120?img=47,Viktoria Melnyk,viktoria@demoemail.com,Ukraine
42+
6af079d1-e63e-499b-84b5-2c94720bdd4a,2025-02-21 12:31:38.60595+00,https://i.pravatar.cc/120?img=14,Elliot Mercer,elliotmercer@demoemail.com,Norway
43+
6e09dac3-e052-4fa6-a57d-eabac73e8b38,2025-02-21 12:30:32.745623+00,https://i.pravatar.cc/120?img=68,Piotr Kaminski,kaminski@demoemail.com,Poland
44+
a2ac4de2-383e-41c8-a1a2-17089c04ace7,2025-02-21 12:27:31.655131+00,https://i.pravatar.cc/120?img=16,Mira Thornton,mira@demoemail.com,Canada
45+
a905829d-2302-4dfd-a758-ff40f25bf97a,2025-02-21 12:28:19.614953+00,https://i.pravatar.cc/120?img=31,Suhyun Park,suhyunpark@demoemail.com,South Korea
46+
```
47+
48+
This will give you a preview of the data that will be inserted into the database. Click **Import data** to add the data to the database.
49+
50+
## Install the Supabase Netlify extension
51+
52+
Now we can install the [Supabase extension](https://app.netlify.com/extensions/supabase). In the Netlify UI, go to your team’s dashboard, navigate to **Extensions** and click on the Supabase extension. Click the install button to install the extension.
53+
54+
### Configure the Supabase extension
55+
56+
After the extension is installed, navigate to the Supabase template site that you deployed, and go to **Site configuration**. In the **General** settings, you will see a new **Supabase** section. Click **Connect** to connect your Netlify site to your Supabase account using OAuth.
57+
58+
![Configure the Supabase extension](/public/guides/supabase-netlify-connect-oauth.png)
59+
60+
Once you’ve completed this process, return to the Supabase section of your site configuration, and choose the project you just created in Supabase. And make sure to choose Astro for the framework since the template is built with Astro.
61+
62+
![Supabase Netlify extension configuration](/public/guides/supabase-netlify-extension-configuration.png)
63+
64+
## Deploy the site again
65+
66+
Now that the extension is configured, we can deploy the site again. Got to **Deploys** (1) and click the **Deploy site** (2) button to deploy the site.
67+
68+
![Supabase Netlify extension configuration](/public/guides/deploy-button.png)
69+
70+
Once the build is complete, navigate to your production URL, and you should see the login form.
71+
72+
![Template login form](/public/guides/remix-login.png)
73+
74+
Next, add an authenticated user to log in to the template. In your Supabase project, navigate to **Authentication** (1), choose **Add user** (2), and provide an email and password (Email: [email protected], Password: demo123).
75+
76+
![Add user in the Supabase Authentication](/public/guides/remix-supabase-add-user.png)
77+
78+
Once you've completed this process, return to the login form and log in to the template. You should see the <strong>members</strong> that we just added to the database.
79+
80+
![Template with data](/public/guides/remix-dashboard.png)

app/components/Guide.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,12 @@ export default function Guide() {
121121
alt="Supabase Netlify extension configuration"
122122
/>
123123
<p>
124-
Once the build is complete, navigate to your production URL and you
125-
should see the <strong>members</strong> that we just added to the
126-
database.
124+
Once the build is complete, navigate to your production URL, and you should see the login form.
127125
</p>
126+
<img src="/guides/remix-login.png" alt="Template login form" />
127+
<p>Next, add an authenticated user to log in to the template. In your Supabase project, navigate to <strong>Authentication</strong> (1), choose <strong>Add user</strong> (2), and provide an email and password (Email: [email protected], Password: demo123).</p>
128+
<img src="/guides/remix-supabase-add-user.png" alt="Add user to Supabase" />
129+
<p>Once you&apos;ve completed this process, return to the login form and log in to the template. You should see the <strong>members</strong> that we just added to the database.</p>
128130
<img src="/guides/remix-dashboard.png" alt="Template with data" />
129131
</div>
130132
</article>

app/utils/getSupabaseClient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { createClient } from "@supabase/supabase-js";
22

33
export function getSupabaseClient() {
4-
const supabaseUrl = process.env.SUPABASE_URL!;
4+
const supabaseUrl = process.env.SUPABASE_DATABASE_URL!;
55
const supabaseAnonKey = process.env.SUPABASE_ANON_KEY!;
66

77
if (!supabaseUrl || !supabaseAnonKey) {

public/guides/remix-login.png

62.1 KB
Loading
73.7 KB
Loading

‎netlify.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ command = "npm run dev"
77
framework = "vite"
88

99
[template]
10-
required-extensions = ["supabase"]
10+
required-extensions = ["supabase"]

0 commit comments

Comments
 (0)