Supabase Configuration

https://supabase.com/

We use Supabase for user authentication, and use of the database is optional.

To configure Supabase in the project, you must create the project on the Supabase platform and get a url and access key to place in the .env file

create file .env

env
# supabase
SUPABASE_URL=URL
SUPABASE_KEY=KEY
SUPABASE_SERVICE_KEY=SERVICE_KEY

SQL

You will need to run this SQL script in your project: https://supabase.com/dashboard/project/ID_PROJECT/sql/new

script.sql
create table
  public.users (
    id uuid not null default gen_random_uuid (),
    email character varying null,
    constraint users_pkey primary key (id)
  ) tablespace pg_default;

create function public.handle_new_user()
returns trigger as $$
begin
  insert into public.users (id, email)
  values (new.id, new.email);
  return new;
end;
$$ language plpgsql security definer;

create trigger on_auth_user_created
  after insert on auth.users
  for each row execute procedure public.handle_new_user();