MetaShift is the overall application (frontend + backend). ObserverShift is the System Intelligence Layer (telemetry, conflict detection, auto-resolution).
- Stack: Node.js (Express) backend, React + Vite + Tailwind frontend, Supabase DB.
- Real-time: WebSockets for live events; optional Supabase Realtime.
- Privacy: Telemetry only—no user content, screen data, camera/mic, or PII stored. See Trust & Privacy.
Primary job: See what needs attention and what was done about it. Run the demo, watch conflicts and resolutions, and replay any incident.
| Folder | Purpose |
|---|---|
backend/ |
Node + Express API, WebSocket, ObserverShift |
frontend/ |
React + Vite + Tailwind UI |
supabase/ |
SQL migrations + notes |
cd backend
cp .env.example .env
npm install
npm run dev- Server:
http://localhost:3001 - Health (for Render / load balancers):
GET /health→{ "ok": true, "app": "MetaShift" } - API health:
GET /api/v1/health/ping→{ "ok": true, "app": "MetaShift" } - Pipeline status:
GET /api/v1/health/pipeline→{ last_telemetry_at, last_conflict_at } - WebSocket:
ws://localhost:3001/ws - API versioning: use
/api/v1/prefix; legacy/api/still works. Seebackend/openapi.yaml.
cd frontend
cp .env.example .env
npm install
npm run dev- UI:
http://localhost:5173(Vite proxies/apiand/wsto the backend; leaveVITE_BACKEND_URLempty or set tohttp://localhost:3001). - Page shows MetaShift Online and ObserverShift Layer: Connected.
- Run migrations in
supabase/migrations/in order (001–010: tenant_id, topology_edges, conflict_engine_cache, tenants_and_auth, RLS, usage_metrics, notification_webhooks, audit_log, api_keys). - See
supabase/NOTES.mdand backend/frontend.env.exampleforSUPABASE_URL,SUPABASE_JWT_SECRET, and keys.
- Auth: Supabase Auth (sign up / sign in). Backend verifies JWT (
SUPABASE_JWT_SECRET) or API key (X-API-Key). Without JWT secret, dev mode allows unauthenticated access. - Tenants: Workspace selector in the UI; all API requests send
X-Tenant-ID. Tenants and membership intenantsandtenant_members. - RLS: Tenant-scoped Row Level Security on all ObserverShift tables (see migration 006).
- Usage & billing:
usage_metricstable andGET /api/v1/usage; Settings → Usage in the UI. - Webhooks: Configure notification URLs in Settings → Webhooks; called on conflict_detected and conflict_resolved.
- Audit log: Actions logged to
audit_log; read-onlyGET /api/v1/auditand Settings → Audit log. - API keys: Create/revoke in Settings → API keys; use header
X-API-Keyfor programmatic access. - Export:
GET /api/v1/export/eventsandGET /api/v1/export/conflictswith?from=&to=&format=json|csv. - Status:
GET /api/v1/health/statusand/statusin the UI; footer links to System status and Help & contact. - Retention: Optional
node backend/scripts/retention-cleanup.js(seeRETENTION_DAYSin env and Trust & Privacy). - Tests: Backend
npm run test(Jest); frontendnpm run test(Vitest).
- The "Advanced: Realtime session" in the UI is for use with an external agent service that posts events to this backend. Camera/mic are not used by this app unless that agent is configured to use them. See Trust & Privacy.
Do not commit .env or any file containing real keys or secrets. Copy .env.example to .env locally and set values in the host dashboard for production.
- Supabase: Create a project, run migrations from
supabase/migrations/, and copy URL, anon key, service role key, and JWT secret. - Render: New → Blueprint → connect this repo. Render creates metashift-backend and metashift-frontend from
render.yaml. - Backend: In the backend service, set env:
SUPABASE_URL,SUPABASE_SERVICE_KEY,SUPABASE_JWT_SECRET, andCORS_ORIGIN(your frontend URL(s), comma-separated). Health check is GET /health. - Frontend: In the frontend service, set env:
VITE_BACKEND_URL(backend URL, no trailing slash),VITE_SUPABASE_URL,VITE_SUPABASE_ANON_KEY. Redeploy so the build picks them up. - Open the frontend URL; dashboard and WebSocket should connect.
- Deploy the backend first (e.g. on Render) and note its URL.
- Vercel → Add New → Project → import this repo. Set Root Directory to
frontend. - Add env:
VITE_BACKEND_URL(backend URL),VITE_SUPABASE_URL,VITE_SUPABASE_ANON_KEY. Deploy. - Set the backend’s
CORS_ORIGINto include your Vercel URL.
Full deploy guide — env var reference, checklist, and GitHub CI.
- Trust & Privacy – what we store, what we don’t, retention, agent sessions.
- Packaging & metrics – units for productizing (per env, per conflict, per events).
npm run devin backend starts the Express server (MetaShift branding in logs and/api/v1/health/ping).npm run devin frontend starts the Vite UI (dashboard, demo, incident replay).