|
| 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 | + |
| 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 | + |
| 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 | + |
| 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 | + |
| 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 | + |
| 69 | + |
| 70 | +Once the build is complete, navigate to your production URL, and you should see the login form. |
| 71 | + |
| 72 | + |
| 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 | + |
| 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 | + |
0 commit comments