Skip to content

node renderer for web shenanigans#88

Draft
jackharrhy wants to merge 8 commits into
mainfrom
feature/node-renderer
Draft

node renderer for web shenanigans#88
jackharrhy wants to merge 8 commits into
mainfrom
feature/node-renderer

Conversation

@jackharrhy

@jackharrhy jackharrhy commented Mar 7, 2026

Copy link
Copy Markdown
Member

currently a little less wanted, i don't want:

  • express, rather either hono or elysia
  • i think its booting an entire browser? either https://github.com/Automattic/node-canvas or gl or something else would be nice rather than headless browser time...
  • proper multipart rather than base64 encoded images

Use Puppeteer (headless Chromium) to render p5.js animations server-side.
The gl npm package failed to compile on Node 25, so we use a real browser
context which guarantees correct WebGL rendering for all p5 features.

Key design decisions:
- Serialize animation render functions and eval them in the browser
- Polyfill esbuild's __name helper for browser context compatibility
- Patch transpiled import references (import_utils.X -> global X)
- Inject utility functions (getScaleFactor) as browser globals
- Reuse a singleton browser instance across render requests

Replaces gl dependency with puppeteer. All 5 animations verified:
rotating-sphere, inside-sphere, low-poly-sphere, pyramid, 360-spin.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant