Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

ADR 0004: Universal Browser Rendering Pool

FieldValue
StatusAccepted (TTL Recycling: Planned)
Updated2026-02-26

ContextΒΆ

Diagram providers like Mermaid, BPMN, and Excalidraw require a browser environment (DOM, Canvas, SVG engine) to render accurately.

Initially, we planned to use Playwright (Node.js) with a persistent daemon and generic-pool. However, to achieve a Zero-Dependency Core, we migrated to a pure-Rust implementation using headless_chrome.

DecisionΒΆ

We have implemented a Native Browser Rendering Pool directly in Rust.

  1. Backend: Uses the headless_chrome crate to communicate with Chromium via the Chrome DevTools Protocol (CDP).

  2. Pooling Strategy:

    • A persistent Browser instance is launched at startup.

    • Requests are handled via a pool of BrowserContext objects (Incognito-like isolation).

    • TTL Recycling (Planned): Each context will be recycled after a configurable number of requests to prevent cumulative memory bloat. Currently tracked as technical debt (TD-22).

  3. Harnessing: Diagrams are rendered by injecting minimized library bundles into the page context and capturing the resulting HTML/SVG.

ConsequencesΒΆ