▢ Case study · 2026
SubWatch
An open-source attack-surface monitoring tool that finds a domain’s subdomains, flags takeover and email-security risks, and alerts you when anything changes. It runs entirely on Cloudflare’s free plan.

- Role
- Solo full-stack developer
- Year
- 2026
- Timeline
- Oct 2026
- Built with
- TypeScriptReactViteTailwind CSSZustandTanStack QueryCytoscape.jsCloudflare WorkersHonoCloudflare D1Cloudflare KVZodVitestGitHub Actions
01
The problem
Companies lose track of their own subdomains. Old staging sites, forgotten marketing pages and DNS records pointing at cloud services they no longer use all pile up. Attackers find these first. A dangling DNS record can let someone take over a subdomain and serve content under the company’s name.
Commercial attack-surface tools are expensive, and the free command-line tools give you a one-off list with no history or alerts. I wanted a free tool that discovers, checks and keeps watching, without ever touching the target unless you ask it to.
02
What he built
SubWatch has four stages:
Discover: finds subdomains from 14 passive sources (certificate logs, passive DNS and web archives) and streams each name to the browser live as it’s found
Enrich: adds DNS records, ASN, country and cloud provider. With your consent, it also probes hosts over HTTP, detects technologies and takes screenshots.
Check: detects subdomain takeover risks across 72 services, scores email security (SPF, DMARC, DKIM, MTA-STS), and finds dangling DNS and certificate problems. Each domain gets an A–F risk grade.
Watch: signed-in users get scheduled re-scans, a change timeline, side-by-side scan comparison, and alerts to Slack, Discord, Teams, Telegram, email or HMAC-signed webhooks
Architecture. Everything runs on Cloudflare’s edge, on the free plan:
Frontend: a React SPA on Cloudflare Pages
API: a Hono API on Cloudflare Workers, using Server-Sent Events for live results
Storage: KV for the scan cache and rate limits, and D1 (SQLite) for accounts, history, monitors and alerts
Scheduling: cron triggers for hourly re-scans and weekly digests
The UI includes an interactive attack-surface graph (exportable as PNG or SVG), a hosts-by-country map, and a virtualized table that handles 20,000+ rows. There’s also a command palette and full keyboard navigation.
03
The hard parts
Working inside a 50-request limit. Every source call, DNS lookup and database call on a Cloudflare Worker counts as a subrequest, and the free plan allows only 50 per invocation. A big domain can have thousands of names, so I gave every scan a strict budget, and work that doesn’t fit is reported as “truncated” instead of being silently dropped. A few calls are held back before a scan starts, so saving a signed-in user’s history never fails for lack of budget.
Not lying about results. A failed source or a budget cut could easily look like “this subdomain is gone” or “this record is missing.” So:
A failed source marks the scan as partial, and it’s never cached as an empty success.
A check waits for a complete answer, so a budget cut never produces a false positive.
Wildcard DNS is detected, so names that only match a wildcard are hidden instead of reported as live.
Alerts that stay quiet. A noisy monitor gets ignored. The diff engine counts an asset as removed only after three complete scans in a row miss it. The first scan records no changes, and large batches collapse into one summary. Alerts are deduplicated for seven days and retried with backoff.
Scanning safely. A tool that makes requests on a user’s behalf is an SSRF risk. Active checks resolve the host first and refuse private, loopback, link-local and cloud-metadata addresses. Redirects are followed manually and re-checked at every hop. Other safeguards:
Users’ API keys and alert destinations are encrypted with AES-GCM.
Logins are timing-safe and rate-limited.
Government and military domains, public suffixes and IPs are refused.
Everything returned by scanned hosts is escaped and size-capped before it’s shown.
Resilience. A circuit breaker skips sources that keep failing, so one flaky upstream doesn’t slow every scan.
04
How it turned out
How it turned out
SubWatch is live at subwatch.piyushydv.com (opens in a new tab), and every push to main is tested and deployed automatically.
Runs entirely on Cloudflare’s free plan: no servers, no hosting bill
First results in well under a second in my benchmarks, and cached repeat lookups return in under 100 ms
Found 7,424 names for tumblr.com (opens in a new tab), and correctly hid 2,454 that only matched a wildcard DNS record
72 takeover fingerprints and 14 discovery sources
About 27K lines of TypeScript with 61 test files, plus secret scanning, linting and dead-code checks in CI
This project taught me to design around hard platform limits. Being honest about partial results also turned out to matter as much as finding more names.
Gallery · 5




