---
created: 2026-03-12
source: Growth-Engine
tags: [agent-archive, growth-engine]
---

# Control Centre — Supabase Integration Proof

**Date:** 2026-03-05
**Commit:** 222db0e
**Status:** ✅ Complete

## Mission
Wire Control Centre pages to live Supabase `cc_*` schema with realtime updates and graceful fallbacks.

## Changes Summary

### Pages Wired to Real Data (5/5)
1. **CommandCentre** (`/`)
   - `useAgentSnapshots()` → agent status cards
   - `useTasks()` → "Your Tasks" section
   - `useApproveAction()` / `useRejectAction()` → approval workflow
   - Fallback: DEMO_STATUSES, MY_TASKS_FALLBACK

2. **Tasks** (`/tasks`)
   - `useTasks()` → kanban board data
   - `useCreateTask()` → new task modal
   - `useUpdateTask()` → drag-drop status changes
   - Fallback: INITIAL_TASKS

3. **Council** (`/council`)
   - `useCouncilTopics()` → topic sidebar
   - `useCouncilMessages(topicId)` → message thread **with realtime subscription**
   - `useSendCouncilMessage()` → send message
   - Fallback: DEMO_TOPICS, DEMO_MESSAGES

4. **Fleet** (`/fleet`)
   - `useAgentSnapshots()` → agent table rows (status, uptime, sessions, memory)
   - Fallback: DEMO statuses

5. **Projects** (`/projects`)
   - `useProjects()` → project cards
   - `useTasks()` → task counts per project
   - Fallback: DEMO_PROJECTS

### Components Wired (2/2)
1. **ActivityFeed**
   - `useActivityFeed(20)` → event feed **with realtime subscription**
   - Fallback: FALLBACK_EVENTS

2. **PendingApprovals**
   - `useApprovals('pending')` → approval list
   - Fallback: FALLBACK_APPROVALS

### Hooks Enhanced
**`src/hooks/useSupabase.js`:**
- ✅ Realtime subscription added to `useCouncilMessages()` (per topic)
- ✅ Realtime subscription added to `useActivityFeed()` (all events)
- Both use `useEffect` to subscribe/unsubscribe on mount/unmount

## Build Verification
```bash
$ npm run build
✓ built in 4.25s
dist/index-B1d6U6_q.js  399.26 kB │ gzip: 119.30 kB
```
✅ No errors, production build ready.

## Deployment Status
- **App runs on:** 127.0.0.1:3100 (local dev server)
- **Public domain routing:** Not configured yet (requires Nginx/Caddy reverse proxy on VPS)
- **Next step:** Configure `cc.rateright.com.au` → `127.0.0.1:3100` in web server

## Files Changed (8 modified, 4 new)
### Modified:
1. `src/pages/CommandCentre.jsx` — wired snapshots, tasks, approvals
2. `src/pages/Tasks.jsx` — wired tasks with create/update mutations
3. `src/pages/Council.jsx` — wired topics/messages with realtime
4. `src/pages/Fleet.jsx` — wired agent snapshots
5. `src/pages/Projects.jsx` — wired projects + task counts
6. `src/components/dashboard/ActivityFeed.jsx` — wired activity with realtime
7. `src/components/dashboard/PendingApprovals.jsx` — wired approvals
8. `src/hooks/useSupabase.js` — added realtime subscriptions

### New:
- `proof-auth-errors-last30m.txt` (prior work artifact)
- `proof-bundle-2026-03-04T22-24.json` (prior work artifact)
- `scripts-live-sync.mjs` (prior work artifact)
- `supabase-control-centre-schema.sql` (schema reference)

## Commit Hash
```
222db0e feat: wire all pages to Supabase with realtime updates
```

## Follow-Up Actions Required
1. **Deploy to production:** `pm2 restart control-centre` (if running) or `npm run build && pm2 start ecosystem.config.js`
2. **Configure reverse proxy:** Point `cc.rateright.com.au` to `127.0.0.1:3100`
3. **Verify Supabase realtime:** Ensure `.env` has valid `VITE_SUPABASE_URL` and `VITE_SUPABASE_ANON_KEY`
4. **Test end-to-end:** Send council message, drag task card, verify realtime updates

---
**Proof Owner:** CC VPS
**Verified By:** Build passed, all pages load with fallback data, realtime hooks implemented.
