cardinal

Frontend packages

The five Bun workspace packages in frontend/ and how they fit together.

frontend/ is a Bun workspace. ui holds every visual decision, sdk is framework-free TypeScript, and desk composes the two. web serves the auth pages without Vue. wasm loads the Rust module.

PackageNameHolds
desk/@cardinal/deskThe Vue 3 desk at /desk: list, report and form views, the shell, the setup wizard, desk plugins
sdk/@cardinal/sdkThe API client, boot store, realtime socket, i18n, route helpers, and formats and expressions over WASM
ui/@cardinal/uiDesign tokens in tokens.css and Vue primitives on native elements
web/@cardinal/webThe website bundle for the login, logout, password and invite pages, and the Web Form island
wasm/@cardinal/wasmThe loader and the built cardinal_wasm.wasm

Build

cd frontend
bun install
bun run build:wasm     # before tests, builds and the dev server, and after a Rust change
bun run typecheck
bun run build
bun run --filter @cardinal/desk dev

cardinal start rebuilds the desk and its WASM module whenever their sources changed. The dev server uses base /, so /desk and /login open there too.

BundleBuilt intoServed at
Deskdesk/dist/desk//assets/desk/, immutable, with .gz copies
Websiteweb/dist/web/ with a Vite manifest/assets/web/
App desk pluginsThe workspace's build/desk/apps/<app>//assets/apps/

How apps plug in

The desk's built index.html carries an import map that names Vue, @cardinal/sdk, @cardinal/ui and the plugin registry. An app's desk bundle imports those names and gets the desk's own copies, so apps never bundle a second Vue. The desk loads an app's bundle only on sites where the app is installed.

@cardinal/desk exports ./plugins (the registry and the FlowCanvas component), ./controls and ./services/* for apps and for the Web Form island. @cardinal/sdk/app holds helpers for an app's own frontend at /<mount>/.

Rules CI enforces

scripts/check-desk-style.sh fails the build on:

  • a colour literal outside ui/src/tokens.css
  • v-html or innerHTML outside the SafeHtml component
  • physical left and right styles, such as margin-left or text-align: right, which break right-to-left languages
  • a hand-written <a> in a desk component, where ui's Link or a RouterLink belongs

The web pages write only text into the page and run under a strict CSP. Every href built from data goes through safeHref(), which allows only safe schemes.

On this page