Skip to main content

Store setup

Enable accounts and the dashboard in clear steps

Supabase setup guide

Pages are ready in code — Supabase must be connected first

Supabase connected
  1. 1

    Create a Supabase project

    Sign up at supabase.com and create a new project

    Open Supabase dashboard
  2. Fill in .env.local

    Copy keys from Project Settings > API: URL, anon key, and service_role key

    .env.local
  3. 3

    Run SQL files

    In SQL Editor, run in order:

    • supabase/seeds/reset-fresh.sql
    • supabase/schema/schema-v2.sql
    • supabase/seeds/seed.sql
    • supabase/schema/storage.sql
  4. 4

    Enable authentication

    URL Configuration + Google + Authentica for phone. Skip OAuth Apps page.

    1) Supabase URL Configuration

    Authentication > URL Configuration — set Site URL and add Redirect URLs below.

    Open URL Configuration

    Site URL (production)

    https://www.rawad-ads.com

    Redirect URLs (copy all)

    • http://localhost:3000/auth/callback
    • http://localhost:3000/**
    • http://localhost:3001/auth/callback
    • http://localhost:3001/**
    • http://localhost:3002/auth/callback
    • http://localhost:3002/**
    • http://127.0.0.1:3000/auth/callback
    • http://127.0.0.1:3000/**
    • http://127.0.0.1:3001/auth/callback
    • http://127.0.0.1:3001/**
    • https://www.rawad-ads.com/auth/callback
    • https://www.rawad-ads.com/**
    • https://rawad-ads.com/auth/callback
    • https://rawad-ads.com/**
    • https://onlyforyou.rawad-ads.com/auth/callback
    • https://onlyforyou.rawad-ads.com/**
    • https://solutions.rawad-ads.com/auth/callback
    • https://solutions.rawad-ads.com/**
    • https://signage.rawad-ads.com/auth/callback
    • https://signage.rawad-ads.com/**
    • https://health.rawad-ads.com/auth/callback
    • https://health.rawad-ads.com/**
    • https://tech.rawad-ads.com/auth/callback
    • https://tech.rawad-ads.com/**
    • https://only-for-you-navy.vercel.app/auth/callback
    • https://only-for-you-navy.vercel.app/**
    • https://*-zxc50zxc.vercel.app/auth/callback

    App callback URL

    https://only-for-you-navy.vercel.app/auth/callback

    2) Google Provider

    Authentication > Providers > Google — enable and paste Client ID/Secret from Google Cloud.

    Open Google settings in Supabase

    Authorized redirect URI in Google Cloud (not your app URL)

    https://xeoqxeqiaheapziosvzk.supabase.co/auth/v1/callback

    Authorized JavaScript origins in Google Cloud

    • http://localhost:3000
    • http://localhost:3001
    • http://localhost:3002
    • http://127.0.0.1:3000
    • http://127.0.0.1:3001
    • https://www.rawad-ads.com
    • https://rawad-ads.com
    • https://onlyforyou.rawad-ads.com
    • https://solutions.rawad-ads.com
    • https://signage.rawad-ads.com
    • https://health.rawad-ads.com
    • https://tech.rawad-ads.com
    • https://only-for-you-navy.vercel.app

    Skip Authentication > OAuth Apps — not needed for the Rowad platform.

    3) Staff access

    After first sign-in at /en/admin/login, run in SQL Editor:

    Open SQL Editor

    Verify staff table

    select id, email, full_name from public.staff;

    Link owner account in staff table

    insert into public.staff (id, email, full_name) select id, email, coalesce(raw_user_meta_data->>'full_name', split_part(email, '@', 1)) from auth.users where email = 'zxc50zxcc@gmail.com' on conflict (id) do update set email = excluded.email, full_name = coalesce(excluded.full_name, public.staff.full_name);

    Enable Authentica (customer phone login)

    The customer portal requires Authentica — without the API key, OTP will not send.

    1. Create a free account (100 free verifications)
    2. Create an application and copy your API Key
    3. Add the key to .env.local and Vercel, then Redeploy
    4. Try /en/login or npm run verify:portal
    AUTHENTICA_API_KEY=<your_key_from_portal>
    OTP guide — Authentica
  5. 5

    Link your account in staff

    Sign in at /en/admin/login then run in SQL Editor:

    insert into public.staff (id, email, full_name)
    select id, email, coalesce(raw_user_meta_data->>'full_name', split_part(email, '@', 1))
    from auth.users
    where email = 'zxc50zxcc@gmail.com'
    on conflict (id) do update
      set email = excluded.email,
          full_name = coalesce(excluded.full_name, public.staff.full_name);
  6. Restart the site

    npm run dev or Redeploy on Vercel, then try /en/login

Checklist

  • .env.local filled with real keys
  • Run schema-v2 (customers + staff)
  • NEXT_PUBLIC_SITE_URL = production URL on Vercel
  • AUTHENTICA_API_KEY set for phone OTP
  • At least one row in staff table

After setup, these pages will work:

  • /ar/loginCustomer sign-in (phone)
  • /ar/accountCustomer account and orders
  • /ar/admin/loginStaff sign-in
  • /ar/adminDashboard (admin only)
  • /ar/admin/brands/only-for-you/products/newAdd products and upload images/videos