A Svelte 5 / SvelteKit 2 + TypeScript client for the
Apron Chat Protocol,
deployed at https://web.apron.chat. It builds as a static shell with
adapter-static; the browser opens the WebSocket itself as the app starts
(src/hooks.client.ts), so any static host can serve the generated site, including the
Go reference server
(aprond --static-dir).
Use Node.js 24 (see .node-version), or devenv shell, which also provides
Wrangler:
git submodule update --init # or clone with --recurse-submodules
npm ci
npm run dev # Vite serves the UI and proxies /ws, /write/, /files/, /live/ to 127.0.0.1:8080
npm run check # svelte-check
npm test # unit tests: protocol, replay fixtures, app logic and components
npm run e2e # browser tests against an in-memory server (e2e/); e2e:short for the quick tier
npm run build # writes the static site to build/
npm run design:bundle # builds the design system's components to dist-design/
npm run preview
npm run qa -- ab --base main # local visual/perf QA of your changes on /__preview: scripts/qa/README.mdnpm run dev needs a backend on port 8080: the Go reference server from
apron-chat/apron-server-go
(make dev-server), or the
demo Worker from
apron-chat/apron-server-cloudflare
(npx wrangler dev --port 8080).
The server the client opens first is VITE_DEFAULT_SERVER_URL from the build
(the connect screen switches to any other, and remembers it):
npm run devleaves it unset, so it uses same-origin/ws, proxied to port 8080. To start dev against another server, set it in.env.localor on the command line (VITE_DEFAULT_SERVER_URL=ws://127.0.0.1:8787/ npm run dev); a server this browser remembers from an earlier visit comes first, so switch with the connect screen there. Its live text (terminalandappendembeds) then loads from that server's origin, which serves it with CORS.- Builds (
npm run build, production, and Previews) read.env.production:wss://server.apron.chat/, the Cloudflare demo server (apron-chat/apron-server-cloudflare). To build for another server, set it in.env.production.local(.env.localdoesn't override.env.production) or on the command line, e.g.VITE_DEFAULT_SERVER_URL=wss://chat.example/ npm run build. Set it empty for same-origin/ws.
Embed media (upload previews, link card images) loads only from the chat
server's own origin, plus the origins that server names in its server frame
(ext:media, EXT.md §6), such as a storage bucket.
The unit tests replay the implementation-agnostic protocol fixtures in
shazow/apron, checked out as the protocol
submodule and pinned to a commit. Dependabot opens a pull request when it
moves, so CI runs the client against new fixtures before they are adopted; to
update by hand, run git -C protocol fetch origin main, check out the commit
you want, and commit protocol. The browser tests in e2e/ run the app against
an in-memory server; the ones against the Go server are in
apron-chat/apron-server-go's tests/interop.
The favicon and app icons are generated from the logo in that submodule,
protocol/art/apron-logo.svg: run npm run icons after it changes (or
npm run icons -- path/to/logo.svg for another file) and commit the results
in static/ and src/lib/assets/favicon.svg.
Cloudflare Workers Builds
is connected to this repository in the Cloudflare dashboard. A push to main (a
merged pull request) deploys build/ to https://web.apron.chat with
wrangler.toml. Every other branch gets a
Preview at
https://<branch>-apron-web.shazow.workers.dev, and Cloudflare comments its URL
on the pull request. Both build with wss://server.apron.chat/ as the default
server, from .env.production. The build command is:
git submodule update --init && npm run build.github/workflows/ci.yml runs npm run check,
npm test, npm run build, the startup JS budget and npm run design:bundle,
and the perf budget (scripts/qa/README.md), on every pull request and on
main. Branch protection on main requires its test check, so only
tested changes reach the production build. To deploy by hand, with Wrangler on PATH:
npm run build
wrangler deploySigning in on a server's page (external sign-in, and a server's passkey page,
PROTOCOL.md §4.12) sends the viewer back to this app's /signed-in/ on the
origin it is served from. On https://web.apron.chat the app names itself with
static/client-metadata.json (a client ID metadata document listing that one
redirect); keep the two in step if the production origin changes. Other origins
(npm run dev, Previews, a copy another host serves) send the plain client_id
apron-web. Servers accept https redirects and http ones on loopback
addresses only, so a copy served over http from another address can't use a
sign-in page.
The backend deploys separately, from
apron-chat/apron-server-cloudflare.
The apex apron.chat is reserved for docs.
- docs/behavior.md: what the client does, feature by feature, and the protocol capabilities each one needs.
- docs/architecture.md: the design system, the code layout, and how the protocol session keeps and recovers state.
- EXT.md: the extensions apron-web understands beyond the protocol, what a server implements to use each one, and the boundary: nothing server-specific outside them.