Skip to content

gpucanvas Draws Thousands of Live DOM Nodes on a WebGPU Canvas

A new MIT-licensed TypeScript library keeps React and DOM elements real while a GPU draws them on an infinite canvas, with an editor, shader effects and a JSON view written for AI agents.

Draftship Editorial3 min read

A GitHub project called gpucanvas had 326 stars and 22 forks by 2026-11-14, two days after it was created on 2026-11-12. It is TypeScript under the MIT license, and it puts live DOM nodes on an infinite canvas where the GPU draws them, an editor selects and moves them, and an AI agent can read them and point at them. For builders weighing a gpucanvas WebGPU infinite canvas against an ordinary page, the claim worth checking is that the nodes stay real elements.

What the canvas does

Per the project's README on GitHub, React or plain DOM nodes are drawn by WebGPU in a single instanced pass. Pan and zoom never touch the DOM, while clicks, typing and state still reach the real elements, so React state, events, CSS and accessibility work as usual. Where WebGPU and HTML-in-Canvas are available, nodes are snapshotted into a GPU atlas and drawn in one instanced draw call; everywhere else the library falls back to a CSS-transformed container behind the same API. Installation is npm install gpucanvas.

Editor, shaders and snapshots

bindEditor adds selection: a click takes the outermost layer under the pointer, each double-click goes one layer deeper, drag moves with snapping to the edges and centers of neighbors, and handles resize. The default shift-click trigger leaves plain clicks to your components. Effects are WGSL functions run over live components, with built-ins such as glass, frost, shockwave, glitch, vhs, blur, pixelate, plus dissolve, wipe and fade transitions. Animated effects redraw every frame while their node is in view; still ones cost nothing once drawn.

Because the GPU already draws every node, canvas.snapshot returns pixels without a headless browser, about 40 ms for a 1,500 by 1,000 pixel screen according to the README, and diffImages and recordFilmstrip compare versions over time.

The agent view

createAgentView returns a short JSON tree of what is in view, with ids, tags, roles, text and rectangles, plus capture for an image of a single element or any region. A sign-in screen comes to roughly 35 entries and 3.5 KB of JSON that reads in 3 ms. marks draws arrows, comment pins, notes and live cursors that follow the camera, so an agent can point at things rather than only describe them.

Where it runs, and what is missing

The GPU path needs WebGPU and HTML-in-Canvas, both on by default in Chrome 157 and later on a computer. On older Chrome or other Chromium builds you turn on chrome://flags/#canvas-draw-element. Without it the demo runs a DOM fallback with 1,000 screens; phones start at 1,000 screens on the GPU path and 250 as DOM to avoid being killed for memory. Firefox, Safari and every iPhone or iPad browser have no HTML-in-Canvas yet.

The README compares 5,000 live React screens under a CSS transform with the same session in gpucanvas, recorded in Chrome on a MacBook Pro with frame rates measured live, but the text gives no numbers, so the size of the gain cannot be checked from the announcement. The project is at version 0.4 and the API can still change. Snapshots reject on the DOM backend, which renders only effects that define a CSS look, as CSS filters. pickComponents reads React's internal fibers, and production builds usually minify component names.

What it means for building apps with AI

Agent work on a UI depends on giving the model a reliable picture of the screen and a way to refer to parts of it. gpucanvas bets on the DOM for that, a compact tree with stable ids and rectangles, rather than screenshots alone. That only pays off inside a canvas the GPU is already drawing.

Draftship's guide to adding AI to your app covers the other side of that work. Draftship is an AI app builder: you describe an app in plain language and it writes, builds and hosts it, with a built-in database and user sign-in, and paid plans add a choice of model, source code access, custom domains and GitHub push. It is not affiliated with gpucanvas, and nothing here suggests it supports the library.

Primary sources

This article was drafted with AI assistance from the primary sources listed below and checked automatically against them. An editor hasn't reviewed it yet.