Skip to content
Sandeep Kumar
Updated 4 min read

Build a technical SEO crawler that thinks like Googlebot

Lessons from building a Node.js SEO crawler with ~100 checks: robots.txt matching is subtle, soft 404s are everywhere, and why every rule needs a source.

Sandeep Kumar, Full-stack EngineerSandeep KumarFull-stack Engineer
On this page
  1. One engine, two front ends
  2. robots.txt is harder than it looks
  3. The checks nobody writes themselves
  4. Every rule carries its source
  5. Core Web Vitals
  6. Three things I would tell myself at the start

Commercial SEO tools are good at telling you something is wrong. I wanted one that tells the team exactly what Google would see, why it matters and how to fix it, and that runs in CI against staging rather than in a browser tab once a quarter.

So I built one: a Node.js crawl engine with a Next.js dashboard and a CLI on top.

One engine, two front ends

bash
node bin/seo-audit.js https://example.com -p 300 -f html,json,csv

The CLI and the dashboard import the same engine. The dashboard adds tabs for Overview, Issues, Checklist, Pages and crawl setup, and exports HTML, JSON or CSV.

Keeping the engine free of any UI was the decision that paid off most. It made the thing testable, and it let the CLI run in a pipeline without pulling a rendering stack along with it.

robots.txt is harder than it looks

Most home-grown parsers get this wrong, mine included, twice. Google's actual rules:

Pick the most specific user-agent group that matches, and do not merge it with *. Within that group the longest matching path wins, and on a tie Allow beats Disallow. Support * wildcards and the $ end anchor. Only the first 500 KiB of the file is read.

And the one that surprises people: a 5xx on robots.txt means assume everything is disallowed, while a 404 means allow everything. Those are opposite outcomes from two failures that look equally broken from the outside.

js
function isAllowed(rules, path) {
  let best = { len: -1, allow: true };
  for (const r of rules) {
    if (!matches(r.pattern, path)) continue;
    const len = r.pattern.length;
    if (len > best.len || (len === best.len && r.allow)) best = { len, allow: r.allow };
  }
  return best.allow;
}

The checks nobody writes themselves

Soft 404s are the highest-value check in the whole tool and the easiest to add. Request a deliberately absent URL like /this-page-should-not-exist-8f3a. If it returns 200, every not-found page on the site is indexable junk and the site is competing with itself.

Host variants matter nearly as much. http://, https://, www and the bare domain should collapse onto one canonical host with a single 301, not a chain of them.

A canonical tag outside <head> is ignored by Google entirely, and so is a relative one in some setups. That failure is invisible in a browser, which is exactly why it survives so long, and it does a specific kind of damage.

Content that only exists after JavaScript runs gets flagged by comparing the raw HTML against the rendered DOM. So does CSS or JS blocked in robots.txt, which breaks rendering in a way that is genuinely hard to notice by hand.

Page size is worth checking, with the real number. Googlebot reads the first 15 MB of an HTML file and drops the rest before indexing, measured on the uncompressed bytes of that initial request, not counting the images, CSS and JS it fetches separately. I had 2 MB in here originally, which is a reasonable thing to warn about on performance grounds and is not the Googlebot limit. If you are going to cite a threshold as a rule, cite the documented one.

Every rule carries its source

Each of the roughly 100 checks has a severity, a how-to-fix note and a link to Google Search Central, web.dev or the relevant W3C spec. Checks based on convention rather than a documented rule are labelled (Heuristic) and capped at notice level.

That single decision ended more arguments than any feature in the tool. "Is this really a problem?" stops being a matter of opinion when the answer is a link.

Core Web Vitals

Field data comes from the PageSpeed Insights API against the standard thresholds: LCP ≤ 2.5 s, INP ≤ 200 ms, CLS ≤ 0.1. Lab checks then explain why a page fails, covering render-blocking scripts, images without dimensions, images over 200 KB and TTFB over 0.8 s.

The check list is really the machine-readable form of a technical SEO checklist for the App Router. Building the crawler is what turned that list from something you read into something CI can fail on, and a list that can fail a build gets maintained.

Three things I would tell myself at the start

Read the spec rather than blog posts, because a good half of the SEO rules online are not Google rules and some of them, like the 2 MB figure above, propagate for years.

Keep severity honest. A tool that marks everything critical gets ignored within a week, and then the real criticals are invisible too.

And crawl like the bot actually crawls: same user agent, same limits, same robots handling. A crawler that is more permissive than Googlebot reports a site that does not exist.

Frequently asked

Why build your own SEO crawler when commercial tools exist?

Because a tool you own can run in CI against staging and fail a build, rather than being opened in a browser tab once a quarter. It also lets every check carry its own source and severity, so "is this really a problem?" has an answer instead of an opinion. Commercial crawlers are better at breadth; a home-grown one is better at being part of your pipeline.

How does Googlebot handle a robots.txt that returns an error?

The two failure modes have opposite outcomes. A 404 means there are no rules, so everything is allowed. A 5xx means Google assumes the whole site is disallowed. Both look equally broken from the outside, which is why a crawler that treats them the same reports a site that does not exist.

What is a soft 404 and why does it matter so much?

A page that returns HTTP 200 for a URL that should not exist. If every mistyped or deleted URL returns 200, every one of them is indexable, and the site competes with itself at scale. Testing it takes one request to a deliberately absurd path, which is why it is the first check worth writing.

What page size limit does Googlebot actually apply?

Googlebot reads the first 15 MB of an HTML file and drops the rest before indexing, measured on the uncompressed bytes of that initial request and not counting the images, CSS and JavaScript it fetches separately. The 2 MB figure that circulates widely is not a Google limit, though it is a reasonable performance warning in its own right.

Found this useful?Share on XShare on LinkedIn

Related reading