Files
Convivo/apps/convivo/src/lib/supabase.ts
T
63aa4ecfc8 Phase 0 + 1: Dockerized Supabase core + attendee PWA
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

Co-authored-by: Stephan Charles <[email protected]>
Co-authored-by: Amelia Hernandez <[email protected]>
Co-authored-by: Markus Franz <[email protected]>
Co-authored-by: Sabrina Hota <[email protected]>
Co-authored-by: Nilüfer Doğan <[email protected]>
2026-08-22 16:10:59 +02:00

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 },
},
});