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.
2.0 KiB
2.0 KiB
Backend — Supabase Core
Convivo has no custom backend. The entire server side is a local Supabase stack (run with the Supabase CLI) plus the schema, RPCs, and RLS that live in Postgres. This folder documents that core.
| File | What it covers |
|---|---|
| supabase-core.md | The local stack: containers, ports, how to start/reset, config |
| schema.md | All 9 tables, columns, constraints, indexes |
| rpcs.md | The transactional points RPCs (the business logic) |
| rls.md | Row Level Security policies + which key the app uses |
| seed.md | Seed data + the 13 demo accounts |
| docker.md | Docker: the app image + root compose (how the core + app run together) |
The big picture
Postgres 17 ── schema (9 tables)
── RLS (who can read/write what)
── RPCs (security definer, transactional points logic)
── seed (demo data)
- Data + logic live in the database. The app never computes points or writes
to
profiles.pointsdirectly — it calls RPCs, and Postgres enforces the rules. - RLS is the security boundary. The app uses the anon key + the user's session JWT; RLS decides what that user may see and do. The service-role key is never shipped to the app. See rls.md.
- Points are transactional. Each RPC updates points, inserts the related row,
and re-syncs the
leaderboardmirror in one transaction, so the leaderboard is always consistent and duplicate actions never double-award. See rpcs.md.
Source of truth
- Schema + RPCs + RLS:
supabase/migrations/20260822000000_init.sql - Admin app (Phase 2): admin read RLS +
reset_qr_tokenRPC —supabase/migrations/20260823000000_admin_app.sql - Seed:
supabase/seed.sql - Stack config:
supabase/config.toml