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.
| Package | Name | Holds |
|---|---|---|
desk/ | @cardinal/desk | The Vue 3 desk at /desk: list, report and form views, the shell, the setup wizard, desk plugins |
sdk/ | @cardinal/sdk | The API client, boot store, realtime socket, i18n, route helpers, and formats and expressions over WASM |
ui/ | @cardinal/ui | Design tokens in tokens.css and Vue primitives on native elements |
web/ | @cardinal/web | The website bundle for the login, logout, password and invite pages, and the Web Form island |
wasm/ | @cardinal/wasm | The 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 devcardinal start rebuilds the desk and its WASM module whenever their sources changed. The dev server uses base /, so /desk and /login open there too.
| Bundle | Built into | Served at |
|---|---|---|
| Desk | desk/dist/desk/ | /assets/desk/, immutable, with .gz copies |
| Website | web/dist/web/ with a Vite manifest | /assets/web/ |
| App desk plugins | The 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-htmlorinnerHTMLoutside the SafeHtml component- physical left and right styles, such as
margin-leftortext-align: right, which break right-to-left languages - a hand-written
<a>in a desk component, where ui'sLinkor aRouterLinkbelongs
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.