Skip to main content

Supabase

This prefab gives you a few components that allows you to connect to Supabase and manage user authentication.

This prefab is built by Guillaume Maison and Rico Trevisan. Please show them some love if you find this prefab useful.

Included components

Base Components

User Components

Pages

You will also find a couple of pages that allow you to quickly get up and running with all user features. Set the Supabase Example App Root as your home component for a quick start on all routing.

Quickstart

First, drop a Supabase – Setup Client in your project home component and input your Supabase URL and Supabase Anon Key in its Property Panel. Then, open the Projects Settings sidebar and find the Head Code input. Add the following at the top:

<script type="module">
import { createClient } from 'https://esm.sh/@supabase/supabase-js@2.22.0';

window.createClient = createClient;
</script>

Lastly, you need to connect the Did Mount output of your root Group node to the Do input of the Supabase - Setup Client like so:

This will set everything up and allow you to use all of the other Supabase components.

You can use an Object node set to the id currentUser to get all the user data (if a user is logged in).

You can use the Supabase – Fetch Current User Auth component to check if the user is logged in. If the user is already authenticated from a previous session, this session is retrieved, the user is considered logged in, and the component outputs true on its Logged In output and in the currentUser Noodl object.

Use the Supabase - Fetch Current User Profile Data to trigger a data fetch and refresh the non-auth data in the currentUser object.