Reference
ADR 0009: The web app on TanStack Start and the UI SDK
- Status: Accepted (decided by the maintainer on 2026-11-26; shipped in #259 and #262)
- Date: 2026-11-29
- Supersedes: ADR 0005: shadcn components on Paprika's closed theme
- Amends: ADR 0003: Tailwind CSS for the canvas app UI (Tailwind stays; Preflight is now on, and the canvas world is protected another way)
- Code:
apps/web/(src/styles.css,src/components/ui/,src/components/frontends/,src/data/,src/adapters/,src/editor/,src/overview/,src/i18n/,vite.config.ts), the rules inAGENTS.md(rule 8),server/internal/server/http.go(servesapps/web/dist/client) - Backlog: PAP-A-095 (this ADR)
#Context
ADR 0003 and ADR 0005 describe web-legacy, a Vite + React app with hand-rolled state, Tailwind without Preflight and shadcn primitives copied over Radix. On 2026-11-26 the maintainer asked for a new app instead of another migration: written from the new interface drawn in Paprika (phases 1 to 4 of the "App · nova interface" workspace), with no code ported from the old one, and with one goal that the old app never had: an agent should be able to operate the UI the way a person does (roles, names and keyboard paths that hold up without the mouse). #259 built the new apps/web next to the old one; #262 made the Go server serve it, ported the canvas and the E2E suites to it and removed web-legacy.
Nothing recorded the decisions behind the new app. ADR 0003 still says "no Preflight", which is no longer true, and ADR 0005 describes a component layer that no longer exists.
#Decision
TanStack Start in SPA mode.
apps/webis a TanStack Start app withspa.enabled(vite.config.ts). The build writes static files toapps/web/dist/client, with the shell at_shell.html; the Go server serves that folder by default (webEntriesinhttp.go), so there is still one binary and no Node process at run time. Routes are files undersrc/routes/(/for the overview and/w/$workspaceIdfor the editor), typed by TanStack Router.Data goes through
src/data/only.data/api.tsis the HTTP client anddata/live/is the/wsclient (a client without React, made once byLiveProvider, read withuseLive(selector)and written withuseLiveActions().apply(ops, label), settled by the server'sackorerror; nothing is applied optimistically). The ack can arrive before the delta it announces, so the editor'suseApplyOpsresolves only once the page shows that version (untilShown): code that reads the document after its own write never sees the state from before it. Server state that is not the live document goes through TanStack Query (data/query-client.ts,data/queries/). TanStack DB is installed and allowed only insidedata/, but nothing uses it yet.src/adapters/are pure functions from server shapes to component props.src/test/architecture.tskeeps the network, stores and sockets out of every other layer.State: TanStack Store, per instance. The editor's shared state is a store made per editor (
src/editor/editor-store.ts), and regional state inside a complex component usescreateRegionfromfrontends/_shared. No store, socket or client is created at module scope. The app's keys (undo, history, pins) use TanStack Hotkeys; the keys that act on the selection live ineditor/shortcuts.tsand only fire with the focus on the page, the stage, the layers tree or the stage toolbar.Components: the UI SDK, headless, on Paprika's tokens. Every interactive primitive comes from the UI SDK (
@ui-sdk/coreand@ui-sdk/react, vercel-labs/ui), which handles roles, focus and keyboard behavior. It is used headless: its default theme (@ui-sdk/core/web.css) is not imported, and there is no shadcn or Radix. Styling is Tailwind classes on the brand tokens. Two layers:src/components/ui/: simple components that only render. Data comes in by props and events go out by callbacks; all visible text andaria-labels arrive by props; no i18n, router, Query or store.src/components/frontends/<name>/: complex components (canvas, inspector, layers, overview…) that take external state by props, emit callbacks, may use i18n and a short list of libraries, and never touch the network.
src/components/architecture.test.tsenforces both layers on everypnpm test. The UI SDK skill is vendored in.claude/skills/ui-sdk/, andAGENTS.mdrule 8 says where it yields to the project's rules.Tailwind 4 with Preflight, and a canvas world that does not depend on the chrome. This amends ADR 0003.
src/styles.cssdeclares theui-sdkcascade layer first, imports all of Tailwind (Preflight included) and defines the brand tokens in@theme staticwithlight-dark()pairs, so one set of names covers both themes. The canvas world (data-canvas-worldinfrontends/canvas/canvas.tsx) undoes what the chrome would leak into the user's document: it setsline-height: normalandcolor-scheme: light, and every node paints from the inline styles ofnodeStyle, which set what the document needs instead of relying on the page's defaults. The guarantee that ADR 0003 drew from "no Preflight" now comes from tests:canvas.test.tsxchecks the world's classes,wasm.e2ecompares the DOM and the WASM renderer pixel by pixel, and the server's render parity tests (render_parity_test.go) compare the export withrender_screenshot.i18n with i18next. The UI and the default names follow the language (
enandpt-BR, insrc/i18n/), detected byi18next-browser-languagedetector; keys are typed (i18next.d.ts). The HTTP API stays in English. A complex component usesfrontends.<name>.*keys with complete labels, never a noun interpolated from its owner.
#Consequences
- One component vocabulary with accessible behavior built in. Agents get roles and names to target.
- Preflight in the chrome means the app no longer carries the per-primitive margin and border fixes ADR 0005 needed. In exchange, the canvas world has to keep undoing anything new that the chrome sets on inherited properties; the canvas test and the parity suites are where that is caught.
- The UI SDK is a beta (
0.1.0-beta.17, pinned). A bump moves@ui-sdk/*and the vendored skill together (AGENTS.mdrule 8). - The architecture tests make some shortcuts impossible (a fetch inside a component, a store at module scope). That is the point: the layering is what lets a frontend be tested with props alone.
- ADR 0005 is superseded and stays only as history. ADR 0003 stays for the reasons Tailwind was chosen, with this ADR replacing its "no Preflight" decision.