Supabase provide a hosted Postgres database with 500MB of storage in the free tier.

You can query and create data inside your vals using either Supabase’s JavaScript SDK, or a Postgres client.

Using the SDK

1. Sign up to Supabase

Visit https://supabase.com/dashboard/sign-up.

2. Create a project

On Supabase’s dashboard, create a new project.

Screenshot 2023-07-02 at 13.19.28.png

3. Get your API URL and service role key

Go to your project’s Settings via the sidebar. Inside API, scroll down and copy the Project URL, and then, inside Project API Keys, copy the ****service role key. Save these as two separate Val Town secrets as supabaseURL and supabaseKey respectively.

Screenshot 2023-07-06 at 13.09.52.png

4. Create your first table

Head to the Table editor in the sidebar.

Screenshot 2023-07-06 at 13.20.21.png

Create a new table called my_first_table with the following schema.

Screenshot 2023-07-06 at 13.16.02.png

5. Insert some data

Copy and paste the following val to insert some data.

https://www.val.town/embed/vtdocs.supabaseSDKInsertIntoMyFirstTable