FluxyChat

Architecture

Vertical platform expansion

Status: Living document — branch `fluxy` (July 2026)

Status: Living document — branch fluxy (July 2026)
Scope: ROADMAP §5.3–5.4 — FluxyHealth, FluxyEdu, FluxyEvent, FluxyFinance, Cross-Reality Continuity
Binding decisions: ROADMAP.md — Architectural Decisions Log
Expansion layer detail: platform-expansion-layer.md


Executive summary

Fluxy is repositioned from “chat SDK” to a realtime interaction platform where the room remains the central primitive. Chat, video, collaboration, streaming, game backends, IoT, and industry verticals are composable capabilities registered on a shared room kernel—not separate products with duplicated auth or event models.

This document records:

  1. An audit matrix (claim → code → UI → readiness).
  2. Current vs target architecture and capability/event contracts.
  3. Vertical blueprints (Edu first, then Health, Event, Finance, Continuity).
  4. Console IA and landing narrative migration.
  5. A prioritized backlog with acceptance criteria and honesty gates.

Golden rule: Nothing is labeled production unless persistence, authorization, tenancy, and tests exist. Client-only in-memory engines are prototype or demo, never implied backend.


Positioning

BeforeAfter
Primary story: in-app chat + AIPrimary story: one room, many realtime outcomes
Dashboard = chat ops consoleDashboard = multi-product console (Build / Products / Industries / Labs)
New modules = large SDK filesNew modules = capability layer + vertical workflows + Worker adapters (later)

Chat stays the fulcrum (membership, messages, agents, webhooks). Verticals add domain events (attendance, consent, tickets, market alerts) on the same envelope.


Audit matrix (summary)

Severity: P0 security/correctness, P1 misleading UX or data integrity, P2 quality/gaps, P3 polish.

AreaClaim / surfaceCode realityDashboardReadinessSeverityRemediation
Room kernelVersioned events, idempotent publishcreateVerticalPlatform client + Worker POST/GET /rooms/:id/capabilities/eventsVertical studios (sync badge)Beta (client + Worker audit)P2DO fan-out for live updates
PollsIdempotent vote, closeFixed in kernel + Stream/Game fixes/edu, /events, stream demoBeta (client)Wire to room DO
CRDT / whiteboardYjs + Excalidraw collaborationYjs via yjs-provider.tsx + Worker yjs-sync.js; Excalidraw lazy-loaded (collab-whiteboard.tsx); mermaid→Excalidraw stubbed for build/collabBetaP2Property tests on concurrent strokes
FluxyStreamLive polls, sentimentIn-memory fluxy-stream.ts/stream, demoPrototypeP1Poll close/vote fixes applied; backend TBD
FluxyGameAuthoritative tick, anti-cheatIn-memory fluxy-game.ts/game interactivePrototypeP1Duration/sequence/bounds fixes applied
FluxyIoTRule actions, device shadowRule actions execute; credentials stripped via toPublicDevice()/iotBeta (demo)P2Worker device-shadow adapter
FluxyEduClass + attendance + gradingvertical-workflows.ts + studio/edu live SDK demoBeta (demo)SFU + Yjs + Worker persistence
FluxyHealthHIPAASynthetic demo only; explicit non-claim/healthPreviewBAA gate before any HIPAA copy
FluxyEventTickets, Q&AWorkflow + ticket verify (demo sig)/eventsBeta (demo)Signed ticket adapter
FluxyFinanceMarket + invoicesDecimal-safe drafts; no PAN/financePreviewProvider adapters only
ContinuityCross-device handoffCheckpoints in kernel/workflow/continuityPrototypeP2DO canonical cursor + resume tokens
SDK build@fluxy-chat/sdk compilestsc clean after export fixesN/AProduction (tooling)Maintain export hygiene
Dashboard buildNext.js production buildnext build passes; Excalidraw kept; @excalidraw/mermaid-to-excalidraw pnpm stub (paste-Mermaid disabled)All routesProduction (tooling)Re-enable Mermaid import when d3/mermaid chain stabilizes
LandingPlatform not chat-onlyHero + #platform sectionMarketingBetaP2Core Web Vitals + reduced motion pass

Evidence paths:

  • Kernel: packages/sdk/src/vertical-platform.ts, vertical-workflows.ts
  • Tests: vertical-platform.test.ts, vertical-workflows.test.ts
  • Console IA: apps/dashboard/app/components/console-nav.ts
  • Studios: apps/dashboard/app/components/vertical-studio.tsx
  • Products: apps/dashboard/app/game, iot, stream/demo

Current vs target architecture

Current (branch fluxy)

flowchart TB
  subgraph Client
    UI[Dashboard vertical studios]
    SDK[@fluxy-chat/sdk]
    VP[vertical-platform + workflows]
    Mod[fluxy-game / stream / iot / crdt]
  end
  UI --> SDK
  SDK --> VP
  SDK --> Mod
  Mod -.->|in-memory| VP
  Worker[apps/worker DO + D1] -->|chat core| SDK

Target

flowchart TB
  subgraph Edge
    DO[Room DO - authority]
    Policy[Policy engine RBAC/ABAC]
    D1[(D1 audit / retention)]
    Adapters[SFU FHIR Ticketing Market IoT]
  end
  subgraph Client
    SDK[@fluxy-chat/sdk ports]
    UI[Console + vertical studios]
  end
  UI --> SDK
  SDK -->|versioned events| DO
  DO --> Policy
  DO --> D1
  DO --> Adapters

Capability model

Capabilities are registered on RoomKernelConfig with CapabilityDefinition: id, readiness, policy (roles, retention, consent).

CapabilityIdTypical verticalsNotes
chat, presenceAllExisting room core
videoEdu, Health, EventSFU adapter (Metered.ca / configurable)
whiteboardEdu, CollabYjs + snapshot every 1000 ops / 1h (ADL)
pollEdu, Event, StreamShared idempotent poll primitive
attendanceEduHeartbeat events
clinical-dataHealthFHIR adapter; no PHI in message body
ticketEventSigned lifecycle; anti-replay
market-dataFinanceSequence + stale handling
spatial, device-shadowContinuity, IoTEvent-based critical; batch telemetry

Event envelope (v1)

All vertical workflow publishes use:

  • eventId, workspaceId, roomId, type, actor, occurredAt, schemaVersion: 1, idempotencyKey, payload

Tenant mismatch throws; duplicate idempotencyKey returns existing event.


Vertical blueprints

FluxyEdu (priority 1 — MVP path)

Journey: Create class → live session → knowledge check → breakouts → session report (with human-approved grades).

SDK: createVerticalWorkflow(VERTICAL_DEMO_SEEDS.edu) — attendance, polls, breakouts, grade suggest/approve.

Gates before “production”:

  • Yjs whiteboard adapter + snapshot policy
  • SFU port for multiparty media (no hard-coded vendor)
  • Attendance + poll events persisted on Worker
  • AI grading: rubric + provenance; no auto-publish without educator approve (implemented in workflow)
  • FERPA/COPPA configurable retention/consent/export

Dashboard: /edu — interactive studio drives real SDK events.

FluxyHealth (preview)

Journey: Consent → care room → telehealth session → FHIR context → audit seal.

Compliance boundary: No “HIPAA compliant” marketing until BAA, risk assessment, and vendor chain are complete. Synthetic data only in UI.

FluxyEvent (beta demo)

Journey: Ticket verify → lobby → stage live → moderated Q&A → recap.

Reuse corrected Stream/poll primitives; ticket provider as adapter.

FluxyFinance (preview)

Journey: Market room → provider snapshot → risk alert → invoice approval → audit export.

No PAN storage; no auto-trade; “not financial advice” copy required.

Cross-Reality Continuity (prototype)

Journey: Capability handshake → checkpoint → handoff → viewport resolve → canonical cursor.

Simulator validates protocol without XR headset; WebXR lazy-loaded when available.


Console information architecture

Single console (no duplicate auth shells). Groups in console-nav.ts:

GroupPurpose
BuildOverview, projects, rooms, inbox, agents, billing
Products & toolsChat features, collab, stream, game, IoT, fleet, …
Industries/edu, /health, /events, /finance
Labs/continuity, spatial, transport

Each industry route: overview studio, readiness badges, link to /security and docs.

Follow-ups: command palette entries, breadcrumb labels, overview shortcuts to Industries (see backlog).


Landing & marketing

Narrative: “One room for chat and every realtime product.”

Implemented:

  • Updated hero copy (lib/marketing-landing.ts)
  • Product switcher in hero (landing-hero-client.tsx)
  • #platform section — primitives, product suite, industry solutions with readiness chips (landing-platform-section.tsx)

Follow-ups: Hero mode animation (chat → classroom → event) with prefers-reduced-motion; structured data update; feature comparison rows for verticals.


Compliance & claim policy

VerticalAllowed todayForbidden until gated
Health“Secure care preview”, synthetic data“HIPAA compliant”
FinanceEducational preview, human approval flows“PCI certified”, auto trading
EduBeta demo, FERPA/COPPA configure before prodImplied school certification
EventDemo ticketingProduction anti-scalp without signed adapter

Prioritized backlog

Done (this expansion pass)

  • vertical-platform kernel + tests
  • vertical-workflows + demo seeds + tests
  • Interactive vertical studios wired to SDK + optional Worker sync
  • Worker capability routerPOST/GET /rooms/:id/capabilities/events, D1 persistence, idempotency, policy gates (capability-platform.js)
  • SDK createCapabilityClient + syncWorkflowEventsToWorker
  • Provider adapter ports (vertical-adapters.ts) + demo adapters
  • Yjs collab port contract + snapshot policy (yjs-collab.ts); dashboard uses Yjs via yjs-provider.tsx
  • FluxyIoT rule action execution + credential redaction from public device model
  • Excalidraw whiteboard lazy-loaded; pnpm stub for @excalidraw/mermaid-to-excalidraw (build green; Mermaid paste disabled)
  • Dashboard next build passes (Turbopack)
  • PLATFORM_READINESS wired to landing #platform and console overview badges
  • Console Operate nav group + command palette Industries/Labs/Operate sections
  • Breadcrumbs show nav group (Build / Industries / Operate / …)
  • Landing hero room mode strip (chat → classroom → event → game → devices) with reduced-motion
  • SDK subpath exports: @fluxy-chat/sdk/edu, /health, /event, /finance, /continuity
  • FluxyEdu SFU demo adapter panel + related console links on all vertical studios
  • Console nav groups (Build / Products / Industries / Labs)
  • Landing platform section + hero repositioning
  • SDK tsc clean
  • DB migration 0156_room_capability_events.sql
  • Capability DO fan-out + WS capability_event
  • Customer Memory Graph client (CDP + knowledge graph)
  • Moderation Labels API + rule builder (SDK)
  • Autonomous agent task bus (D1 0157 + REST)
  • Digital Twin MCP tool registry

Next — foundation (remaining for production)

  1. DO fan-out for capability eventsDone: publishCapabilityEventfanoutRoomInternal + WS capability_event in Room DO

Platform expansion layer (July 2026)

LayerSDKWorkerStatus
Capability realtimeonCapabilityEvent, isCapabilityRealtimeEventcapability_event broadcastBeta
Customer Memory GraphcreateCustomerMemoryClient (CDP + KG merge)CDP /api/cdp/*, KG /rooms/:id/kgBeta
Moderation Labels APIcreateModerationLabelsClient, evaluateModerationRulesPOST /moderation/labelsBeta
Long-horizon agent taskscreateWorkerAgentTaskClientPOST/PATCH /agents/tasks + D1 0157Beta
Digital Twin MCPcreateDigitalTwinMcpRegistry— (client twin; Worker persistence TBD)Preview

Vertical production gates

IDItemDepends on
V-EDU-1Persist attendance + polls on WorkerFoundation #1
V-EDU-2SFU adapter + captions hookTURN/SFU vendor config
V-HEALTH-1Consent + audit exportFoundation #1, #2
V-EVENT-1Ticket adapter + Q&A moderation queueFoundation #1
V-FIN-1Market data adapter + stale bannerExternal provider
V-CONT-1Resume token + checkpoint TTL on DOFoundation #1

IA & docs

  • docs/guides/fluxy-edu-quickstart.md
  • Overview page industry cards linking to /edu/continuity
  • ROADMAP §5.3 status table (link here)

Migration strategy

  1. No breaking SDK renames for chat exports; vertical types added alongside.
  2. Alias legacy exports where renamed (LlmProviderAiProvider, etc.).
  3. Route compatibility — existing /collab, /stream URLs unchanged.
  4. Gradual Worker rollout — feature flag per workspace capability.
  5. Deprecate custom CRDT for collaboration docs once Yjs path ships (document in CHANGELOG).

References (2026 best practice)

  • Portal SDK — competitive patterns adopted: portal-sdk-comparison.md
  • Yjs — CRDT docs + snapshot truncation (ADL aligned)
  • SMART on FHIR — clinical context by reference, not payload embedding
  • Cloudflare DO — single-room authority; fan-out for scale (ADL)
  • Device shadow — desired vs reported; vector clock for conflicts (ADL)
  • WCAG 2.2 — captions, keyboard, focus for Edu/Health surfaces

Document maintenance

Update this file when:

  • A vertical moves readiness tier (prototype → beta → production).
  • Worker persistence lands for a capability.
  • Audit finds new P0/P1 issues.

Short link in ROADMAP.md §5.3 only — do not duplicate full content there.

On this page