Phase 2: Admin console (admin.appe.at)

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.

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]>
This commit is contained in:
committed 2026-08-22 19:47:22 +02:00
1 parent 015c0a3a06
commit 32c86767ef
45 files changed
+4425 -87

No files matched your search

+30 -6
View File
@@ -16,14 +16,18 @@ make connections, get checked in by staff, and rate sessions. Every action earns
```mermaid
flowchart LR
subgraph Browser["Browser (attendee / staff phone)"]
subgraph Browser["Browser"]
A["Convivo PWA<br/>React 18 + Vite 5 + TS<br/>mobile-first, installable"]
AD["Convivo Admin<br/>React 18 + Vite 5 + TS<br/>desktop-first console"]
end
subgraph Docker["Docker (local)"]
subgraph AppC["convivo-app container (:3000)"]
N["nginx<br/>serves SPA + proxies Supabase paths"]
end
subgraph AdminC["convivo-admin container (:3001)"]
NA["nginx<br/>serves SPA + proxies Supabase paths"]
end
subgraph Core["Supabase core (Supabase CLI)"]
K["Kong API gateway<br/>:54321"]
K --> G["GoTrue (Auth)"]
@@ -37,7 +41,9 @@ flowchart LR
end
A -->|"same-origin /auth /rest /realtime /storage"| N
AD -->|"same-origin /auth /rest /realtime /storage"| NA
N -->|"proxy (supabase_kong_Convivo:8000)"| K
NA -->|"proxy (supabase_kong_Convivo:8000)"| K
```
**Key idea:** there is **no custom backend**. Supabase provides auth, data,
@@ -72,6 +78,16 @@ A single-page React app with a tab shell and a few full-screen takeovers. See
- **Screens** — Login, Home, Agenda, Scan/Check-in, Connections, Feedback, Leaderboard, Profile. → [frontend/screens.md](./frontend/screens.md)
- **API client** — a thin typed wrapper over `supabase.rpc` / `supabase.from`. → [frontend/api-client.md](./frontend/api-client.md)
### Frontend — the admin console
A separate desktop-first React app for organizers, guarded to the **admin** role.
See [frontend/admin-app.md](./frontend/admin-app.md):
- **Views** — Dashboard (live stats), Attendees (edit / reset QR / adjust
points), Schedule (manage slots + sessions), Activity (check-ins /
connections / feedback).
- **Auth guard** — same QR + email login, but non-admin sessions are rejected.
- **New RPC** — `reset_qr_token` regenerates an attendee's lanyard token and
syncs the Auth password (see [backend/rpcs.md](./backend/rpcs.md)).
## 5. How a request flows (example: staff check-in)
```mermaid
@@ -113,7 +129,8 @@ the work atomically, and the `leaderboard` table change fans out over Realtime.
| Service | Port | Notes |
|---|---|---|
| **Convivo app** | **3000** | Vite dev server (dev) or nginx (Docker) |
| Supabase API (Kong) | 54321 | The single gateway the app proxies to |
| **Convivo admin** | **3001** | Vite dev server (dev) or nginx (Docker) |
| Supabase API (Kong) | 54321 | The single gateway the apps proxy to |
| Supabase Studio | 54323 | UI — login `postgres` / `postgres` |
| Postgres | 54322 | Direct DB access (`postgres` / `postgres`) |
| SMTP (Mailpit) | 54324 | Captures emails (none are sent in this flow) |
@@ -122,9 +139,10 @@ the work atomically, and the `leaderboard` table change fans out over Realtime.
```bash
npm run db:start # start the Supabase core (Docker)
npm run db:reset # (re)apply migrations + seed
npm run app:dev # dev server on :3000
npm run app:dev # attendee dev server on :3000
npm run admin:dev # admin dev server on :3001
# — or —
docker compose up --build # app as a Docker sidecar on :3000
docker compose up --build # both apps as Docker sidecars (:3000 + :3001)
```
## 8. The demo clock
@@ -142,11 +160,17 @@ Convivo/
│ ├─ Dockerfile # Multi-stage: build → nginx
│ ├─ nginx.conf.template # SPA + same-origin proxy to the Supabase core
│ └─ src/ # screens, components, lib, context
├─ apps/admin/ # Admin console (React + Vite + TS, desktop-first)
│ ├─ Dockerfile # Multi-stage: build → nginx
│ ├─ nginx.conf.template # SPA + same-origin proxy to the Supabase core
│ └─ src/ # views, components, lib, context
├─ supabase/
│ ├─ config.toml # Local stack config (ports, auth, RLS defaults)
│ ├─ migrations/ # 20260822000000_init.sql — schema, RLS, RPCs
│ ├─ migrations/
│ │ ├─ 20260822000000_init.sql # schema, RLS, points RPCs
│ │ └─ 20260823000000_admin_app.sql # admin read RLS + reset_qr_token RPC
│ └─ seed.sql # Slots, sessions, 13 demo users, Ana's demo state
├─ docker-compose.yml # Runs the app sidecar on the Supabase network
├─ docker-compose.yml # Runs both app sidecars on the Supabase network
├─ docs/ # ← this documentation
└─ mockup/index.html # Original interactive mockup (design reference)
```