Fields

People who sign up to Peels must fill in these required fields:

These fields are optional:

And these fields are required, so are just checked on the client-side by the user’s browser:

We make no distinction between compost donors and hosts at this stage. We consider someone a host simply if they have 1+ listings.

Database

The above fields are sent via a server action (signUpAction) to Supabase, using the supabase.auth.signUp method. Because the auth.users table is read-only, and is limited in what information it can hold, we need to store basic user data elsewhere, too.

That’s where the public.profiles table comes in. We save the user’s first name and newsletter preference here, plus any additional info like which site referred them. A row for this user containing all this information is created on the profiles table immediately after sign up, via the on_auth_user_created trigger (under the auth schema), which in turn fires the handle_new_user function.

<aside> ⚠️

Be sure to update that handle_new_user function’s contents any time you update column names on public.profiles, otherwise you could break sign ups!

This is because the function looks for exact column name matches.

</aside>