Phase 0 — Supabase core (Docker via CLI): - Schema: profiles, slots, sessions, preferences, connections, checkins, feedback, leaderboard (Realtime mirror), points_log - RLS on every table; transactional security-definer points RPCs - Seed: 6 slots, 18 sessions, 13 demo users (QR token as auth password) Phase 1 — Attendee web PWA (React + Vite + TS): - Login via QR token + email (GoTrue, no email sent) - Home, Agenda, Scan/Connect, staff Check-in, Feedback, live Leaderboard, Profile - Same-origin proxy to Supabase (Vite dev / nginx in Docker) - Docker: multi-stage build -> nginx sidecar on the Supabase network
24 lines
776 B
TypeScript
24 lines
776 B
TypeScript
import { createClient } from '@supabase/supabase-js';
|
|
|
|
// The app talks to Supabase through same-origin paths (/auth, /rest, /realtime,
|
|
// /storage). In dev the Vite server proxies them to the local Supabase stack;
|
|
// in Docker the app's nginx does the same. This avoids CORS entirely.
|
|
const url = import.meta.env.VITE_SUPABASE_URL || window.location.origin;
|
|
const anonKey = import.meta.env.VITE_SUPABASE_ANON_KEY;
|
|
|
|
if (!anonKey) {
|
|
// Fail fast with a clear message if the anon key is missing.
|
|
console.warn('[convivo] VITE_SUPABASE_ANON_KEY is not set.');
|
|
}
|
|
|
|
export const supabase = createClient(url, anonKey, {
|
|
auth: {
|
|
persistSession: true,
|
|
autoRefreshToken: true,
|
|
detectSessionInUrl: false,
|
|
},
|
|
realtime: {
|
|
params: { eventsPerSecond: 10 },
|
|
},
|
|
});
|