Modular JavaScript toolkit for Go (Baduk/Weiqi): board state, rules engine, variation tree, SGF IO, renderer, and embeddable player.
This package is now v5-first. The legacy v4 API (JGO.Board, JGO.Setup, JGO.Record, etc.) is no longer the primary API surface.
npm install jgoboardGlobal JGO (UMD):
<script src="https://cdn.jsdelivr.net/npm/jgoboard@5/dist/jgoboard.umd.min.js"></script>
<script>
const game = JGO.createGame({ size: 9 });
</script>Module import (ESM):
<script type="module">
import { createGame } from 'https://cdn.jsdelivr.net/npm/jgoboard@5/dist/jgoboard.js';
const game = createGame({ size: 9 });
</script>import { createBoard, STONE, createRenderer } from 'jgoboard';
const board = createBoard({ size: 19 });
board.setStone('D4', STONE.BLACK);
const renderer = createRenderer('#board', {
board,
theme: 'kaya-medium',
});
await renderer.whenReady();
renderer.render();import { createBoard, createGameTree, createCursor } from 'jgoboard';
// or subpaths
import { createGame, rules } from 'jgoboard/core';
import { createRenderer } from 'jgoboard/renderer';
import { kayaMedium } from 'jgoboard/presets';
import { parseSgf, gameTreeFromSgf, sgfFromGameTree } from 'jgoboard/sgf';
import { createPlayer } from 'jgoboard/player';- Renderer API
- Gameplay API
- GameTree + Cursor API
- SGF API
- Player API
- Framework Integration (React, Vue, Svelte)
- Migration: v4 to v5
demoV5Renderer.htmldemoV5Layers.htmldemoV5Game.htmldemoV5Tree.htmldemoV5Player.html
Run demos in dev mode:
npm install
npm run devThen open for example http://localhost:5173/demoV5Player.html.
npm run dev
npm run build
npm run test
npm run lint
npm run formatBuild output includes:
dist/jgoboard.js(ESM)dist/jgoboard.cjs(CJS)dist/jgoboard.umd.min.js(UMD)dist/core.{js,cjs},dist/renderer.{js,cjs},dist/presets.{js,cjs},dist/sgf.{js,cjs},dist/player.{js,cjs}dist/*.d.ts
- Built-in textured themes (
kaya-*,walnut-*) now resolve their image URLs relative to the jGoBoard module/script location. - This works out of the box for direct CDN usage, local repo clone demos, and GitHub release
distusage. - For custom npm/bundler asset layouts, set
assetBaseUrl(globally or per renderer/player instance). bw-*themes do not load image assets.
import { createRenderer, setAssetBaseUrl } from 'jgoboard';
setAssetBaseUrl('/static/vendor/jgoboard/');
// or: createRenderer(target, { board, theme: 'kaya-medium', assetBaseUrl: '/static/vendor/jgoboard/' })Creative Commons Attribution-NonCommercial 4.0 International (CC-BY-NC-4.0).