Lago 37684ba116 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
2026-08-22 16:10:59 +02:00

Convivo 🎤

Turn a conference into a game. Convivo is a mobile-first web app (PWA) that gets attendees out of their seats: mark the sessions you want, scan lanyards to make connections, get checked in by staff, and climb the live leaderboard. The whole thing runs on a Dockerized Supabase core — no custom backend.

Status: Phase 0 + Phase 1 complete.

  • Phase 0 — Dockerized Supabase core (Postgres + GoTrue + PostgREST + Realtime + Kong + Studio) with the full schema, RLS, and transactional points RPCs.
  • Phase 1 — Attendee web PWA: login (QR + email), Home, Agenda, Scan/Connect, staff Check-in, Feedback, live Leaderboard, Profile.

Next: Phase 2 (Pretix ticketing interface), Phase 3 (Admin app), Phase 4 (Sessionize interface).


1. The problem

Conferences are full of people who want to meet each other but don't know how to start. Convivo removes the friction:

  • No awkward "hi, I'm…" — scanning a lanyard QR starts the conversation for you.
  • No FOMO — you pick one session per slot, so you always know where to be.
  • No invisible networking — every check-in, connection, and review earns points, and the leaderboard makes it fun.

2. Event format

Date Wednesday, 23 October
Hours 09:00 – 17:00
Structure 6 slots × 45 minutes, 3 parallel sessions per slot
Breaks 09:45–10:00 · coffee 10:45–11:30 · lunch 12:15–13:15 · 14:45–15:00 · closing 15:45–17:00
Slot Time Slot Time
1 09:00–09:45 4 13:15–14:00
2 10:00–10:45 5 14:00–14:45
3 11:30–12:15 6 15:00–15:45

The schedule is data-driven (stored in Postgres), so times and sessions can be changed without an app update.

Demo clock: the app uses a simulated "now" of 2026-10-23 10:20 so Slot 1 is done and Slot 2 is live — matching the mockup. See apps/convivo/src/lib/time.ts.

3. Roles

Role What they can do
Attendee Log in, view agenda, mark preferences, scan peers to connect, get checked in, give feedback, view leaderboard
Staff Everything an attendee can do, plus a Check-in mode: pick a session, scan attendee lanyards to check them in
Admin Staff powers plus full read/write on all event data (used by the future Admin app)

Staff and attendees use the same app — the role is an attribute on the profile and changes the Scan tab into a Check-in tab.

4. Features

4.1 Login (QR + email)

  1. Open the app → Scan your own lanyard QR (or type the code).
  2. The app resolves the attendee from the QR and asks for your email to confirm it's really you.
  3. On match → you're in. On mismatch → error, try again.

How it works: the QR token is stored as the Supabase Auth password and the email as the identifier. Login is a standard signInWithPassword({ email, password: qrToken }) — no custom JWT, no separate backend, and no email is ever sent (enable_confirmations = false).

4.2 Agenda & preferences

  • The agenda shows all 6 slots and their 3 parallel sessions (title, room, speaker, description).
  • Attendees mark one preferred session per slot (they can change their pick until the slot starts).
  • Home shows "Now / Next" based on the current time and the user's picks.

4.3 Connections (the core loop)

  1. While logged in, scan another person's lanyard QR.
  2. A popup appears: "Connect with Bruno Costa?"
  3. The other person sees the request in Connections → Requests and accepts (or rejects).
  4. On acceptance, both earn points and both see each other in My connections.

4.4 Session check-in (staff)

  • Staff open the Check-in tab, select the session, and scan attendees' lanyards.
  • Each successful check-in awards the attendee points.
  • Duplicate scans are rejected with a clear message ("Already checked in — no extra points").

4.5 Feedback

  • After a session ends, attendees who were checked in can rate it 1–5 stars and optionally leave free text.
  • Rating only earns a small bonus; adding comments earns more.

4.6 Leaderboard

  • All attendees ranked by total points, with a top-3 podium.
  • Your own row is highlighted.
  • Live: the leaderboard table is a Realtime source, so it updates in every open app the moment points change.

5. Points system

Action Points
Checked into a session (by staff) +10
Connection accepted +5 each (both people)
Feedback — rating only +5
Feedback — rating + free text +10 total

Points are updated transactionally by Postgres RPCs (security definer): each RPC updates profiles.points, inserts the related row, and re-syncs the leaderboard mirror in a single transaction. This guarantees the leaderboard is always consistent and that duplicate actions (re-check-in, re-feedback) never double-award.

6. Architecture

flowchart LR
    subgraph Browser
        A["Convivo PWA<br/>React + Vite + TS<br/>(mobile-first, installable)"]
    end
    subgraph Docker
        K["Kong (API gateway)<br/>:54321"]
        K --> G["GoTrue (Auth)"]
        K --> R["PostgREST"]
        K --> RT["Realtime"]
        K --> S["Storage"]
        R --> P[("Postgres 17<br/>schema · RLS · points RPCs")]
        RT --> P
        G --> P
    end
    A -->|"same-origin /auth /rest /realtime"| K

Why no custom backend? Supabase gives us the whole backend as a managed local stack:

  • Auth (GoTrue) — QR token as password, email as identifier.
  • Data + logic (Postgres) — the schema, Row Level Security, and the transactional points RPCs live in the database. The app calls RPCs directly; Postgres enforces who can do what.
  • Realtime — the leaderboard table is broadcast to all connected clients.
  • Kong — a single API gateway fronting everything on one port.

The app talks to Supabase through same-origin paths (/auth, /rest, /realtime, /storage). In dev, Vite proxies them to the local stack; in Docker, the app's nginx does the same. This avoids CORS entirely.

App → Supabase connectivity

Path Proxied to Purpose
/auth/* Kong :54321 GoTrue login / session
/rest/* Kong :54321 PostgREST (tables + RPCs)
/realtime/* Kong :54321 WebSocket (leaderboard)
/storage/* Kong :54321 Storage (unused in v1)

7. Data model (Postgres)

Table Key fields Notes
profiles id (= auth uid), email (unique), full_name, company, role (attendee/staff/admin), qr_token (unique), points One row per attendee; id is the Supabase Auth user id
slots id, name, start, end 6 rows for 23 Oct
sessions id, title, description, slot_id, room, speakers, capacity 18 rows (3 per slot)
preferences profile_id, session_id, slot_id Unique per (profile, slot) — one pick per slot
connections from_id, to_id, status (pending/accepted/rejected), created_at, resolved_at Unique per unordered pair (via least/greatest index)
checkins profile_id, session_id, staff_id, created_at Unique per (profile, session)
feedback profile_id, session_id, rating (1–5), comment, created_at Unique per (profile, session); only after session end
leaderboard profile_id, full_name, company, points, updated_at Realtime mirror, kept in sync by the RPCs
points_log profile_id, delta, category, created_at Audit trail powering the per-category breakdown

Key RPCs (all security definer, transactional): lanyard_lookup, set_preference, clear_preference, create_connection_request, accept_connection, reject_connection, checkin_attendee, submit_feedback, adjust_points, get_agenda, get_public_profiles.

RLS: every table has policies. Profiles are self-or-admin; event tables are scoped to auth.uid(); slots/sessions are readable by any authenticated user and writable by admin; the leaderboard is readable by any authenticated user.

8. Tech stack

Layer Choice Why
Core Supabase (local, Docker) via the Supabase CLI Postgres + Auth + REST + Realtime + Storage in one managed stack; RLS + RPCs keep logic in the DB
App React 18 + Vite 5 + TypeScript (PWA) Fast, mobile-first, installable; same-origin proxy avoids CORS
QR html5-qrcode (scan) + qrcode.react (render) Camera scan with manual-entry fallback
Client @supabase/supabase-js Auth + REST + Realtime in one client
Packaging Docker (multi-stage build → nginx) The app is a sidecar that joins the Supabase network

9. Security

  • No secrets in the app — only the anon key (public by design) ships in the bundle. The service-role key stays server-side.
  • User login = QR token + email match via GoTrue; the session JWT is short-lived and stored in localStorage.
  • QR tokens are opaque — scanning a lanyard reveals no personal data by itself.
  • RLS on every table — the database, not the app, enforces who can read/write what.
  • Transactional points — RPCs make points + related row + leaderboard sync atomic, so there's no race or double-award.

10. Repository layout

Convivo/
├─ apps/convivo/          # Attendee web PWA (React + Vite + TS)
│  ├─ Dockerfile          # Multi-stage: build → nginx (serves SPA + proxies Supabase)
│  ├─ nginx.conf.template # SPA + same-origin proxy to the Supabase core
│  └─ src/                # screens, components, lib, context
├─ supabase/
│  ├─ config.toml         # Local stack config (ports, auth, RLS defaults)
│  ├─ migrations/         # 20260822000000_init.sql — schema, RLS, RPCs
│  └─ seed.sql            # Slots, sessions, 13 demo users, Ana's demo state
├─ docker-compose.yml     # Runs the app sidecar on the Supabase network
└─ mockup/index.html      # Original interactive mockup (design reference)

11. Getting started

Prerequisites

  • Docker (with the Docker daemon running)
  • Node.js 20+
  • Supabase CLI (installed as a devDependency — npx supabase works out of the box)

Option A — Dev (Vite dev server)

# 1. Start the Supabase core (Postgres, Auth, REST, Realtime, Studio, Kong)
npm run db:start

# 2. (Re)apply migrations + seed, then restart the stack
npm run db:reset

# 3. Run the app (Vite dev server on :3000, proxies to the core)
npm run app:dev

Open http://localhost:3000. Studio is at http://localhost:54323 (user postgres, password postgres).

Option B — Docker (app as a sidecar)

# 1. Start the Supabase core (creates the supabase_network_Convivo network)
npm run db:start

# 2. Build + run the app container on :3000 (joins the Supabase network)
docker compose up --build

Open http://localhost:3000. The app's nginx proxies the Supabase paths to the Kong container on the shared network.

Reset the demo data at any time: npm run db:reset (re-applies migrations + seed).

Ports

Service Port
Convivo app 3000
Supabase API (Kong) 54321
Supabase Studio 54323
Postgres 54322
SMTP (Mailpit) 54324

12. Demo accounts

Login = QR code (typed or scanned) + email. The QR token is the password.

Person Role QR code Email
Ana Silva attendee CVV-ANA-4821 [email protected]
Bruno Costa staff CVV-BRU-1177 [email protected]
Rita Lopes staff CVV-RIT-9034 [email protected]
Admin admin CVV-ADM-0001 [email protected]
Tomás Ribeiro attendee CVV-TOM-5566 [email protected]
Sofia Almeida attendee CVV-SOF-2299 [email protected]
Marco Chen attendee CVV-MRC-7712 [email protected]
Julia Santos attendee CVV-JUL-3345 [email protected]
Pedro Nunes attendee CVV-PED-8801 [email protected]
Carla Mendes attendee CVV-CAR-6623 [email protected]
Diego Ferreira attendee CVV-DIE-4458 [email protected]
Marina Costa attendee CVV-MNA-2210 [email protected]
Lucas Oliveira attendee CVV-LUC-9987 [email protected]

Suggested demo flow:

  1. Log in as Ana (attendee) → see Home, Agenda, Leaderboard.
  2. Scan Marco (CVV-MRC-7712) → send a connection request.
  3. Log in as Bruno (staff) → the Scan tab becomes Check-in → pick a session → scan Carla (CVV-CAR-6623) → she gets +10.
  4. Watch the Leaderboard update live.

13. Roadmap

Phase Scope Status
0 Dockerized Supabase core: schema, RLS, transactional points RPCs, seed ✅
1 Attendee web PWA: login, Home, Agenda, Scan/Connect, Check-in, Feedback, Leaderboard, Profile ✅
2 Pretix interface — sync tickets → attendees (QR tokens, roles) ⬜ next
3 Admin app (admin.appe.at) — manage attendees, sessions, points, event ⬜
4 Sessionize interface — sync the real agenda (slots, sessions, speakers) ⬜

Subdomains (convivo.appe.at, admin.appe.at, db.appe.at, pretix.eu, sessionize.com) do not exist yet — everything runs on localhost for now.

14. Out of scope (v1)

  • Push notifications (connection requests are seen when the app is opened)
  • Multi-day events
  • Session capacity enforcement
  • i18n / offline mode

15. Open questions

  1. Schedule times — the 6 slot times above are an assumption; confirm against the real agenda (Phase 4 will pull them from Sessionize).
  2. Connection acceptance — in-app only for v1? (Push notifications would be a later add-on.)
  3. Pretix mapping — which ticket fields map to role (attendee/staff/admin) and company?
S
Description
No description provided
Readme
7.4 MiB
0 Stars 1 Watchers 0 Forks
Languages
TypeScript 47.2%
PLpgSQL 33.8%
JavaScript 5.3%
Python 4.9%
CSS 4.7%
Other 4.1%