Uses a selfhosted version of Supabase, demo purposes only.
Find a file
2024-07-17 19:04:49 -04:00
src When signing out, check if user is anonymous 2024-07-17 19:04:49 -04:00
.env.example Replace Appwrite with Supabase 2024-07-16 23:39:02 -04:00
.gitignore update 2024-07-16 23:39:34 -04:00
astro.config.mjs update 2024-07-17 15:39:49 -04:00
bun.lockb update 2024-07-16 23:39:34 -04:00
channels_rows.csv update 2024-07-16 23:39:34 -04:00
package.json update 2024-07-16 23:39:34 -04:00
README.md update 2024-07-17 18:34:04 -04:00
tsconfig.json Set to base 2024-07-17 03:34:11 -04:00

Todo List

  • Add loading feedback with ViewTransition API
  • Revamp Design and Layout
  • Stay on same page when making API request
  • Speed up loading time (why so slow? idk)

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 to http://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