Territory Scanner

A Playwright audit fleet that runs on GitHub Actions — because serverless said no.

2026INFRASTRUCTURE + ENGINEERING, SOLOPART OF THE AI SALES MANAGER PLATFORM
PlaywrightGitHub ActionsNode.jsGemini

Territory Scanner is the browser muscle behind AI Sales Manager: the subsystem that visits every discovered business website, screenshots it, audits it, and returns structured findings the pitch generator can quote. It exists as its own case study because getting it to run anywhere was the hard part.

THE WALL

The first version imported the Playwright client inside a Vercel API route. It didn't just fail — it corrupted the route. The function returned an HTML error document where JSON should have been, and every client blew up with the classic `Unexpected token '<', "<!DOCTYPE"...` parse error.

The root cause generalizes: headless browsers don't belong in serverless functions. Bundle size limits, missing system libraries, and cold-start economics all point the same direction — move the browser somewhere that has a real machine.

THE MOVE: CI AS A BROWSER FARM

Scans now run on GitHub Actions. The app fires a repository_dispatch event; a workflow fans out a matrix of jobs; each job boots Playwright on a full Linux runner, works through its slice of sites, and streams results back to the app's API, authenticated with a shared secret.

Screenshots travel as artifacts, findings as JSON. The result is a horizontally scalable, zero-maintenance browser fleet that costs nothing on the free tier — and the Vercel app never imports a browser again.

WHAT EACH SITE GETS

Per site: a full-page screenshot, heuristic checks (mobile viewport, dead links, missing CTAs, performance smells), and a vision-model pass that scores what a customer actually experiences. One URL in, one structured audit out — there's even a single-site entry point that auto-derives everything from just a pasted link.

HIGHLIGHTS