Host-first browser app starter for Pixels dice using Vite, vanilla TypeScript, pnpm, Biome, Vitest, and Playwright.
- Vite + vanilla TypeScript
- pnpm for dependency management
- Biome for format and lint
- Vitest for unit tests
- Playwright for browser smoke tests
@systemic-games/pixels-web-connectfor Web Bluetooth access
- No backend. Browser is runtime environment.
- No framework overhead while learning Pixels APIs.
- Pixels connection logic isolated in
src/pixelsso UI can be swapped later.
- Companion app for Warhammer Fantasy Roleplay 4th edition percentile rolls and attack helper flow.
- Only support official Pixels
d00andd10dice initially. Other devices may work, and considered for official support by demand. - Local storage only. No accounts, backend, or database.
- Designed to stay quick to share on one device rather than model full character management.
- Keep it thin, fast, and framework-light.
- Mobile first, but still usable on tablet and desktop.
- Chromium/Web Bluetooth only for now. Safari/iOS support is out of scope unless platform support changes.
- Prefer simple, responsive interactions over decorative motion.
- Treat reconnect convenience and troubleshooting as more important than trying to hide host Bluetooth quirks.
pnpm install
pnpm devOpen app in Chrome or Edge at the local URL Vite prints. Chrome is primary dev and test target.
For explicit local modes:
pnpm dev:desktop
pnpm dev:usb
pnpm adb:reversepnpm build
pnpm check
pnpm test
pnpm playwright:install
pnpm test:e2eDeploy facts for this app:
pnpm full-validate
git pushCloudflare Pages builds from main and serves production at dice.supermikal.no.
HTTPS comes from Pages, which is required for Web Bluetooth outside localhost.
No backend or Pages Functions are used.
- Use VS Code Run and Debug with
Chrome: Launch Pixels App. - That profile starts Vite on
http://localhost:5173and opens Google Chrome with debugger attached. - Chrome is preferred because persistent Web Bluetooth permission support is the main tested path.
- Edge can still work for basic Web Bluetooth, but it is no longer the primary dev target.
- Enable USB debugging on Android device.
- Connect phone over USB.
- Run
pnpm adb:reverseso phonelocalhost:5173points at laptop port 5173. - Run
pnpm dev:usbto bind Vite on127.0.0.1:5173. - Open
http://localhost:5173in Chrome on phone. - VS Code task shortcut: run
phone-usb.
- Use Chromium-based browser. Chrome is primary target.
- Web Bluetooth requires secure context.
localhostworks for development. - Android over USB can use
adb reverseplushttp://localhost:5173to keep secure-context behavior without LAN HTTPS. - Browser inside terminal tooling is irrelevant here. Real runtime is host browser.
- Reconnect persistence depends on Chrome permissions backend state.
- Windows reconnect timing can be flaky;
repeatConnect()already used for that. - App remembers last connected official dice ids and will try auto-reconnect when persistent permissions are available.
src/main.ts: DOM rendering and UI wiringsrc/pixels/pixels-controller.ts: Pixels device orchestration and app statesrc/pixels/format.ts: UI-facing formatting helperstests/smoke.spec.ts: Playwright smoke test
- better reconnect troubleshooting and reset controls
- animation playground using
@systemic-games/pixels-edit-animation - richer log filtering and telemetry panels