diff --git a/AGENT.MD b/AGENT.MD index 282a0dd..e7d57ab 100644 --- a/AGENT.MD +++ b/AGENT.MD @@ -5,16 +5,7 @@ - **Web Search Integration:** Use web search capabilities immediately whenever you encounter unknown APIs, library updates, or uncertain technical patterns. Never guess implementation details. - **Role Boundary:** You act strictly as the **Supervisor / Orchestrator Agent**. You supervise, coordinate, and maintain project state. You DO NOT write or edit production code directly unless explicitly requested for trivial inline fixes. -## 2. Multi-Agent Delegation Model -- **Sub-Agent Engine:** Delegate all code implementation, refactoring, and file generation tasks to sub-agents powered by the `qwen3.6-27b` family. -- **Task Delegation Prompting:** When issuing tasks to sub-agents, provide explicit, isolated, and highly detailed prompts containing: - 1. **Context & Objective:** Precise scope of what needs to be built. - 2. **Inputs:** Exact file paths, interfaces, or schemas required. - 3. **Desired Output:** Expected code structure, exported functions, tests, or documentation artifacts. - 4. **Constraints:** Styling rules, error handling guidelines, and prohibited patterns. -- **Supervisor Role:** Verify the outputs from sub-agents against project requirements before accepting changes. - -## 3. Mandatory Documentation Architecture (`/docs`) +## 2. Mandatory Documentation Architecture (`/docs`) You are responsible for keeping living documentation updated from day zero. Every project MUST maintain and enforce the following structure inside the root `/docs` folder: docs/ diff --git a/README.md b/README.md index 31dce02..64d35cd 100644 --- a/README.md +++ b/README.md @@ -2,12 +2,16 @@ **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 + Phase 2 complete. +> **Status:** Phases 0–2 complete. Now in the **Redesign** (Phases 3–6) — a new +> multi-event data model (contacts / events / registrations / sponsors), the +> admin app rebranded to **APPE Admin**, and new Convivo App behaviors. +> > - **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. > - **Phase 2** — Admin console (desktop-first, admin-role only): Dashboard, Attendees (edit / reset QR / adjust points), Schedule (slots + sessions), Activity. > -> Next: Phase 3 (Pretix ticketing interface), Phase 4 (Sessionize interface). +> **Next:** Phase 3 (data model) → 4 (APPE Admin) → 5 (Convivo App) → 6 +> (branding) → 7 (Pretix) → 8 (Sessionize). See [`roadmap.md`](./roadmap.md). --- @@ -216,16 +220,19 @@ Open **http://localhost:3000** (attendee) and **http://localhost:3001** (admin). > **Reset the demo data at any time:** `npm run db:reset` (re-applies migrations + seed). -### Ports +### Local port map -| Service | Port | +| Service | URL | |---|---| -| Convivo app (attendee) | **3000** | -| Convivo admin | **3001** | -| Supabase API (Kong) | 54321 | -| Supabase Studio | 54323 | -| Postgres | 54322 | -| SMTP (Mailpit) | 54324 | +| Attendee app | **http://localhost:3000** | +| Admin console | **http://localhost:3001** | +| Supabase Studio | **http://localhost:54323** (user `postgres`, password `postgres`) | +| Supabase API (Kong) | http://127.0.0.1:54321 | +| Postgres (direct) | `postgresql://postgres:postgres@127.0.0.1:54322/postgres` | +| SMTP (Mailpit) | http://127.0.0.1:54324 (captures emails; none are sent in this flow) | + +> The `appe.at` subdomains (`convivo.appe.at`, `admin.appe.at`, `db.appe.at`) do +> not exist yet — everything runs on **localhost** for now. ## 12. Demo accounts @@ -256,13 +263,19 @@ Login = **QR code** (typed or scanned) + **email**. The QR token is the password ## 13. Roadmap +Full detail in [`roadmap.md`](./roadmap.md). + | 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** | **Admin app** (admin.appe.at) — manage attendees, sessions, points, event | ✅ | -| **3** | **Pretix** interface — sync tickets → attendees (QR tokens, roles) | ⬜ next | -| **4** | **Sessionize** interface — sync the real agenda (slots, sessions, speakers) | ⬜ | +| **2** | Admin console (Convivo Admin): Dashboard, Attendees, Schedule, Activity | ✅ | +| **3** | **Redesign — data model**: contacts / events / registrations / sponsors, slot types, session speakers + feedback/material | 🔨 next | +| **4** | **Redesign — APPE Admin**: rebrand + Contacts / Registrations / Sponsors / Schedule / Activity / event mgmt | ⬜ | +| **5** | **Redesign — Convivo App**: 24h login, 5s polling, QR type badge, red dot, speaker material | ⬜ | +| **6** | **Redesign — branding**: APPE favicon + icons for both apps | ⬜ | +| **7** | **Pretix** interface — sync tickets → contacts + registrations | ⬜ | +| **8** | **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. diff --git a/docs/README.md b/docs/README.md index c8753a6..bedf6cd 100644 --- a/docs/README.md +++ b/docs/README.md @@ -4,9 +4,9 @@ Living documentation for **Convivo** — a conference networking app that turns conference into a game. This folder is the single source of truth for *how the system works*; the root [`README.md`](../README.md) is the quick-start. -> **Status:** Phase 0 (Dockerized Supabase core) + Phase 1 (attendee web PWA) + -> Phase 2 (admin console) are complete and verified. Phases 3–4 are planned — see -> [next-steps.md](./next-steps.md). +> **Status:** Phases 0–2 are complete and verified. The project is now in the +> **Redesign** (Phases 3–6) — a new multi-event data model + APPE Admin rebrand. +> See the root [`roadmap.md`](../roadmap.md) and [next-steps.md](./next-steps.md). ## Where things live @@ -25,7 +25,7 @@ system works*; the root [`README.md`](../README.md) is the quick-start. | Attendee app: every screen (Login, Home, Agenda, Scan, …) | [frontend/screens.md](./frontend/screens.md) | | API client (how the app talks to Supabase) | [frontend/api-client.md](./frontend/api-client.md) | | **Admin console** (views, auth guard, QR reset, points, schedule) | [frontend/admin-app.md](./frontend/admin-app.md) | -| **What's next (Phase 3/4 + open items)** | [next-steps.md](./next-steps.md) | +| **What's next (Redesign Phases 3–6 + later + open items)** | [next-steps.md](./next-steps.md) | ## Reading order diff --git a/docs/next-steps.md b/docs/next-steps.md index 277a144..a8353ca 100644 --- a/docs/next-steps.md +++ b/docs/next-steps.md @@ -1,17 +1,12 @@ # Next Steps -What's done, what's next, and the open decisions. Phase order: -**0** Supabase core → **1** attendee app → **2** admin app → **3** Pretix -interface → **4** Sessionize interface. +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. -> **Renumbered:** the admin app is now **Phase 2** (built before the ticketing -> sync), and the Pretix interface is **Phase 3**. (Originally the whiteboard had -> Pretix as Phase 2 and the admin app as Phase 3.) - -> **Current state:** Phase 0 + Phase 1 + Phase 2 are **complete and verified** -> (browser-tested end-to-end, Docker-verified, pushed to -> `git.lago.dev/Lago/Convivo.git`). Per the working agreement, we **stop here** -> and let the user evaluate before starting Phase 3 (Pretix). +> **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 @@ -29,15 +24,12 @@ interface → **4** Sessionize interface. - All flows browser-tested; Docker build + proxy + login verified. - Details: [frontend/README.md](./frontend/README.md). -### Phase 2 — Admin app (admin.appe.at) ✅ -A separate desktop-first web app for event organizers, using the **admin** role -(which has direct write access to `profiles` / `slots` / `sessions` via RLS — see -[backend/rls.md](./backend/rls.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 (attendees, check-ins, connections, avg rating, - sessions) + top points + recent activity. +- **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). @@ -47,40 +39,134 @@ A separate desktop-first web app for event organizers, using the **admin** role - All views + flows browser-tested; Docker build + proxy + login verified. - Details: [frontend/admin-app.md](./frontend/admin-app.md). -## Next +> **Note:** Phases 0–2 built the `profiles`-based single-event model. Phase 3 +> **replaces** that schema. -### Phase 3 — Pretix interface ⬜ (next) -Sync **tickets → attendees** from [Pretix](https://pretix.eu) (the ticketing -system). This replaces the hand-written seed with real ticket data. +## The Redesign (Phases 3–6) -**Goal:** when someone buys a ticket in Pretix, a Convivo attendee is created -with a QR token and the right role/company. +### 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 `profiles` + `auth.users`. -- **QR token generation** for each attendee (the token that goes on the lanyard). -- **Role mapping** — which Pretix ticket type maps to `attendee` / `staff` / - `admin` (open question, see below). -- **Idempotency** — re-running the sync must not duplicate attendees (key on the - Pretix order/attendee id). +- 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 `role` and `company`? +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 4 — Sessionize interface ⬜ +### 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`. + `slots` + `sessions` + `session_speakers`. - Map Sessionize track/room/time → our `slots` / `sessions` shape. -- This makes the agenda **data-driven** from the real event (the schedule is - already stored in Postgres, so the app needs no changes). +- This makes the agenda **data-driven** from the real event. ## Cross-cutting / later @@ -98,10 +184,11 @@ Likely scope: ## Open decisions (need user input) -1. **Pretix role mapping** — which ticket type = staff/admin? +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. **Deployment target** — stay on localhost, or plan for the `appe.at` +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 diff --git a/roadmap.md b/roadmap.md new file mode 100644 index 0000000..3a64f71 --- /dev/null +++ b/roadmap.md @@ -0,0 +1,81 @@ +# Convivo — Roadmap + +Living roadmap. The top section is the **current focus**; completed phases are +summarized below. For *how* each piece works, see [`docs/`](./docs/README.md). + +> **Status:** 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. + +--- + +## Current focus — the Redesign (Phases 3–6) + +A new data model replaces the single-event `profiles` schema with a +**multi-event** model, the admin app is rebranded to **APPE Admin**, and the +Convivo App gains several behaviors. Details live in +[`docs/next-steps.md`](./docs/next-steps.md). + +| Phase | Scope | Status | +|---|---|---| +| **3** | **Data model** — `contacts` (email PK), `events` (one active), `registrations` (per ticket), `sponsors`; slot types; session speakers (1:N); session `average_feedback` / `ai_generated_feedback` / `material`; activity tables re-scoped to event + contact; drop `profiles`; new RPCs + RLS + `materials` bucket | 🔨 in progress | +| **4** | **APPE Admin** — rebrand + new views: Dashboard (active event + aggregates), Contacts, Registrations, Sponsors, Schedule (slots/sessions/speakers/material/AI-evaluate), Activity, event management | ⬜ | +| **5** | **Convivo App** — 24h login, 5s visibility-aware polling, staff-only check-in, QR type badge, pending-connection red dot, speaker material upload/download, graceful "no active event" | ⬜ | +| **6** | **Branding** — `appe_full.png` as favicon + PWA icon for both apps | ⬜ | + +### Redesign decisions (locked) +- **Staff = admin (merged).** A contact has `is_admin` + a QR token (its login + password). `is_admin` grants both staff powers (check-in) and APPE Admin access. +- **QR token lives on the contact** (one per person). Each registration (ticket) + references the contact; the lanyard QR is the contact's token. +- **One active event at a time.** All app data is queried for the active event; + the app handles "no active event" gracefully. +- **AI feedback is a stub** this phase (field + state machine + admin "Evaluate" + button → RPC stub). Real LLM integration is a later phase. +- **Points kept, scoped per event** (check-in +10, connection +5 each, feedback + +5/+10), keyed on registration, leaderboard per active event. + +--- + +## Later (post-redesign) + +| Phase | Scope | Status | +|---|---|---| +| **7** | **Pretix interface** — sync tickets → contacts + registrations (QR tokens, types). Replaces the hand-written seed with real ticket data. | ⬜ | +| **8** | **Sessionize interface** — sync the real agenda (slots, sessions, speakers, rooms). | ⬜ | + +--- + +## Completed + +| Phase | Scope | Status | +|---|---|---| +| **0** | Dockerized Supabase core: schema, RLS, transactional points RPCs, seed | ✅ | +| **1** | Attendee web PWA: login (QR + email), Home, Agenda, Scan/Connect, Check-in, Feedback, Leaderboard, Profile | ✅ | +| **2** | Admin console (Convivo Admin): Dashboard, Attendees, Schedule, Activity; `reset_qr_token` RPC | ✅ | + +> **Note:** Phases 0–2 built the `profiles`-based single-event model. Phase 3 +> (the Redesign) **replaces** that schema — the old `profiles` table is dropped +> and the activity tables are re-scoped to the new `contacts` / `events` / +> `registrations` model. + +--- + +## Cross-cutting / later + +- **Real event clock** — replace the simulated `DEFAULT_NOW` with `new Date()`. +- **Subdomains** — `convivo.appe.at`, `admin.appe.at`, `db.appe.at` don't exist + yet; everything runs 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 (or via the 5s poll while visible). +- **Testing** — no automated tests yet. Candidates: RPC unit tests (points + idempotency, role guards, sponsor-type rule), and an E2E smoke test. + +## Open questions + +1. **Pretix mapping** — which ticket fields map to registration type and contact? +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?