feat: add sidecar service for Sessionize sync
- Introduced a new Node HTTP service (sidecar) to sync event agendas from Sessionize into Convivo. - Implemented two import paths: API sync and Excel import for session and speaker data. - Added necessary database migrations for sessionize integration, including new columns and audit tables. - Created functions for handling speaker and session imports, ensuring proper error handling and logging. - Established row-level security and grants for new functions to restrict access to service-role only.
This commit is contained in:
1 parent
8054d0ace2
commit
f7aea663d8
31 files changed
+2729
-390
No files matched your search
+30
-8
@@ -28,6 +28,9 @@ flowchart LR
|
||||
subgraph AdminC["convivo-admin container (:3001)"]
|
||||
NA["nginx<br/>serves SPA + proxies Supabase paths"]
|
||||
end
|
||||
subgraph SideC["convivo-sidecar container (:3002)"]
|
||||
SC["node<br/>Sessionize sync (on demand)"]
|
||||
end
|
||||
subgraph Core["Supabase core (Supabase CLI)"]
|
||||
K["Kong API gateway<br/>:54321"]
|
||||
K --> G["GoTrue (Auth)"]
|
||||
@@ -42,10 +45,16 @@ flowchart LR
|
||||
|
||||
A -->|"same-origin /auth /rest /realtime /storage /functions"| N
|
||||
AD -->|"same-origin /auth /rest /realtime /storage /functions"| NA
|
||||
AD -->|"same-origin /sidecar/*"| SC
|
||||
N -->|"proxy (supabase_kong_Convivo:8000)"| K
|
||||
NA -->|"proxy (supabase_kong_Convivo:8000)"| K
|
||||
SC -->|"service-role key"| K
|
||||
```
|
||||
|
||||
The **sidecar** (`:3002`) is the one server-side component that holds the
|
||||
service-role key. It is driven by the admin's **Interfaces** menu and runs on
|
||||
demand only — see [backend/sidecar.md](./backend/sidecar.md).
|
||||
|
||||
**Key idea:** there is **no custom backend**. Supabase provides auth, data,
|
||||
business logic (as Postgres RPCs), and realtime. The app is a thin client that
|
||||
talks to Supabase through **same-origin paths**, so there is no CORS to manage.
|
||||
@@ -70,8 +79,9 @@ Everything server-side lives in Postgres. See [backend/README.md](./backend/READ
|
||||
keep the leaderboard consistent. → [backend/rpcs.md](./backend/rpcs.md)
|
||||
- **Security** — Row Level Security on every table; the app only ever uses the
|
||||
**anon key + the user's session JWT**. → [backend/rls.md](./backend/rls.md)
|
||||
- **Data** — seed with 1 event, 6 slots, 18 sessions, 14 contacts, 13
|
||||
registrations, 3 sponsors. → [backend/seed.md](./backend/seed.md)
|
||||
- **Data** — seed with 1 real event (Power Platform Bootcamp AT): 10 slots, 22
|
||||
sessions, 54 contacts (50 attendees + 4 staff). Speakers are added via the
|
||||
Excel import, not the seed. → [backend/seed.md](./backend/seed.md)
|
||||
|
||||
### Frontend — the attendee PWA
|
||||
A single-page React app with a tab shell and a few full-screen takeovers. See
|
||||
@@ -136,7 +146,9 @@ the work atomically, and the `leaderboard` table change fans out over Realtime.
|
||||
**24 hours** (`jwt_expiry = 86400`). Every request sends the **anon key**
|
||||
(public) + the **session JWT** (identity).
|
||||
- The **service-role key is never in the app** — it bypasses RLS and stays
|
||||
server-side. See [backend/rls.md](./backend/rls.md) for what each role can do.
|
||||
server-side. The **sidecar** is its first consumer (the Sessionize sync).
|
||||
See [backend/rls.md](./backend/rls.md) for what each role can do and
|
||||
[backend/sidecar.md](./backend/sidecar.md) for the sidecar.
|
||||
|
||||
## 7. Environment & ports
|
||||
|
||||
@@ -144,6 +156,7 @@ the work atomically, and the `leaderboard` table change fans out over Realtime.
|
||||
|---|---|---|
|
||||
| **Convivo app** | **3000** | Vite dev server (dev) or nginx (Docker) |
|
||||
| **Convivo admin** | **3001** | Vite dev server (dev) or nginx (Docker) |
|
||||
| **Sync sidecar** | **3002** | Node service (Docker) or `npm run sidecar:dev` (dev) |
|
||||
| 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`) |
|
||||
@@ -155,8 +168,9 @@ npm run db:start # start the Supabase core (Docker)
|
||||
npm run db:reset # (re)apply migrations + seed
|
||||
npm run app:dev # attendee dev server on :3000
|
||||
npm run admin:dev # admin dev server on :3001
|
||||
npm run sidecar:dev # Sessionize sync sidecar on :3002
|
||||
# — or —
|
||||
docker compose up --build # both apps as Docker sidecars (:3000 + :3001)
|
||||
docker compose up --build # apps + sidecar as Docker sidecars (:3000 + :3001 + :3002)
|
||||
```
|
||||
|
||||
## 8. The demo clock
|
||||
@@ -176,8 +190,11 @@ Convivo/
|
||||
│ └─ 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
|
||||
│ ├─ nginx.conf.template # SPA + same-origin proxy to the Supabase core + /sidecar
|
||||
│ └─ src/ # views, components, lib, context
|
||||
├─ apps/sidecar/ # Sessionize sync sidecar (Node, on demand)
|
||||
│ ├─ Dockerfile # node:20-alpine + xlsx (parses the Excel export)
|
||||
│ └─ src/server.js # /health, /status, /run, /import-excel (blocking)
|
||||
├─ supabase/
|
||||
│ ├─ config.toml # Local stack config (ports, auth, RLS defaults)
|
||||
│ ├─ migrations/
|
||||
@@ -186,9 +203,14 @@ Convivo/
|
||||
│ │ ├─ 20260824000000_redesign.sql # multi-event model, RPCs, RLS, materials
|
||||
│ │ ├─ 20260825000000_interfaces.sql # external_id (sync objects later dropped)
|
||||
│ │ ├─ 20260826000000_registration_qr_token.sql # QR token on registration
|
||||
│ │ └─ 20260830000000_remove_interfaces.sql # ← drops the sync RPCs + sync_runs
|
||||
│ └─ seed.sql # 1 event, 6 slots, 18 sessions, 14 contacts, demo state
|
||||
├─ docker-compose.yml # Runs both app sidecars on the Supabase network
|
||||
│ │ ├─ 20260827000000_admin_password_profile.sql # staff password + self-service profile
|
||||
│ │ ├─ 20260828000000_staff_exclusions_password_sync.sql # staff leaderboard exclusion + password sync
|
||||
│ │ ├─ 20260829000000_registration_type_optionset_speaker_promote_welcome_checkin.sql
|
||||
│ │ ├─ 20260830000000_remove_interfaces.sql # ← drops the sync RPCs + sync_runs
|
||||
│ │ ├─ 20260831000000_sessionize_sidecar.sql # sessionize_endpoint + sync_runs + sync RPC
|
||||
│ │ └─ 20260832000000_slots_enum_excel_import.sql # slot_type enum + slots.id default + Excel RPC
|
||||
│ └─ seed.sql # 1 real event, 10 slots, 22 sessions, 54 contacts (50 attendees + 4 staff)
|
||||
├─ docker-compose.yml # Runs the app sidecars + sync sidecar on the Supabase network
|
||||
├─ docs/ # ← this documentation
|
||||
└─ mockup/index.html # Original interactive mockup (design reference)
|
||||
```
|
||||
Reference in new issue
Block a user