Monorepo C:\Users\TM\Documents\claude proj\fable pqrs · 12 modules, per-module deep dives plus a whole-system view
ExcelRewind is a spreadsheet decision-intelligence platform: it captures why numbers change in Excel
or Google Sheets — not just what changed — and packages that reasoning into a shareable, replayable
.rewind companion file that never modifies the original spreadsheet. The system has no
application/API server: two Office/Sheets clients (an Office.js task pane and a Google Apps Script sidebar)
record cell-change events and write .rewind files directly via the shared packages/format
contract; two optional native desktop “Companion” helpers (Windows/Mac) give the Excel add-in COM/AppleScript
access Office.js can't reach on its own; five static Cloudflare Pages sites (add-in, viewer, admin, team, website) talk
straight to Supabase Postgres (RLS + SECURITY DEFINER RPCs) and 8 Deno Edge Functions for everything privileged
(billing webhooks, the superadmin console, exam-file signing, domain verification, invite email); and encryption is
zero-knowledge end to end — key material never leaves the browser/pane in usable form. Start with
system.html for the cross-cutting diagrams (full architecture, .rewind
lifecycle, auth/licensing, billing, deployment, trust boundaries), then drill into any module below for its own
diagrams, key-function tables, and documented invariants/gotchas.
npm run step for the docs themselves.cdn.jsdelivr.net as an ES module (import mermaid from '.../mermaid.esm.min.mjs') and initialized with { startOnLoad: true } (or await mermaid.run() if a page's init script is ever changed to call it explicitly). Diagram source lives inline in <pre class="mermaid"> blocks — edit the text, refresh the page, done.flowchart for architecture/dependency/data-flow graphs, sequenceDiagram for runtime process flows, and erDiagram for the DB schema (only in backend-data.html).docs-enhance.js (included via one <script> tag on every page) adds hover tooltips on abbreviations and Ctrl+scroll zoom / drag pan / double-click reset on every rendered diagram, after mermaid finishes rendering. It never touches diagram definitions — display-only.; in sequenceDiagram message/Note text — it's a statement separator, not punctuation. Use commas or dashes instead. in sequence messages — use <br/> for line breaks.\"like this\") — use single quotes instead.erDiagram key tokens are PK, FK comma-separated (e.g. uuid org_id PK, FK) — never PK_FK and never space-separated.(, ), /, :, or . — unquoted, these break the parser.Cross-cutting, all 12 modules
Full-system diagram (union of every interface edge), the .rewind file lifecycle, auth+licensing sequence, billing flow, deployment topology, a trust-boundaries/data-classification table for auditors, and consolidated key facts.
packages/format · packages/branding · scripts/rewind_writer.py
The .rewind contract itself: types, the ZIP-of-deflated-MessagePack container codec, the zero-knowledge AES-256-GCM encryption envelope, and pure spreadsheet-replay/branch/spotlight utilities every app imports.
apps/addin-excel
The Office.js task pane: records cell changes, encrypts and saves .rewind files, replays sessions on disposable in-workbook temp sheets, and talks to Supabase, Stripe, and the desktop Companions.
apps/viewer
Zero-backend, zero-install React SPA that opens and replays a .rewind file entirely client-side; also hosts the Excel add-in's Google/Apple OAuth system-browser handoff page.
apps/admin
Owner-only console for tiers, feature entitlements, users, coupons, pricing, cohorts, the maintenance kill switch, and a guarded destructive data reset — the sole write path via the admin-ops Edge Function.
apps/team
Personal Account screen + org-manager Team console: members, invites, domain verification, cohort seat licensing, exam/kiosk proctoring, and client-side org encryption-key management.
apps/website
Public marketing site; distributes the Windows installer download and reads public tier/promo config from Supabase with the anon key.
apps/addon-sheets
A read-only Apps Script server (no triggers) plus a React sidebar that poll-diffs the active sheet every ~2s to produce the same cross-platform .rewind the Excel add-in writes.
apps/companion-win
Optional native Python tray helper giving the Excel add-in COM access via a loopback-only HTTP API: cross-workbook recording, opening references, and driving Provenance Spotlight.
apps/companion-mac
Wire-compatible Mac counterpart to the Windows Companion, driving Excel for Mac via AppleScript over a self-signed-TLS loopback HTTPS server (required by WKWebView's mixed-content policy).
supabase/schema.sql + migrations
The Postgres schema (RLS + SECURITY DEFINER RPCs) that is ExcelRewind's entire data layer — auth, tiers/feature cascade, orgs/cohorts/exams, zero-knowledge key storage, and the 21-file transactional test suite.
supabase/functions/* · auth.ts
The 8 Deno Edge Functions (admin-ops, billing webhooks, exam-storage, verify-domain, send-invite, metrics, uninstall-feedback) plus the OTP/OAuth-handoff auth story — everything privileged that Postgres alone can't do.
apps/installer · scripts/make-manifest.mts · scripts/smoke.mts
The Windows NSIS installer (add-in sideload + Companion), the Mac .pkg, and the root npm run deploy pipeline that builds and ships every app to Cloudflare Pages and smoke-tests the live origins.