# Next Steps What's done, what's next, and the open decisions. The full roadmap lives in the root [`roadmap.md`](../roadmap.md); this file is the working detail for the current phase. > **Current state:** Phases 0–2 are complete and verified. The project is now in > the **Redesign** (Phases 3–6), driven by a new multi-event data model. We work > through the redesign phase by phase and stop for review at the end of each. ## Done ### Phase 0 — Dockerized Supabase core ✅ - Full schema (9 tables), RLS on every table, transactional points RPCs. - Seed: 6 slots, 18 sessions, 13 demo users (QR token = auth password). - Runs via the Supabase CLI (`supabase start` / `supabase db reset`). - Details: [backend/README.md](./backend/README.md). ### Phase 1 — Attendee web PWA ✅ - Login (QR + email, 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. - All flows browser-tested; Docker build + proxy + login verified. - Details: [frontend/README.md](./frontend/README.md). ### Phase 2 — Admin console (Convivo Admin) ✅ A separate desktop-first web app on :3001, guarded to the admin role. - **Login** — same QR + email flow, but guarded: non-admin accounts are signed out and rejected ("This account is not an admin"). - **Dashboard** — live stats + top points + recent activity. - **Attendees** — searchable table; edit name/company/role, view + **reset QR token** (new `reset_qr_token` RPC), **adjust points** (via `adjust_points`). - **Schedule** — manage slots + sessions (create/edit/delete). - **Activity** — check-ins, connections, and feedback tables. - Same-origin proxy to Supabase (Vite dev on :3001 / nginx in Docker). - Docker: `convivo-admin` service on :3001, same network + proxy pattern. - All views + flows browser-tested; Docker build + proxy + login verified. - Details: [frontend/admin-app.md](./frontend/admin-app.md). > **Note:** Phases 0–2 built the `profiles`-based single-event model. Phase 3 > **replaces** that schema. ## The Redesign (Phases 3–6) ### Phase 3 — Data model 🔨 (in progress) A new migration (`20260824000000_redesign.sql`) + seed rewrite. The `profiles` table is dropped; everything is re-scoped to **event + contact**. **New tables** - **contacts** (PK = `email`): `full_name`, `linkedin_url` (null), `show_email` / `show_linkedin` (visibility toggles, default off), `is_admin` (default false), `qr_token` (unique — the login password), `created_at`. Mirrors `auth.users` (email + bcrypt(qr_token) in `encrypted_password`). - **events**: `id`, `name`, `start_date`, `end_date`, `location`, `is_active` (partial unique index → at most one active), + maintained aggregate columns: `avg_feedback`, `num_sessions`, `num_speakers`, `num_registrations`, `num_checked_in_registrations`. - **registrations**: `id`, `event_id`, `contact_email`, `type` (`attendee|speaker|staff|sponsor`, default `attendee`), `checked_in` (default false). Unique `(event_id, contact_email)`. `sponsor` type only allowed if a sponsor lookup is filled (enforced in RPC/trigger). - **sponsors**: `id`, `event_id`, `type` (`headline|platinum|gold|silver|community|swag|catering|diversity`), `name`, `email`, `phone`, `paid` (default false — unpaid hidden from the list), `amount_eur`, `contact_email` (nullable lookup), `created_at`. **Changed tables** - **slots**: + `event_id`, + `type` (`session|lunch_break|coffee_break|keynote|close_up`). - **sessions**: + `event_id`, + `average_feedback` (numeric, null), + `ai_generated_feedback` (text), + `material_path` (text, null — storage object path). - **session_speakers** (new join): `session_id` + `contact_email`, PK on both. A session must have ≥1 speaker (trigger). - **preferences / connections / checkins / feedback / leaderboard / points_log**: re-scoped to `event_id` + `contact_email` (replacing `profile_id`). - **Drop**: `profiles`. **RPCs** - New: `get_active_event()`, `upsert_contact` (create-if-not-exists by email — the interface flow), `create_registration` (contact lookup; enforces sponsor rule), `set_registration_type`, `evaluate_session_feedback` (admin stub). - Updated: `submit_feedback` (recalc `session.average_feedback` + set `ai_generated_feedback` state + event avg), `checkin_attendee` (guard = `contact.is_admin`), `lanyard_lookup` (contact + registration type for the active event, respecting visibility toggles), `reset_qr_token` (on contact), `adjust_points` (per event/registration). **RLS + storage** - Rewrite policies for the new tables. Contacts: own or `is_admin`. Sponsors: only `paid = true` visible to non-admins. Schedule/registrations readable per active event; admin writes. - New `materials` storage bucket (read for event attendees, write for speakers/admins). ### Phase 4 — APPE Admin ⬜ Rebrand "Convivo Admin" → **APPE Admin** (title, sidebar, manifest, docs) and rebuild the views on the new model: - **Dashboard** — active event card (name, dates, location, aggregates) + top points + recent activity; graceful "no active event". - **Contacts** — table (email, name, LinkedIn, visibility toggles, `is_admin`, QR token); edit; reset QR; toggle `is_admin`; set visibility. - **Registrations** — per active event; list (contact, type, checked-in); change type (enforce sponsor rule); mark checked-in. - **Sponsors** — list (paid only visible to attendees; admin sees all); add/edit (type, name, email, phone, paid, amount, contact lookup). - **Schedule** — slots (with type) + sessions (speakers 1:N, material upload, `average_feedback`, `ai_generated_feedback` + "Evaluate" stub button). - **Activity** — check-ins / connections / feedback (per active event). - **Event management** — create event, set active (only one), edit dates/location. ### Phase 5 — Convivo App ⬜ - **Login ≥24h** — `jwt_expiry` = 86400 in `config.toml`; session persists in localStorage. - **5s visibility-aware polling** — poll schedule/connections/points every 5s only while `document.visibilityState === 'visible'`; no background polling. - **Staff-only check-in** — guard = `contact.is_admin`. - **QR type badge** — scanning a peer shows their registration type (Attendee/Speaker/Sponsor/Staff). - **Pending-connection red dot** — subtle red dot (top-right) on the Connect box when there are pending incoming requests (`active` class/id). - **Speaker material** — speakers see a subtle non-dismissible notification until material is uploaded; upload in-app (to `materials`); once uploaded the notification disappears and the material is downloadable by **all** event attendees (not just check-ins). - **Browser-accessible** — responsive layout works in a desktop browser. - **No active event** — graceful empty state. ### Phase 6 — Branding ⬜ - `https://www.appe.at/assets/appe_full.png` as favicon + PWA icon (192/512) for **both** apps. Update `index.html` + `manifest.webmanifest` + `public/`. ## Later (post-redesign) ### Phase 7 — Pretix interface ⬜ Sync **tickets → contacts + registrations** from [Pretix](https://pretix.eu). Replaces the hand-written seed with real ticket data. **Goal:** when someone buys a ticket in Pretix, a contact is created (if it doesn't exist) and a registration is created using the contact lookup. Likely scope: - A **sync job / edge function** (or a small service) that pulls orders/attendees from the Pretix API and upserts `contacts` + `registrations` (+ `auth.users`). - **QR token generation** for each contact (the lanyard token). - **Type mapping** — which Pretix ticket type maps to `attendee` / `speaker` / `staff` / `sponsor` (open question). - **Idempotency** — re-running the sync must not duplicate (key on the Pretix order/attendee id + email). - A way to **print/export lanyard QR codes** for the event. **Open questions:** 1. Which Pretix fields map to registration type and contact? 2. Push (webhook on new order) vs pull (scheduled sync)? 3. Where does the sync job run (Supabase Edge Function vs a separate container)? ### Phase 8 — Sessionize interface ⬜ Sync the **real agenda** (slots, sessions, speakers, rooms) from [Sessionize](https://sessionize.com) instead of the hand-written seed. Likely scope: - A sync job that pulls the event schedule from the Sessionize API and upserts `slots` + `sessions` + `session_speakers`. - Map Sessionize track/room/time → our `slots` / `sessions` shape. - This makes the agenda **data-driven** from the real event. ## Cross-cutting / later - **Real event clock** — replace the simulated `DEFAULT_NOW` ([frontend/app-structure.md#the-event-clock](./frontend/app-structure.md#the-event-clock)) with `new Date()` for the live event. - **Subdomains** — `convivo.appe.at`, `admin.appe.at`, `db.appe.at` don't exist yet; everything is on localhost. DNS + TLS + a reverse proxy in front of the Supabase core will be needed for a real deployment. - **Push notifications** — connection requests are currently seen when the app is opened. (Out of scope for v1.) - **Testing** — no automated tests yet. Candidates: RPC unit tests (points idempotency, role guards), and an E2E smoke test (login → check-in → leaderboard). ## Open decisions (need user input) 1. **Pretix type mapping** — which ticket type = speaker/staff/sponsor? 2. **Sync style** — webhook (push) vs scheduled (pull) for Pretix/Sessionize? 3. **Sync runtime** — Supabase Edge Functions vs separate containers? 4. **AI provider** — which LLM/API for `ai_generated_feedback` (Phase 4+)? 5. **Deployment target** — stay on localhost, or plan for the `appe.at` subdomains now? ## How to pick up work 1. Read [architecture.md](./architecture.md) for the system overview. 2. For a phase, read the relevant component docs (backend or frontend) and the source of truth files they link to. 3. Keep the docs updated in the same change that changes behavior (see the conventions in [README.md](./README.md)).