I Moved AccessHawk to Cloudflare. Every Scan Gets Its Own Throwaway VM.

AccessHawkCloudflareCloudflare WorkersCloudflare ContainersDurable ObjectsD1ServerlessNuxtPlaywright
By , Senior Full-Stack Engineer6 min read

When I wrote about why I built AccessHawk with Nuxt, it ran the classic way: a Nuxt app, BullMQ on Redis, a pool of Playwright workers, and MongoDB, all as long-lived containers on a server that I patched and watched.

Now AccessHawk runs entirely on Cloudflare. There's no server left, and every scan runs in its own container that's destroyed when the scan ends. The production switch took six minutes of write freeze.

Why I Moved

AccessHawk is a solo project, and the server took time without making the product better: OS updates, Node patches, database backups, and a health check every morning.

The web app could have moved to Workers long ago. The scan engine couldn't. A11yHawk, the engine under AccessHawk, drives a real Chromium and runs Lighthouse, which needs a few gigabytes of memory. A Worker has 128 MB.

Cloudflare Containers closed that gap. A Durable Object (a small stateful Worker instance that Cloudflare finds by name) can start a container on demand, talk to it over HTTP, and stop it when the job ends.

What Replaced What

BeforeAfter
A Node serverWorkers
MongoDBD1
Redis and BullMQQueues and Durable Objects
A pool of Playwright workersOne Container per scan

The scanner is its own Worker, so a change to the web app never rebuilds its 2.5 GB image.

Every Scan Gets a Fresh Machine

A scan job lands on a queue, and the scanner hands it to a Durable Object named after the job. That object starts a container, sends it the job, streams the results into R2, and destroys the container.

The next scan gets a brand-new microVM. Nothing carries over from one customer's page to the next. Under the old worker pool, one long-lived container ran scan after scan.

// Inside the Durable Object that runs one scan
const container = this.ctx.container

try {
  container.start({
    image: container.images.runner,
    instance: 'standard-2', // 1 vCPU, 6 GiB
    enableInternet: true,
  })
  await container.setInactivityTimeout(15 * 60 * 1000)
  await runScan(container, job)
} finally {
  if (container.running) await container.destroy()
}

Chromium's own sandbox stays on inside the container. I tested that in a throwaway container before building on it, and you should test it for your own image too.

On the first day in production, containers started within 0.6 to 5.3 seconds of a job being created. A full scan of a simple page took about 85 seconds.

What Got Better

  • No server to maintain. Nothing to patch or watch.
  • No database to run. D1 has no process to tune. On the Workers Paid plan, D1 Time Travel restores the database to any minute in the last 30 days, so I don't run a backup job.
  • Simpler live progress. Redis pub/sub and Server-Sent Events became one Durable Object per scan batch that holds the browser's WebSockets. It replays missed progress lines when a browser reconnects.
  • Idle compute costs nothing. A container bills only while it runs, and a hibernating Durable Object doesn't bill while it sleeps. The old stack ran around the clock.
  • Concurrency is a config value. I raise or lower how many scans run at once without touching a server.
  • Deploys are pushes. Each Worker deploys when its code changes on main, and wrangler rollback takes it back.

The most work was the database. Around 390 Mongoose calls across 146 files moved to a new data-access layer, and D1's limits (100 bound parameters per query, 2 MB per row) shaped some of it. Queues also do less than BullMQ, so job state and retries now live in my own D1 table.

The Gotchas

These come from the Cloudflare docs as of November 2026, when Containers' durable_object scheduling policy was in public beta. Check the current Containers docs before you rely on them.

  • Pick the durable_object scheduling policy. Cloudflare is moving to a new way of managing containers, and you choose only once, so start on the new one. The default policy is deprecated, but it's what you get when you leave the setting out. The Container helper class only works with default, so you call ctx.container.start() from a plain Durable Object.
  • Name the instance size. The default container is too small to run a browser, so ask for a bigger one. Without instance, you get lite: 1/16 of a vCPU and 256 MiB.
  • Set the inactivity timeout. If you don't tell Cloudflare how long to keep a container alive, it can shut down in the middle of a job. Without setInactivityTimeout(), it stops the container soon after its Durable Object goes idle, and a restarted Durable Object loses the setting.
  • Deploys reset busy Durable Objects. Shipping new code can cut off a job that's still running. By default an active object resets 300 seconds after a deploy, and a secret change counts as a deploy. Set code_update_strategy to wait longer.
  • Cron Triggers and queue consumers run without a route. Scheduled jobs and queue workers go live with the code, before the site sends them any traffic. Make sure they can't act on data you haven't moved yet. I gated mine on a flag that the data import set last.
  • Give every dead-letter queue a consumer. A dead-letter queue is where jobs land after they fail for good. If nothing reads it, its messages disappear after 4 days by default, and nobody hears about the failures.

How the Move Went

I wrote the plan before any code, had reviewers from three model providers read it, and built it with Claude Code as a series of pull requests. Staging ran on Cloudflare overnight before production.

The cutover was a short write freeze: stop the old apps, copy MongoDB into D1, compare every count, and swap the routes. In the first day, every production scan completed and nothing reached a dead-letter queue.

Should You Do This?

If your app is a web front end plus background jobs that need a real machine, such as a headless browser or an image pipeline, Containers make Workers an option for the whole thing. The price is work up front: a database with tighter limits, and retry logic you write yourself.

The payoff is a much smaller bill. My old setup kept a container running around the clock for every part of the app, in production and staging, MongoDB and Redis included. Memory is expensive these days, and on a host that bills by usage, all that always-on memory was most of the bill. Now a scan's container bills only for the seconds it runs, so the cost rises and falls with the number of scans.

For a solo project, that trade was an easy call.

If you want to see the result, run a scan on AccessHawk. The engine inside each container is A11yHawk, and it's open source.

Contact

Questions about a post or a project? Send a message below.

Required fields are marked “(required)”.