Open source  /  Implementation guide

Open-source implementation · measurement reports

Build the SEO reports yourself: rank, links, crawl, AI visibility

What this is. A build-it-yourself path to the same outcome, made from open-source parts you host. It does not publish 5 Kings’ internal method, client data, or any third party’s confidential information — and it says plainly where the open-source path is weaker than a specialist service.

In one paragraph

Five reports get sold to almost every site: where you rank, who links to you, what your crawl misses, whether AI answers mention you, and whether an AI assistant can read your pages. Each one has a credible open-source or open-data path. This guide builds all five and is explicit about the two that cannot be fully replicated.

What you end up with

  • Daily rank snapshots you store yourself, so history survives any vendor pricing change
  • A backlink graph derived from Common Crawl and open link data, with per-link provenance
  • A crawl-vs-index comparison from your own server logs
  • A repeatable AI-visibility probe that records the prompt, the answer and the citation

The reference stack

Every project below is open source and self-hostable. Licences are the ones the project publishes today; check them against your own distribution model before you ship, because a licence can change and an AGPL project has obligations a MIT project does not.

LayerOpen-source projectLicenceWhat it does for you
Rank trackingSerpBearMITSelf-hosted position tracker with a keyword list, daily cron and a SQLite/MySQL store. Bring your own SERP source.
SERP sourceSearXNGAGPL-3.0Self-hosted metasearch; a legal, rate-controlled way to obtain result pages when you have no commercial SERP API.
BacklinksCommon Crawl (CC-MAIN WARC + host graph)Open data (CC terms)The largest openly licensed link graph; extract anchor→target pairs from WARC records at host level.
Backlink processingDuckDB + PythonMITParse, dedupe and join millions of link rows without a database server.
Crawl vs indexGoAccessMITTurns Apache/nginx logs into queryable reports; feed it bot-filtered logs to see real crawl behaviour.
AI visibilitypromptfooMITRuns a fixed prompt set against multiple models, stores every answer, and diffs runs so you can see when a model stops mentioning you.
AI readabilityTrafilaturaApache-2.0Extracts main content the way a reader model does; if the extraction is empty, an AI assistant probably sees nothing either.
Citable surfacellms.txt specificationPublic specA markdown index of your canonical pages, served at /llms.txt, for assistants that look for one.

Build it

1. Decide which of the five reports you can source honestly

Rank and AI visibility need a live answer source. Links need a crawl corpus. Crawl-versus-index needs your own logs. AI readability needs only your HTML. Being clear about the data source per report is what stops a report from becoming an opinion.

2. Stand up the rank tracker with a defined SERP source

SerpBear wants a provider; wire it to SearXNG if you have no commercial API, and accept the trade: metasearch results are not identical to a logged-in consumer session. Record the source alongside every position, because a change of source is a change of measurement.

docker run -d --name serpbear -p 3000:3000 
  -e APIKEY="$SERPBEAR_KEY" -e SESSION_SECRET="$SESSION_SECRET" 
  -v serpbear-data:/app/data towfiqi/serpbear

3. Build the backlink graph from Common Crawl, not from a scraper

Download one monthly crawl’s WAT or WARC segment for your domains, extract outbound links and anchors, and store (source_url, target_url, anchor, crawl_id, fetched_at). Coverage will be narrower than a commercial index; the compensation is that every row has provenance you can open.

4. Diff your logs against your sitemap

Extract bot hits from 30 days of logs, keep the 200s, and compare with the sitemap. The gap is the story: URLs Google requests and you 404, URLs in the sitemap never requested, and directories consuming crawl budget with no traffic.

5. Run the AI-visibility probe on a fixed prompt set

Write 20–50 buyer prompts, run them weekly against each model you care about, and record the full answer, whether your domain was cited, and which URL was cited. Store it all; the value is the time series, not any single answer.

6. Test whether a machine can actually read the page

Run Trafilatura over your top 50 URLs and check the extracted character count against the rendered word count. A large gap means navigation, consent walls or client-side rendering are eating the content before a model can see it.

7. Publish one page that states each number and its source

A report is only honest if the reader can see where each figure came from. Put the source, the collection date and the known bias next to every number — including the numbers that are weaker than a paid tool would produce.

Acceptance checks

If you cannot verify a claim, it is not a finding. These are the checks that close the work; each one can be run by somebody who did not build it.

Acceptance checkHow to verify it
Every stored rank row names its SERP sourceNOT NULL constraint on the source column; the dashboard refuses to plot rows without one.
Backlink rows carry a crawl id and fetch dateSELECT count(*) FROM links WHERE crawl_id IS NULL; must be 0.
Log-derived crawl counts reconcile with the sitemapSitemap URLs minus URLs with at least one 200 bot hit = the never-crawled list; review it monthly.
AI probe prompts are versionedThe prompt file is in git; changing a prompt creates a new series rather than silently changing the old one.
Extracted content is within 15% of rendered contentTrafilatura chars vs rendered word count × 6 for the same URL.
A failed collection is visibleWrite an explicit error row per run; a missing row is indistinguishable from a zero.

Effort and cost

Estimate
Skill neededIntermediate to advanced: Docker, cron, SQL, some Python for the Common Crawl work
Build time1 day for SerpBear, 3–5 days for the backlink ETL, 1 day for logs, 1–2 days for the AI probe
Running costRank daily, links monthly, logs weekly, AI probe weekly; roughly $0–40/month in compute plus LLM call costs
What you must hostA 2–4 GB VM. Common Crawl processing wants 20–50 GB of scratch disk and is best run in batches.

What open source does not give you

The honest half of the comparison. Each of these is a reason somebody buys the service instead of building it, and pretending otherwise would make the rest of this page worthless.

  • No open-source rank tracker recreates a personalised, logged-in, localised Google session. Positions from metasearch will differ from a paid tracker by a few places, and will differ from what a real searcher sees. Say so next to the number.
  • Common Crawl is a crawl, not an index: it under-samples small sites and over-samples popular ones, and its freshness is one to two months. Treat backlink counts as relative, never absolute.
  • AI answers are non-deterministic. The same prompt can cite you on Monday and not on Tuesday. Only a weekly series over 20+ prompts is meaningful.
  • Google Search Console has no comparable open alternative for impression and click data. Without it you can measure positions or logs, but not demand.

Scope only, stated so you can compare it with the build above.

  • A commercial SERP source and a commercial link index when the decision needs absolute numbers rather than relative ones
  • Reconciliation between the five reports, so the same keyword is not reported three ways
  • The judgement call on which 20 prompts matter, which needs the sales and support conversations, not the data

Sources and further reading

What this page does not include. This guide documents an open-source implementation of the same outcome. It deliberately leaves out 5 Kings’ internal playbooks, client data, vendor terms and unpublished method: we publish what any competent team can reproduce, and we do not publish what belongs to a client or to a contract. Where a step depends on a decision only your business can make, the guide says so instead of guessing.

Take it with you

Build the SEO reports yourself: rank, links, crawl, AI visibility

The full guide as an A4 PDF: the reference stack with licences, the build steps, the acceptance checks and the honest limits — in one file you can hand to an engineer or print for a planning session.

PDF · A4 · no email required · free to redistribute with attribution

Open-source Guides & PDFs