Create & Share

Boards

Create, edit, animate, script, play back, export, and publish interactive Cohub Boards as versioned documents in a Space using the editor and cohub boards CLI.

This page explains how to author, animate, script, play back in sync, export to images or MP4 video, and publish interactive Cohub Boards (.board) as versioned collaborative documents inside a Space, using both the web editor and the cohub boards CLI.

The .board file, data model, and item types

A Board is a single versioned document addressed by its Board ID and stored as three collections:

  • board — Document settings: title, background (color, image, pattern), grid (size, snap), theme overrides, and board-level scripts.
  • items — Keyed map of visual and interactive elements on an infinite canvas.
  • animations — Named timelines containing property tracks, markers, and optional camera tracks.

One board unit equals one CSS pixel at 100% zoom, rotation is in degrees, time is in milliseconds, and child coordinates are relative to their parent frame (or world space when unparented). Run cohub boards schema to inspect the default reading scale (960×540 page frames, 480 media long edge, 56/40/24/16 text sizes) and exact field schemas.

The Space that creates a Board is its home (spaceId): relative file paths and script modules resolve there, and members of that Space can view and edit it. The .board file in /workspace is a lightweight link containing the Board ID—copying the .board file links the same Board elsewhere, deleting the .board file leaves the Board itself intact, and linking it into another Space does not grant access.

Item types

Type Key props and behavior
frame Grouping container or slide page (label, clip, decoration: frame or none, contentDecoration: card or none). A plain (decoration: "none") frame with a label acts as a presentation page.
text Rich text (text, fontSize, fontWeight, font, align, lineHeight, width) plus progressive reveal (reveal, revealBy: char/word/line, revealMotion: cut/fade/rise).
shape Geometric shapes (geometry: rectangle, rounded, ellipse, diamond, triangle, path), optional custom SVG path, and inline text.
draw Freehand strokes as points ({x, y, p} relative to position).
arrow Connectors (start, end as world points or { "item": id, "anchor"?, "port"? }), route, bend, waypoints, arrow heads, and label.
image, video, audio, file Media and file cards pointing to a relative Space path or public HTTP(S) URL (src), optional crop, cached snapshot facts, and playback time/volume for video and audio. .glb/.gltf/.stl 3D models render as interactive cards with props.model.view and Use this view as cover.
task Live card for a Cohub Task run (taskRunId); the server maintains props.snapshot (status, prompt, up to six outputs).
session Live card for a Space Chat (sessionId) with server-maintained props.snapshot.
effect Procedural particle/visual effects (kind: particles, trail, impact, flash, glow) with configurable shapes and colors.
custom Blank host item whose drawing or scene content comes from an attached script.
vendor.kind Namespaced extension type (such as acme.order) registered via defineBoardItem in the SDK; optional preview renders as a card in clients without the extension.

Reading and editing via JSON Merge Patch

cohub boards apply is the only write command. Every write is a JSON Merge Patch transaction: fields you specify merge in, null deletes a key, and omitted fields stay untouched. Each transaction records before/after states so version history can be diffed, replayed, and restored.

Create, inspect schema/examples, and read

# Inspect schemas and built-in starter templates (diagram, slides, custom, rain, arena)
cohub boards schema
cohub boards schema frame
cohub boards examples slides > slides.json

# Create a new Board from a starter document
cohub boards create slides.board --title "Q4 Review" -i slides.json

# Read the full document, specific sections, a frame subtree, or changes since a version
cohub boards get slides.board
cohub boards get slides.board --only board,playback
cohub boards get slides.board --within s2
cohub boards get slides.board --since 12

Apply patches safely, diff, and restore history

# Validate a patch without writing
cohub boards apply slides.board -i patch.json --dry-run

# Apply with optimistic concurrency and an idempotent retry ID
cohub boards apply slides.board -i patch.json --base-version 12 --mutation-id patch-01

# Delete an item along with its child items and animation tracks
cohub boards apply slides.board '{"items":{"old_card":null}}' --cascade

# Compare versions element by element before using --replace
cohub boards diff slides.board --from 10 --to 14

# View version history or restore an earlier version as a new write
cohub boards history slides.board --limit 20
cohub boards history slides.board --restore 12

Layout inspection, frame navigation, simulation, and profiling

# List presentation frames in reading order (rows top to bottom, left to right)
cohub boards frames slides.board

# Measure item bounds and detect layout hints without modifying the Board
cohub boards inspect slides.board --animation lecture --at 0:20s:1s --json

# Simulate scripts locally through input steps (nothing is saved to the Board)
cohub boards simulate game.board -i steps.json --mode play --viewport 390x844 --pointer coarse --camera -o phone.png

# Benchmark headless Chrome render frames and budget (default 1600x900, 5 frames, 3 rounds)
cohub boards profile game.board --size 1600x900 --frames 5 --rounds 3 --budget 60s

Layout hints from inspect are advisory and never block saving. In the web editor, Fill frame scales selected items to cover their parent frame.

Animations, presets, and Board scripts

Tracks, presets, timelines, paths, and chapters

Animation tracks drive any numeric, color, visibility, or camera property by JSON path (for example position.x, opacity, style.filter.blur, or props.time). The CLI provides four patch-generating helpers that print JSON for cohub boards apply -i - without writing directly:

  • preset <name> — Generates tracks for built-in motions (fade-in, fade-out, rise, drop, pop, deal, draw, type, pulse, float, shake, spin, flip, lift, land, toss, sway, wave, curl) with --targets, --animation, --at, --stagger, --duration, and --ease.
  • place — Places items or nested animations onto a timeline as clips (visible plus props.time / time tracks), laid end to end or simultaneously (--together), with --at, --duration, --from, and --rate.
  • path <target> — Samples a JSON polyline (points, duration, optional at, samples, orient) into a smooth position (and optional rotation) track.
  • sequence — Compiles a chapters JSON list (each referencing an animation, optional frame, gap, pause, and label) into a single parent lecture/presentation animation. Recompiling rebuilds the parent animation's tracks from its chapters.
# Stagger a rise preset across three cards
cohub boards preset rise --targets a,b,c --animation intro --stagger 120ms \
  | cohub boards apply slides.board -i -

# Lay media clips end to end on a timeline
cohub boards place cut.board --animation cut --targets intro,talk,outro \
  | cohub boards apply cut.board -i -

# Sample a polyline path and orient the item along it
echo '{"points":[{"x":0,"y":0},{"x":400,"y":120},{"x":800,"y":0}],"duration":2000,"orient":true}' \
  | cohub boards path ship -i -

# Compile chapter animations into a parent timeline
cohub boards sequence lesson.board --animation lecture -i chapters.json \
  | cohub boards apply lesson.board -i -

Board scripts and multiplayer broadcast()

Scripts attach to individual items (script field, including custom items) or across the whole canvas (board.scripts for overlays such as weather, lighting, or HUDs). Scripts are .js/.mjs modules in the Board's home Space and run in the editor, in view/play modes, and during browser-backed exports.

  • Mode gating (script.modes): Restrict where a script loads and draws using edit, play, view, and export. Games and interactive shows typically use ["play", "view", "export"] so they stay quiet while editing; switching modes starts or stops them automatically. Expose tweakable parameters in the toolbar's Interactive settings panel.
  • Custom hotspots (ctx.hitRegions()): Canvas scripts declare clickable/draggable regions ({ target: "self" }, { item: "local-id" }, or local rectangles) across world or screen layers.
  • Viewer-to-viewer events (ctx.broadcast()): Sends a custom event to the same script running on every connected viewer (including the sender, where peer is null; other viewers receive { id, actorId, name, color }). Payloads are JSON up to 1024 characters, rate-limited to about 10 messages per second per viewer, and dropped for hidden tabs or viewers who join later.
  • Read-only guards: In read-only view or published mode, scripts cannot write back to the shared Board (ctx.capabilities.has("board.commit") is false). Keep durable state in item metadata rather than ctx.state if it must survive reloads.

Shared playback

Control synchronized animation playback for everyone currently viewing the Board:

# Start playback for all viewers, holding frame 0 until screens preload (max 5s)
cohub boards play slides.board lecture --at 2.5s --speed 1.5 --preroll

# Pause, resume, seek, advance past a pause marker, or stop
cohub boards pause slides.board
cohub boards resume slides.board
cohub boards seek slides.board 12.5s --preroll
cohub boards next slides.board
cohub boards stop slides.board

# Check connected viewers' preload and audio mute status (listens ~2.5s)
cohub boards viewers slides.board

# Stream document edits and playback events in real time
cohub boards watch slides.board --json

--preroll [max] holds the first frame until every connected screen has preloaded visible assets and the next second of audio, up to the configured cap (default and maximum 5s). --speed supports playback factors up to 4, and --seed pins procedural effects across viewers.

Image and MP4 export

Render a static image, an image sequence, or an MP4/WebM video via cohub boards export (the output extension selects png, jpeg, webp, mp4, or webm, or override with --format):

# Export the whole Board or a single frame as a page (no frame outline/label)
cohub boards export slides.board -o slides.png
cohub boards export slides.board --frame s2 -o slide-2.png

# Export from a fixed camera (center x,y,zoom[,pitch,bearing]) without editing the Board
cohub boards export map.board --view 1300,3400,0.7,35 -o tower.png

# Export a frame sequence or a 24 fps MP4 video inside the Space sandbox (--async)
cohub boards export slides.board --animation lecture --at 0:6s:40ms -o frames/%04d.png
cohub boards export slides.board --animation intro --at 0:20s --fps 24 -o intro.mp4 --async

# Replay recorded script input or simulate steps into a video with HUD screen layers
cohub boards export game.board --inputs takes/level-1.json --camera --screen --at 0:8s --fps 30 -o take.mp4

Key export behavior:

  • Renderer selection (--renderer): auto (default) renders plain Boards in Node and switches automatically to headless Chrome whenever the Board uses scripts, depth-lifted items, 3D models, or tilted/rotated cameras. --renderer canvas forces Node (refuses Boards with scripts); --renderer gpu forces Chrome.
  • Web editor video export: Exporting video from the web editor's Export… dialog runs cohub boards export in the Space at 25 fps, pads odd dimensions by 1 pixel for H.264 compatibility, and saves the MP4 next to the .board file (requires command permission in the Space).
  • Scripted exports: Scripts receive viewchange for the exported area and have no network or device access during export. Add --screen to include script HUD/button screen layers, and --force to overwrite existing files.

Publishing as a Board App

Any .board file in a Space can be published as a versioned Board App with a public or scoped link—see Apps for slugs, visibility, versions, and publishing steps.

What changes once a Board is published as an App:

  • Captured dependencies: Publishing captures Space file dependencies (media, script modules, extension preview sources, and glTF buffers/textures) into the immutable release artifact and lists remote HTTP(S) references in externalUrls. Remote URLs stay live and are not copied into the bundle.
  • Play mode & local copies: A published Board App opens in Play mode. Each visitor gets their own interactive copy—dragging unlocked items moves them, dragging empty space pans, and script hit regions receive presses. Lock any item you do not want visitors to move.
  • Local persistence per version: Visitor changes stay on that visitor's device and are stored per published App version. Publishing a new version starts visitors fresh (and viewers can also click Reset to return to the published state).
  • Deep links: Share a specific view or animation moment using URL fragments (#focus=<itemId>, #view=<x>,<y>,<zoom>, #play=<animationId>&t=<ms>, or #focus=<frame>&present for presentation mode), or click Copy link to this view in the viewer.

Boundaries & common errors

  • Stale --base-version conflict: cohub boards apply --base-version <n> fails if another collaborator or agent wrote to the Board after version <n>. Run cohub boards diff <board> --from <n> to inspect concurrent edits before retrying.
  • --replace requires --base-version on non-empty Boards: Passing apply --replace against a Board that already contains items fails unless --base-version is provided, preventing accidental overwrites of live edits.
  • Deleting referenced items fails without --cascade: Setting an item to null fails and lists references if child items or animation tracks still point to it. Pass --cascade to remove children and tracks together (arrows attached to a deleted item detach cleanly into world coordinates).
  • .board file deletion does not delete the Board: Removing a .board file only removes the Space link; the Board document remains intact by its ID.
  • Export limits and failures:
    • Headless Chrome frames are capped at 16 megapixels (larger --scale values are scaled down with a warning), and each frame times out after --timeout (default 2m), naming any scripts still running.
    • Video export requires ffmpeg and evenly spaced frame times; --camera cannot be combined with fixed-region options (--frame, --items, --rect).
    • --renderer canvas refuses Boards with scripts, and without WebGL, lifted items render flat and 3D models fall back to their cover card.
    • Replacing an existing output path fails unless --force is passed.
  • Remote media CORS & mutability: Remote HTTP(S) images and video thumbnails must allow anonymous CORS for canvas rendering and export, and remote URLs are not captured as immutable assets when publishing.
  • Script & broadcast() limits: Exports have no network or device access. ctx.broadcast() caps messages at 1024 JSON characters and ~10 messages/sec per viewer, and drops events for hidden tabs or viewers who join afterward. Read-only viewers cannot commit edits (ctx.capabilities.has("board.commit") is false).
  • sequence chapter constraints: cohub boards sequence requires distinct manual chapter animations with no nested time tracks and no shared additive targets; recompiling replaces all tracks on the parent animation (keep camera moves inside individual chapters).
  • TASK_FORBIDDEN on task items: Adding a task item for a run the author does not have permission to read fails with TASK_FORBIDDEN.

Next steps

  • Apps — Publish a .board file as a versioned App and manage links, visibility, and releases
  • Files & Sandbox — Store media, scripts, and .board links inside /workspace
  • Saves — Snapshot Space state and read Boards at a checkpoint (--checkpoint)
  • CLI — Full cohub CLI installation, login, and command conventions
  • SDK — Programmatic Board sync, diff, layout inspection, custom item types, and rendering in @neta-art/cohub