@excali-boards/boards-api-client
v1.1.36
Published
A simple API client for the Boards API.
Readme
🧰 boards-api-client
A comprehensive TypeScript client library for the Boards Room API, featuring both REST API and WebSocket support. Build real-time collaborative applications with ease.
Features
- Fully typed REST client (boards, users, permissions, files, sessions, categories, flashcards, codesnippets, metrics, invites)
- WebSocket client with auto-reconnect, heartbeat, and message queueing
- React hooks: generic
useWebSocketanduseExecutorfor code execution streams - Zero-config defaults; override
baseUrlwhen needed
Installation
pnpm add @excali-boards/boards-api-client
# or
npm install @excali-boards/boards-api-clientQuick start
REST
import { BoardsManager } from "@excali-boards/boards-api-client";
const api = new BoardsManager("https://api.example.com");
const boards = await api.boards.list();WebSocket (generic)
import { createConnection } from "@excali-boards/boards-api-client";
const ws = createConnection("/executor", { baseUrl: "localhost:3000" });
await ws.connect();
ws.send(1, { code: "print(42)", language: "python" });
ws.on(3, (data) => console.log("output:", data.output));React hook (executor)
import { useExecutor } from "@excali-boards/boards-api-client";
const { isConnected, startSession, sendInput, outputs } = useExecutor();Integrations
- React/Next:
useWebSocket,useExecutor - Node/SSR:
createConnectionwithout React - TypeScript-first: message payloads and REST responses are typed
📜 License
This project is licensed under the GNU General Public License v3.0. See LICENSE for details.
