Files
Convivo/docs/backend
b08a439949 Check-in gate + fixes, RPC test suite, docs
- Convivo: not-checked-in gate for non-staff (see-a-staff screen with QR
  code + logout); lifts automatically once staff checks them in
- Convivo: fix check-in 'pick a session first' race (synchronous default
  session fallback)
- Add RPC test suite (npm run test:rpc): points idempotency, role guards,
  service-session guard, speaker auto-promote, leaderboard staff exclusion
- Fix db:types script (create packages/shared/src); gitignore generated types
- Docs: README/roadmap drift fixes, tests.md, backend README link

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-09-08 21:05:34 +02:00
..

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 14 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 demo accounts
docker.md Docker: the app image + root compose (how the core + app run together)
sidecar.md The Sessionize sync sidecar (on-demand, service-role)
tests.md The RPC test suite (npm run test:rpc)

The big picture

Postgres 17  ──  schema (14 tables, multi-event model)
             ──  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 registrations.points directly — 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 leaderboard mirror in one transaction, so the leaderboard is always consistent and duplicate actions never double-award. See rpcs.md.

Source of truth