2.1 KiB
Setting Up Supabase
Selfhosting
This section is optional on wheather or not you want to either use Supabase Cloud or selfhost.
Run:
# Get the code using git sparse checkout
git clone --filter=blob:none --no-checkout https://github.com/supabase/supabase
cd supabase
git sparse-checkout set --cone docker && git checkout master
# Go to the docker folder
cd docker
# Copy the fake env vars
cp .env.example .env
# Pull the latest images
docker compose pull
# Start the services (in detached mode)
docker compose up -d
Source: https://supabase.com/docs/guides/self-hosting/docker
In the .env
file that've you copied from `.env.example, you'll need to change some things to adapt it to this project.
- Change
SITE_URL
tohttp://localhost:4321
- Setup SMTP (Project was tested with Resend)
For production use, make sure to follow all instructions needed from https://supabase.com/docs/guides/self-hosting/docker.
SMTP is required for email verification, as a code is required. The end-user is not allowed to login yet until their email is verified.
Allowing Account Deletion
When an end-user wants to delete their account, they'll be directed to /api/account/delete
. This API requires that a function already exist in your Supabase project called delete_user()
.
In the SQL Editor, enter the following and click Run:
CREATE or replace function delete_user()
returns void
LANGUAGE SQL SECURITY DEFINER
AS $$
delete from auth.users where id = auth.uid();
$$;
Source: https://github.com/orgs/supabase/discussions/250#discussioncomment-5361165
Table Creation
For this project, two tables need to exist and that is both channels
and subs
.
For the channels
portion, you can import the premade CSV file made for this project.
For the subs
portion, enter the following in the SQL Editor and click Run:
create table
public.usersubslist (
"Id" text not null,
"UserSubscribed" text null,
"Platform" text null,
"Subscribed" boolean not null default false
) tablespace pg_default;
Project was tested with RLS disabled on all tables