A desktop-first React app for organizers, guarded to the admin role. Backend (supabase/migrations/20260823000000_admin_app.sql): - Admin-only SELECT policies on preferences, connections, feedback - reset_qr_token RPC: regenerates a lanyard token, re-hashes it as the Auth password (old token stops working), and clears the attendee's sessions to force re-login App (apps/admin, port 3001): - Login: same QR+email flow, but non-admin sessions are rejected - Dashboard: live stats + top points + recent activity - Attendees: search, edit name/company/role, reset QR, adjust points - Schedule: manage slots + sessions (create/edit/delete) - Activity: check-ins / connections / feedback tables - Same-origin proxy (Vite dev / nginx in Docker), same design tokens Docker + scripts: - convivo-admin service in docker-compose.yml (:3001) - admin:dev / admin:build root scripts - fixed db:reset script (supabase reset -> supabase db reset) Docs: new frontend/admin-app.md; updated architecture, rls, rpcs, docker, next-steps, and READMEs. Verified: build clean, all views + flows browser-tested, Docker build + proxy + login + admin guard confirmed. DB reset to clean seed. 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]>
23 lines
718 B
TypeScript
23 lines
718 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) {
|
|
console.warn('[convivo-admin] VITE_SUPABASE_ANON_KEY is not set.');
|
|
}
|
|
|
|
export const supabase = createClient(url, anonKey, {
|
|
auth: {
|
|
persistSession: true,
|
|
autoRefreshToken: true,
|
|
detectSessionInUrl: false,
|
|
},
|
|
realtime: {
|
|
params: { eventsPerSecond: 10 },
|
|
},
|
|
});
|