Installation
The Board Web SDK ships as the @board.fun/web-sdk package. It is ESM-only and includes TypeScript types.
Requirements
- Node 18 or newer
- A bundler or toolchain that supports ES modules (for example Vite, esbuild, or Rollup)
- A project that produces a static build you can package for the device
Starting fresh? Scaffold a project
The fastest start is a generated project with everything pre-wired — touch rendering, the system pause menu, device-ready asset paths, and the packaging scripts:
npm create @board.fun/game my-game
Prefer a full working reference instead of a blank canvas? Add -- --template showcase to scaffold a sample app that exercises every SDK domain. Either way, continue with Build & Deploy when you are ready for the device.
Add the package to an existing project
npm install @board.fun/web-sdk
Import the Board object wherever you need it:
import { Board } from "@board.fun/web-sdk";
The SDK is ESM-only, so import it as a module. There is no UMD or CommonJS build.
Verify
Drop a short snippet into your app and run it:
import { Board } from "@board.fun/web-sdk";
console.log("On device:", Board.isOnDevice);
console.log("SDK version:", Board.sdkVersion);
In a desktop browser, Board.isOnDevice is false. That is expected. When the same build runs on a Board device, it reports true.
What “on device” means
The SDK runs in two environments: a desktop browser during development, and a real Board device. The Board object always exists, but off device there is no native bridge behind it. Gate any device-specific logic on Board.isOnDevice. When it is false, service calls throw (sync calls like session.*, save.*, pause.*, and application.*) or reject (async calls), because the underlying bridge is not available. The one exception is Board.input.getContacts(), which reads a local cache and returns an empty array off device.
if (Board.isOnDevice) {
Board.input.subscribe(onContacts);
}
Do not gate on the SDK version
Board.sdkVersion is informational only. It is not a way to detect device capabilities, and there is intentionally no bridge or OS version exposed to games. New OS features degrade gracefully through capability checks inside the bridge. When you need a runtime gate, use Board.session.areServicesReady().
Continue to First Game.