Architecture
How the Board Web SDK is put together, and how your web app talks to the device.
The layers
Your web app runs inside Board’s built-in browser. The @board.fun/web-sdk package is a thin, typed TypeScript layer that sits between your game code and the platform bridge the browser exposes. Calls into the Board object are translated into bridge messages; the device’s services answer them.
Your game (TypeScript)
-> @board.fun/web-sdk (the Board object)
-> platform bridge (in the browser)
-> device services (input, session, save, avatar, pause, application)
The SDK never talks to device services directly. It only speaks to the bridge, and the bridge owns the connection to the OS. This keeps the public surface small, stable, and typed.
The Board object
Everything hangs off a single frozen Board object. It groups the platform into six domains plus two top-level properties:
| Member | What it covers |
|---|---|
Board.input |
Touch and Piece contacts (per-frame snapshots). |
Board.session |
Players, the active profile, the OS player selector. |
Board.save |
Save game CRUD, cover images, storage info. |
Board.avatar |
Player avatar images, cached. |
Board.pause |
The system pause overlay context and results. |
Board.application |
Quit and profile switching. |
Board.isOnDevice |
Whether the app is running on Board hardware. |
Board.sdkVersion |
The SDK version string (informational only). |
See the API Reference for every member.
On device vs in a browser
The same build runs in two places: a desktop browser during development, and a real Board device. The Board object always exists. When Board.isOnDevice is false, the bridge is absent, so device calls throw synchronously (or reject, for the async ones); Board.input.getContacts() is the one exception and returns an empty array. Gate device-specific logic on Board.isOnDevice to keep your game runnable without a device attached.
Two async styles
The SDK uses two complementary async patterns:
- Promises for request and response calls, anything that fetches or mutates state (
Board.save.*,Board.avatar.*,Board.session.presentAddPlayer()). - Callbacks and subscriptions for streams, touch contacts (
Board.input.subscribe) and pause results (Board.pause.onResult).
Capability checks, not version checks
There is intentionally no bridge or OS version exposed to games. The SDK does not let you branch on a “bridge API version”. Instead, new OS capabilities are detected inside the bridge and degrade gracefully when a device is older. The runtime gate you have is Board.session.areServicesReady(). Board.sdkVersion exists for information and logging only.
See also
- Contact Model: the shared touch model across all SDKs.
- API Reference: the complete
Boardsurface. - Build & Deploy: how a packed web app reaches the device.