ennouini.dev
All posts

May 14, 2026

Moving canvas rendering to the server

When I joined the certificate platform project, every document render happened in the browser. A user requesting a transcript waited around 7 seconds while the client fetched data, built the canvas, and rasterized it.

The bottleneck

The canvas work itself was fast. The cost was everything around it: loading fonts, fetching template assets, and blocking the main thread during rasterization.

The fix

We moved the rendering pipeline to the backend and cached the output as static files. The first render pays the cost once. Every request after that serves a file.

  • Render on the server with the same Konva.js scene graph
  • Cache rasterized output keyed by document version
  • Invalidate on template or data change

The result

Load time went from 7 seconds per request to near-instant for cached documents. The browser now just displays an image.