Bun 1.4 WebView: A Scraping Prototype and Its Deployment Limits

Published · Updated • news

A small HTTP wrapper around browser automation can be useful for extracting a rendered page or taking a screenshot. Simon Willison's Bun 1.4 experiment demonstrates that shape of service, but it does not establish production sizing or a security boundary between clients.

Correction, 22 October 2026: The earlier article treated a reported 192 to 256 MB experiment as a general memory floor and described one tab per request as clean isolation. Both conclusions were too broad. Bun.WebView is experimental even though it shipped in a stable runtime release. No new load test or security assessment was performed for this revision.

The prototype's request model

Willison's 20 August write-up describes a roughly 150-line, zero-dependency TypeScript prototype built with Claude Code and inspired by shot-scraper javascript. It exposes /javascript, /screenshot and /healthz. A request gets its own browser tab; the service returns evaluated results and errors as JSON, or a PNG, JPEG or WebP screenshot.

Willison reported that the Chrome implementation appeared to need a 192 MB to 256 MB container for complex pages, using cgroups to test the constraint. That is his experimental observation, not our measurement. It does not specify a safe memory allocation for an arbitrary page mix or sustained request concurrency.

For capacity planning, measure the intended workload rather than converting that range into a fixed requirement. A useful experiment would hold the container limit constant while increasing concurrent requests and recording successful responses, browser exits, latency and peak memory. Repeat with the heaviest pages the service must handle. We have not performed that experiment.

Runtime release and API stability are separate

The Bun 1.4 release notes describe the Zig-to-Rust rewrite, 1,517 additional Node.js tests and more than 2,900 fixes. They report fivefold lower idle CPU usage, up to 35% lower memory usage and 50% faster Linux startup. Those are Bun's release claims, not benchmarks of this HTTP service.

The release also adds these APIs and commands. The examples of use in the last column are possible applications, not integrations tested here.

API or commandPurposePossible use
Bun.WebViewBrowser controlRender and inspect pages
Bun.ImageImage processingProcess screenshots
Bun.cron()SchedulingTrigger recurring work
Bun.TerminalTerminal APIInteract with terminal processes
Bun.markdownMarkdown processingPrepare extracted content
bun run --parallel, bun test --parallelParallel executionRun scripts or tests
bun audit fix, bun dedupe, bun prunePackage maintenanceMaintain dependencies

What a separate tab does and does not establish

Bun's WebView reference explicitly labels the API experimental. It uses system WebKit on macOS by default and an installed Chrome-family browser on Linux and Windows. The Chrome backend creates tabs in one browser instance per Bun process.

A tab per request is a unit of work, not sufficient evidence of tenant isolation. The earlier claim that this automatically keeps isolation clean is withdrawn. Before exposing a URL-and-JavaScript service to other clients, define which destinations and operations are allowed and how resource limits are enforced. Test that rejected requests remain rejected after redirects and that failed work releases its tab.

For an internal tool serving known pages, this prototype may be a convenient starting point. For an agent workflow using live web content, document the trust boundary and failure behavior explicitly. The number of lines in the wrapper does not determine the operational complexity of the browser it controls.

Frequently asked questions

Is Bun.WebView a stable API because Bun 1.4 is stable?

No. Bun's WebView documentation labels the API experimental and warns that it may change.

Does every deployment need exactly 192 to 256 MB of memory?

No. Willison reported that approximate container range for his Chrome prototype, tested with cgroups. It is not a universal minimum or a guarantee for concurrent workloads.

Does a browser tab per request establish tenant isolation?

No. The Chrome backend uses one browser instance per Bun process. Separate tabs alone do not establish an isolation boundary for untrusted tenants.

Related Reading