1. GitHub - Setup

  1. Go to GitHub and login or create account.
  2. Create new Project
  3. Enter a unique Repository name (e.g., hotlapleaderboard).
  4. Choose visibility: select Private.
  5. Click Create repository at the bottom.
  6. Choose a theme you want to use. Cyber or Red
  7. Upload index.html and logo.png using upload page.

2. Supabase setup

  1. Go to Supabase.com and login or create account.
  2. Create project
  3. create table (sql)
  4. create function get_unique_tracks (sql)
  5. prevent duplicate records (sql)
  6. add rls policy
  7. import sample data
Create Table: hotlaps (SQL)
Change 'hotlaps' to your table name if different.
CREATE TABLE public.hotlaps (
    id bigint GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
    created_at timestamptz NOT NULL DEFAULT timezone('utc'::text, now()),
    driver_name text NOT NULL,
    car_model text NOT NULL,
    track text NOT NULL,
    best_lap_ms integer NOT NULL,
    session_id text UNIQUE,
    wetlap text,
    best_splits integer[]
);
Create Function: (SQL)
create or replace function get_unique_tracks()
returns table (track text) 
language sql
as $$
  select distinct track from hotlaps where track is not null;
$$;
Prevent Future Duplicate Records: (SQL)
ALTER TABLE hotlaps
ADD CONSTRAINT unique_session_lap UNIQUE (session_id, best_lap_ms);
Create RLS Policy:
ALTER TABLE public.hotlaps ENABLE ROW LEVEL SECURITY;

CREATE POLICY "Allow Read only for all users"
ON public.hotlaps
FOR SELECT
TO anon, authenticated
USING (true);

3. Vercel Setup

  1. Go to Vercel.com and log into your account.
  2. Add New Project
  3. Setup Command Build
  4. Set Supabase environment variables
  5. Connect github repository.
Build Command:
--------------
sed -i 's|__SUPABASE_URL_PLACEHOLDER__|'${NEXT_PUBLIC_SUPABASE_URL:-$VITE_SUPABASE_URL}'|g' index.html && sed -i 's|__SUPABASE_ANON_KEY_PLACEHOLDER__|'${NEXT_PUBLIC_SUPABASE_ANON_KEY:-$VITE_SUPABASE_ANON_KEY}'|g' index.html

Overide output directory with a period. "."
Save.

Root Directory:
---------------
Disable
Include files outside the root directory in the Build Step.

Save.
Environment Variables:
---------------------
Select "Config" option

Key: NEXT_PUBLIC_SUPABASE_URL
value: https://abcexample123.supabase.co

Enable: Production,Preview and Development options.
---------------------
Select "Config" option

key: NEXT_PUBLIC_SUPABASE_ANON_KEY
Value: anonkey

Enable: Production,Preview and Development options.