Technical Documentation

Excalidraw Integration Plan

Excalidraw Integration Plan

Falcon Flowmira integrates Excalidraw only via the public @excalidraw/excalidraw package. No internal source is vendored.

Integration surface

  • src/components/flowmira/excalidraw-board.tsx — client-only wrapper
  • src/routes/_authenticated/board.$id.tsx — Pro-gated route
  • src/routes/_authenticated/whiteboards.tsx — Pro upgrade wall + list
  • src/lib/excalidraw/serialize.ts — scene envelope helpers
  • src/lib/security/svg-sanitizer.ts — library-import sanitization
  • src/lib/security/scene-redaction.ts — secret redaction before save/export

Plan gating

  • Server: public.diagrams_enforce_free_limits trigger + has_role / current_plan_code RPCs.
  • Client: useEntitlements hook + UpgradeWall component.
  • Rafa tools: every whiteboard tool re-checks plan on the server before executing.

Persistence

  • Table: public.diagrams (kind = 'excalidraw').
  • Named checkpoints: snapshot_diagram_version RPC.
  • Trash / restore: existing diagrams is_archived flag + trash_items.
  • Images: private Supabase storage, signed URLs only.

Rafa hand-off

  • Rafa cannot mutate the whiteboard directly; it produces a proposed change set rendered in the Rafa side panel. The user reviews, accepts, or rejects.
  • A checkpoint is snapshotted before any accepted apply.
  • Destructive proposals (delete / replace) require explicit confirmation.

Six-sprint alignment

  • Sprint 1 (repo eval) — this document set.
  • Sprint 2 (proof of concept) — board.$id.tsx, autosave, PNG/SVG.
  • Sprint 3 (Falcon whiteboard) — checkpoints, library import, workshop overlay.
  • Sprint 4 (Rafa) — proposed-change preview UI.
  • Sprint 5 (marketplace) — library import validation; templates.
  • Sprint 6 (launch) — E2E tests in tests/e2e/whiteboards.spec.ts.