Skip to content

Open source alternative to Semrush and Ahrefs

Add free SEO discovery tools with shared abuse and spend protection (#621)

Ben Senescue331fcb09d26
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 6f100b98..47e92899 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -47,6 +47,9 @@ jobs:
- name: Install website dependencies
run: pnpm --dir web install --frozen-lockfile
+ - name: Test free-tool abuse and spend protection
+ run: pnpm --dir web run test:protection
+
- name: Run website type checks
run: pnpm --dir web run types:check
diff --git a/maintainer-docs/FREE_TOOLS_PROTECTION.md b/maintainer-docs/FREE_TOOLS_PROTECTION.md
new file mode 100644
index 00000000..41113242
--- /dev/null
+++ b/maintainer-docs/FREE_TOOLS_PROTECTION.md
@@ -0,0 +1,87 @@
+# Free tool abuse protection
+
+The website's public API routes protect paid provider calls independently of
+the user interface. Deployed builds require a real Turnstile secret, the rate
+limiter binding, and Cloudflare's client IP header. Missing or failed protection
+returns 503; it does not allow the lookup. Local Vite development may omit the
+Turnstile secret, but still uses the local rate limiter and budget object.
+
+- JSON bodies are limited to 16 KiB, including streamed bodies. Tool schemas
+ constrain domain counts, input lengths, countries and result limits.
+- Cross-origin browser submissions are rejected. Direct clients still need a
+ valid Turnstile token; Origin is not treated as authentication.
+- The shared limiter allows five submissions per IP per minute across all
+ tools, before calling Turnstile. Cloudflare's edge limiter is approximate.
+- Siteverify must confirm success, the request hostname and `free_tool` action.
+ Missing, invalid, expired or replayed tokens cannot reach cache/provider code.
+ Verification has a five-second timeout and fails closed.
+- Verified cache hits can be served without spending budget. Paid results are
+ cached for 24 hours per cache key/Cloudflare location; failures use short TTLs.
+- Before any paid request, a SQLite Durable Object atomically reserves the
+ full run's call count and conservative estimated cost. There is one object per
+ UTC day. Concurrent requests cannot oversubscribe its configured allowance.
+- The budget also enforces 40 upstream calls per visitor/day, per-tool ceilings,
+ and 6,000 upstream calls/day across tools. Failed requests are not refunded.
+ Visitor identifiers are date-scoped IP hashes, not raw addresses; hashes are
+ not anonymous. Old objects delete their stored counters after three days.
+
+## Budget and deployment
+
+`FREE_TOOLS_DAILY_BUDGET_USD` in `web/wrangler.jsonc` is $100 per UTC day for
+production and $10 for preview. Each environment has a separate Durable Object
+namespace and allowance. A zero allowance disables uncached paid lookups.
+Reservation prices live in `web/src/lib/free-tools/spend.ts`: 2.5 cents per
+backlinks call, 1.5 cents per Labs call, including the keyword finder and generator (one call each, up to 20 rows). These
+are conservative ceilings for the current endpoints and result limits, not
+invoice reconciliation. Revisit them whenever provider prices or requests change.
+
+Deploy the full website bundle with its Durable Object migration and bindings.
+`web/src/worker.ts` exports both the TanStack handler and the budget class. Use
+the existing deployment scripts, which reject missing or test site keys, and
+configure the matching `TURNSTILE_SECRET_KEY` for each deployed environment.
+The new action check requires client and server changes to deploy together.
+
+Turnstile and per-IP limits do not eliminate human-assisted abuse or rotating
+proxies. The atomic shared budget limits their paid lookups. A separately
+verified provider-account spending limit remains useful as a billing backstop;
+this change does not configure or verify one. No production changes are made by
+running local tests.
+
+## Limit logs
+
+Worker logging is enabled in `web/wrangler.jsonc`. Search the website Worker's
+logs for `free_tool_limit_reached` to find blocked budget reservations.
+`limit: daily_spend` identifies the shared dollar allowance; the entry includes
+`usedEstimatedUsd`, `requestedEstimatedUsd`, `limitUsd`, tool, and UTC day.
+`daily_calls`, `tool_calls`, and `visitor_calls` identify the separate call caps
+and include the used, requested, and allowed call counts. Entries omit visitor
+identifiers, IPs, domains, and keywords. Limits are logged when a request is
+blocked, not when usage merely approaches the allowance.
+
+These logs do not send automatic notifications. No email, Slack, or spending
+threshold alert is configured by this feature.
+
+## Local website setup
+
+For the website's DataForSEO tools, set `DATAFORSEO_API_KEY` in the ignored
+`web/.dev.vars` file and restart the website dev server. Use the base64 credential
+format in [the API key guide](../docs/DATAFORSEO_API_KEY.md). The website does not
+inherit the root `.env.local`; without its own runtime key, paid tools return
+“Service temporarily unavailable.” Domain Age Checker uses public RDAP data,
+and SERP Simulator runs in the browser without a key. Real provider submissions
+use the configured account's API credits.
+
+## Validation
+
+From the repository root:
+
+```sh
+pnpm --dir web run test:protection
+pnpm --dir web run types:check
+pnpm --dir web run build
+```
+
+The tests use mocked Siteverify responses for rejection paths and real local
+workerd/SQLite storage for concurrency, whole-run limits, rollback and persistence.
+They make no paid provider calls. A deployed verification pass must still confirm
+valid submissions succeed and missing, invalid, expired and reused tokens fail.
diff --git a/web/.env.example b/web/.env.example
index 91373dc8..b6d6d20b 100644
--- a/web/.env.example
+++ b/web/.env.example
@@ -1,8 +1,17 @@
# Build-time vars (vite build inlines these).
+# Required by the deploy scripts: they set VITE_REQUIRE_TURNSTILE=1, and the
+# build rejects missing or test site keys. Deployed APIs also require the
+# matching runtime secret and protection bindings; see maintainer-docs/FREE_TOOLS_PROTECTION.md.
VITE_TURNSTILE_SITE_KEY=
-# Runtime secrets — set with `wrangler secret put <NAME>`, not here:
+# Local runtime secrets go in web/.dev.vars (gitignored), not this file.
+# The website does not inherit the repository root's .env.local. Add
+# DATAFORSEO_API_KEY=<your existing base64 API credential> to web/.dev.vars
+# and restart the website dev server to test real SEO results.
+# Domain Age Checker and SERP Simulator work without this key.
+#
+# Deployed runtime secrets — set with `wrangler secret put <NAME>`, not here:
# DATAFORSEO_API_KEY base64("login:password") for api.dataforseo.com
-# TURNSTILE_SECRET_KEY pairs with VITE_TURNSTILE_SITE_KEY; deploy the build
-# containing the site key before setting this secret
+# TURNSTILE_SECRET_KEY pairs with VITE_TURNSTILE_SITE_KEY; required in deployed
+# environments alongside rate-limit and budget bindings
# LOOPS_API_KEY newsletter subscribe endpoint
diff --git a/web/content/blogs/best-open-source-seo-tools.md b/web/content/blogs/best-open-source-seo-tools.md
index 0ed0653d..fd0fbe7d 100644
--- a/web/content/blogs/best-open-source-seo-tools.md
+++ b/web/content/blogs/best-open-source-seo-tools.md
@@ -67,6 +67,10 @@ These have fewer stars, or fill a narrower niche, than the main tools above. We
One clarification, since it shows up on other lists: seojuice.com is not open source. They publish open source SDKs for their APIs, but the core product is closed.
+## Free tools from OpenSEO
+
+If you only need one answer and do not want to install anything, we run a set of [free SEO tools](/tools) on the site: a [free competitor keyword finder](/competitor-keyword-finder), a [free keyword generator](/keyword-generator), a [free backlink checker](/backlink-checker), a [free website traffic checker](/website-traffic-checker), and a [free SEO competitor analysis tool](/competitor-analysis). No account, no email.
+
## Try OpenSEO, and tell us what we missed
If you want one open source tool that covers most of SEO, start with OpenSEO. Self-host it with Docker or Cloudflare Workers, or use the hosted version at [openseo.so](https://openseo.so) if you would rather not run it yourself.
diff --git a/web/content/blogs/seo-for-startups.md b/web/content/blogs/seo-for-startups.md
index 4b01f986..5e2b90a8 100644
--- a/web/content/blogs/seo-for-startups.md
+++ b/web/content/blogs/seo-for-startups.md
@@ -80,7 +80,7 @@ Backlink analysis shows which websites link to a specific website.
When you look at who links to competitors, you start to see which publications, directories, newsletters, and communities matter in the market. You can also see why certain companies are treated as credible. Sometimes they earn attention through PR. Sometimes it is partnerships, original research, or a useful tool that people keep citing.
-Those links can tell you how attention moves through a market.
+Those links can tell you how attention moves through a market. To look at one domain right now, the [free backlink checker](/backlink-checker) shows its referring domains and strongest links without an account.
![OpenSEO backlink analysis showing referring domains or top backlinks for a competitor](/blog/seo-for-startups/backlink-analysis.png)
@@ -100,6 +100,8 @@ They play a big role in whether someone clicks. A good title matches the search,
It helps you see what queries you show up for, which pages get impressions and clicks, whether Google is indexing your pages, and what crawl or coverage issues need attention.
+Search Console only covers sites you own and lags by a couple of days. To discover keywords another site ranks for, use the [free competitor keyword finder](/competitor-keyword-finder). It shows up to 20 keywords from the provider’s database, with available search volumes, positions, and ranking URLs. Results may be cached for up to 24 hours.
+
If you're new to it, Google's docs are worth reading:
- [Get started with Search Console](https://support.google.com/webmasters/answer/9128669)
diff --git a/web/content/docs/mcp.md b/web/content/docs/mcp.md
index be9ec917..59ae7cb7 100644
--- a/web/content/docs/mcp.md
+++ b/web/content/docs/mcp.md
@@ -17,6 +17,8 @@ For the most current setup UI and a copyable endpoint, open [Agent setup in Open
For setup prompts, plugin commands, and skill updates, see [Agent setup](/docs/agent-setup).
+No account yet? Try the [free SEO tools](/tools).
+
## Claude Code
The [OpenSEO plugin](/docs/claude-code-plugin) is the preferred way to connect Claude Code — one install adds MCP and the public SEO skills together. Use the steps below only if you want MCP on its own.
diff --git a/web/content/docs/skills/index.md b/web/content/docs/skills/index.md
index f1ef4845..92b534f7 100644
--- a/web/content/docs/skills/index.md
+++ b/web/content/docs/skills/index.md
@@ -9,6 +9,8 @@ Run a slash command when you need keyword research, clustering, competitor analy
You stay in charge of strategy. Your agent uses OpenSEO data and the skill instructions to research the answer, then saves the result as a report in your project.
+No account yet? Try the [free SEO tools](/tools).
+
## Set up OpenSEO Agent Skills
On Claude Code, the [OpenSEO plugin](/docs/claude-code-plugin) installs MCP and every skill below in one step. On Codex CLI, the [OpenSEO plugin](/docs/codex-plugin) does the same. Use the manual steps here for other agents, or if you want to pick individual skills.
diff --git a/web/content/marketing/library/backlink-gap-analysis.mdx b/web/content/marketing/library/backlink-gap-analysis.mdx
index d6434bc8..8aa0772e 100644
--- a/web/content/marketing/library/backlink-gap-analysis.mdx
+++ b/web/content/marketing/library/backlink-gap-analysis.mdx
@@ -90,6 +90,8 @@ Do not start with the competitor. Start with step five on your own domain. Then,
If their links-per-domain ratio is high, their advantage is thinner than the headline and their real domain count is within reach. If it is close to one, they have earned links from many distinct sites, which is a genuine moat and probably means competing on content depth rather than on links.
+For a quick read on either side, the [free backlink checker](/backlink-checker) shows a domain's referring domains and strongest links.
+
Either way, the terms you would build pages for come out of [keyword gap analysis](/library/competitive-analysis/keyword-gap-analysis), and whether this domain is even the right one to study comes out of [finding your real competitors](/library/competitive-analysis/find-your-real-competitors). A link profile is the last thing to look at, not the first.
## Competitor backlink analysis FAQ
diff --git a/web/content/marketing/library/competitor-traffic-estimates.mdx b/web/content/marketing/library/competitor-traffic-estimates.mdx
index b389c4fd..efc1c677 100644
--- a/web/content/marketing/library/competitor-traffic-estimates.mdx
+++ b/web/content/marketing/library/competitor-traffic-estimates.mdx
@@ -102,6 +102,8 @@ That final instruction matters. An estimate presented without a confidence state
Take the competitor whose traffic number most intimidates you and run step four only. Split their footprint into your business and everything else. In most markets the number that comes back is between a third and a tenth of the headline, and the gap you were planning around was never the gap.
+If you want the headline number in front of you before you start splitting it, the [free website traffic checker](/website-traffic-checker) returns it for any domain without an account.
+
Then take the terms that survive into [keyword gap analysis](/library/competitive-analysis/keyword-gap-analysis), and check whether the domains you are comparing against are even [the right competitors](/library/competitive-analysis/find-your-real-competitors) before you commit a quarter to catching them.
## Competitor traffic estimate FAQ
diff --git a/web/content/marketing/library/find-your-real-competitors.mdx b/web/content/marketing/library/find-your-real-competitors.mdx
index a4705852..051e69cc 100644
--- a/web/content/marketing/library/find-your-real-competitors.mdx
+++ b/web/content/marketing/library/find-your-real-competitors.mdx
@@ -87,6 +87,8 @@ Pick five terms you would be happy to rank for next quarter, run the comparison,
Companies go into a full competitor analysis. Platforms go into a distribution plan. Pages go into your content backlog, and they are usually the fastest wins on the board.
+To pull one of those domains apart straight away, the [free SEO competitor analysis tool](/competitor-analysis) lists its top keywords and pages in one run.
+
From there, the next step is measuring the distance. Once you know who ranks, [keyword gap analysis](/library/competitive-analysis/keyword-gap-analysis) tells you what they hold that you do not, and [reading their domain overview honestly](/library/competitive-analysis/competitor-traffic-estimates) tells you whether their advantage is as large as it looks.
## Finding SEO competitors FAQ
diff --git a/web/content/marketing/library/keyword-gap-analysis.mdx b/web/content/marketing/library/keyword-gap-analysis.mdx
index 5f33d961..707763ad 100644
--- a/web/content/marketing/library/keyword-gap-analysis.mdx
+++ b/web/content/marketing/library/keyword-gap-analysis.mdx
@@ -89,6 +89,8 @@ That second point is developed further in [reading a competitor's domain overvie
Run the gap on one competitor, with brand excluded on both sides, and stop at the first ten rows. Pick the one row where a competitor's page is visibly weaker than what you could write, and write that page. A gap analysis that produces one shipped page has outperformed the vast majority of gap analyses, which produce a spreadsheet.
+If you have not built the gap list yet, the [free competitor analysis tool](/competitor-analysis) will show you up to twenty keywords a competitor ranks for that you do not.
+
Then run it again in ninety days on the same competitor. The change between the two runs is more informative than either run alone.
## Keyword gap analysis FAQ
diff --git a/web/content/marketing/library/opportunity-sizing-forecasting.mdx b/web/content/marketing/library/opportunity-sizing-forecasting.mdx
index 72c1a7b6..c06e65c5 100644
--- a/web/content/marketing/library/opportunity-sizing-forecasting.mdx
+++ b/web/content/marketing/library/opportunity-sizing-forecasting.mdx
@@ -78,6 +78,8 @@ Ranking by revenue per unit of difficulty is the step that changes the plan. It
Take the cluster you were about to write for and run the three scenarios against it. Then run them against one cluster you dismissed for having low volume. If the low-volume cluster wins on revenue per unit of difficulty, you have found the order your content calendar should have been in.
+Before you forecast a position you do not hold yet, check your current average position in Google Search Console. Use the [free competitor keyword finder](/competitor-keyword-finder) to see which keywords and pages already work for another site.
+
## SEO forecasting FAQ
### How accurate is SEO forecasting?
diff --git a/web/package.json b/web/package.json
index bd59022a..98914985 100644
--- a/web/package.json
+++ b/web/package.json
@@ -13,9 +13,10 @@
"types:check": "fumadocs-mdx && tsc --noEmit",
"format:check": "prettier --check .",
"format:write": "prettier --write .",
- "deploy": "npm run build && wrangler deploy",
- "deploy:prod": "npm run build && wrangler deploy",
- "deploy:preview": "CLOUDFLARE_ENV=preview npm run build && wrangler deploy"
+ "deploy": "VITE_REQUIRE_TURNSTILE=1 npm run build && wrangler deploy",
+ "deploy:prod": "VITE_REQUIRE_TURNSTILE=1 npm run build && wrangler deploy",
+ "deploy:preview": "CLOUDFLARE_ENV=preview VITE_REQUIRE_TURNSTILE=1 npm run build && wrangler deploy",
+ "test:protection": "vitest run && node scripts/check-free-tool-budget.cjs"
},
"dependencies": {
"@tanstack/react-router": "^1.170.16",
@@ -27,10 +28,12 @@
"react": "^19.3.0",
"react-dom": "^19.3.0",
"vite": "^7.3.6",
- "zod": "^4.6.1"
+ "zod": "^4.6.1",
+ "@radix-ui/react-popover": "^1.1.15"
},
"devDependencies": {
"@cloudflare/vite-plugin": "^1.13.3",
+ "@cloudflare/workers-types": "4.20260702.1",
"@tailwindcss/vite": "^4.1.18",
"@types/mdx": "^2.0.13",
"@types/node": "^22.10.2",
@@ -42,6 +45,7 @@
"tailwindcss": "^4.1.18",
"typescript": "^5.9.3",
"vite-tsconfig-paths": "^6.0.5",
+ "vitest": "3.2.6",
"wrangler": "^4.67.0"
}
}
diff --git a/web/pnpm-lock.yaml b/web/pnpm-lock.yaml
index e9f905b7..0e8814b3 100644
--- a/web/pnpm-lock.yaml
+++ b/web/pnpm-lock.yaml
@@ -22,6 +22,9 @@ importers:
.:
dependencies:
+ '@radix-ui/react-popover':
+ specifier: ^1.1.15
'@tanstack/react-router':
specifier: ^1.170.16
@@ -55,7 +58,10 @@ importers:
devDependencies:
'@cloudflare/vite-plugin':
specifier: ^1.13.3
+ '@cloudflare/workers-types':
+ specifier: 4.20260702.1
+ version: 4.20260702.1
'@tailwindcss/vite':
specifier: ^4.1.18
@@ -89,9 +95,12 @@ importers:
vite-tsconfig-paths:
specifier: ^6.0.5
+ vitest:
+ specifier: 3.2.6
wrangler:
specifier: ^4.67.0
- version: 4.71.0(@types/[email protected])
+ version: 4.71.0(@cloudflare/[email protected])(@types/[email protected])
packages:
@@ -248,6 +257,9 @@ packages:
cpu: [x64]
os: [win32]
+ '@cloudflare/[email protected]':
+ resolution: {integrity: sha512-mOhf5TUEB1m2vPrxtqoIGfz0fUC9xyxRDx5gWHy5s+OCo6dcV+g7wI1R7gYCMFohhqF/2y2xeKVwMwCJjfn/WA==}
+
'@cspotcode/[email protected]':
resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==}
engines: {node: '>=12'}
@@ -1626,9 +1638,15 @@ packages:
resolution: {integrity: sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q==}
+ '@types/[email protected]':
+ resolution: {integrity: sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==}
+
resolution: {integrity: sha512-KSVgmQmzMwPlmtljOomayoR89W4FynCAi3E8PPs7vmDVPe84hT+vGPKkJfThkmXs0x0jAaa9U8uW8bbfyS2fWw==}
+ '@types/[email protected]':
+ resolution: {integrity: sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==}
+
resolution: {integrity: sha512-52CcUVNFyfb1A2ALocQw/Dd1BQFNmSdkuC3BkZ6iqhdMfQz7JWOFRuJFloOzjk+6WijU56m9oKXFAXc7o3Towg==}
@@ -1673,6 +1691,38 @@ packages:
peerDependencies:
vite: ^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0
+ '@vitest/[email protected]':
+ resolution: {integrity: sha512-1+7q9BtaKzEmO+fmNT3kYvoNn5Y71XWAx2Q5HRim4tTVRQVRv4uJFAQ5FbK0OPUeNP/WmVCpxYxoJdvuHVjzBQ==}
+
+ '@vitest/[email protected]':
+ resolution: {integrity: sha512-EZOrpDbkKotFAP7wPAQV1UIyoGOk4oX7ynWhBhLB7v+meMHbQhU16oPpIYGTTe4oFlhpryGpgpcZP/sin3hYuw==}
+ peerDependencies:
+ msw: ^2.4.9
+ vite: ^5.0.0 || ^6.0.0 || ^7.0.0-0
+ peerDependenciesMeta:
+ msw:
+ optional: true
+ vite:
+ optional: true
+
+ '@vitest/[email protected]':
+ resolution: {integrity: sha512-lb7XXXzmm2h2ASzFnRvQpDo6onT1NmMJA3tkGTWiBFtRJ9lxGY3d3mm/Apt36gej2bkkOVLL/yTOtufDaFa/jA==}
+
+ '@vitest/[email protected]':
+ resolution: {integrity: sha512-KUHlwqVu0sRlhCdyPdQ/wBoTfRahjUky1MubOmYw9fWfIZy1gNoHpuaaQBPAaMaVYdQYHJLurzj8ECCj5OwTqA==}
+
+ '@vitest/[email protected]':
+ resolution: {integrity: sha512-HYcoSj1w5tcgUnzoF0HcyaAQjpA1gj9ftUJ7iSJSuipc02jW9gKkigwZbjFldAfYHA1fa8UZVRftdMY5msWM9Q==}
+
+ '@vitest/[email protected]':
+ resolution: {integrity: sha512-H+ZjNTWGpObenh0YnlBctAPnJSI20P81PL8BPzWpx54YXLLTm8hEsWawtcYLMrwvpK48hGxLLbCS+1KRXhsKhw==}
+
+ '@vitest/[email protected]':
+ resolution: {integrity: sha512-oq6BbH68WzcWmwtBrU9nqLeaXTR4XwJF7FSLkKEZo4i6eoXcrxjcwSuTvWBIRUTC6VC72nXYunzqgZA+IKdtxg==}
+
+ '@vitest/[email protected]':
+ resolution: {integrity: sha512-lI23nIs4bnT3T8NIoh+vFaz5s2/DdP0Jgt2jxwgWljvwn82cLJtyi/If+fjFyoLMGIOz0U/fKvWE0d4jsNQEfg==}
+
resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==}
peerDependencies:
@@ -1694,6 +1744,10 @@ packages:
resolution: {integrity: sha512-ik3ZgC9dY/lYVVM++OISsaYDeg1tb0VtP5uL3ouh1koGOaUMDPpbFIei4JkFimWUFPn90sbMNMXQAIVOlnYKJA==}
engines: {node: '>=10'}
+ resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==}
+ engines: {node: '>=12'}
+
resolution: {integrity: sha512-LElXdjswlqjWrPpJFg1Fx4wpkOCxj1TDHlSV4PlaRxHGWko024xICaa97ZkMfs6DRKlCguiAI+rbXv5GWwXIkg==}
hasBin: true
@@ -1717,12 +1771,20 @@ packages:
engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7}
hasBin: true
+ resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==}
+ engines: {node: '>=8'}
+
resolution: {integrity: sha512-TITQPUkaz+aVk5GL6NhOdwk1aEaNTSDPsGFWrTuhKGtjTF70jL/Oht2W4c6rXUe5fu7Ie19VIahAXHIIiWWNeg==}
resolution: {integrity: sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==}
+ resolution: {integrity: sha512-4zNhdJD/iOjSH0A05ea+Ke6MU5mmpQcbQsSOkgdaUMJ9zTlDTD/GYlwohmIE2u0gaxHYiVHEn1Fw9mZ/ktJWgw==}
+ engines: {node: '>=18'}
+
resolution: {integrity: sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==}
@@ -1735,6 +1797,10 @@ packages:
resolution: {integrity: sha512-iBZ4F4wRbyORVsu0jPV7gXkOsGYjGHPmAyv+HiHG8gi5PtC9KI2j1+v8/tlibRvjoWX027ypmG/n0HtO5t7unw==}
+ resolution: {integrity: sha512-PAJdDJusoxnwm1VwW07VWwUN1sl7smmC3OKggvndJFadxxDRyFJBX/ggnu/KE4kQAB7a3Dp8f/YXC1FlUprWmA==}
+ engines: {node: '>= 16'}
+
resolution: {integrity: sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==}
engines: {node: '>= 14.16.0'}
@@ -1789,6 +1855,10 @@ packages:
resolution: {integrity: sha512-GtpQYB283KrPp6nRw50q3U9/VfOutZOe103qlN7BPP6Ad27xYnOIWv4lPzo8HCAL+mMZofJ9KEy30fq6MfaK6Q==}
+ resolution: {integrity: sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==}
+ engines: {node: '>=6'}
+
resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==}
engines: {node: '>=6'}
@@ -1821,6 +1891,9 @@ packages:
resolution: {integrity: sha512-5qucVt2XcuGMcEGgWI7i+yZpmpByQ8J1lHhcL7PwqCwu9FPP3VUXzT4ltHe5i2z9dePwEHcDVOAfSnHsOlCXRA==}
+ resolution: {integrity: sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==}
+
resolution: {integrity: sha512-4CyanoAudUSBAn5K13H4JhsMH6L9ZP7XbLVe/dKybkxMO7eDyLsT8UHl9TRNrU2Gr9nz+FovfSIjuXWJ81uVwQ==}
@@ -1869,6 +1942,10 @@ packages:
resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==}
+ resolution: {integrity: sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA==}
+ engines: {node: '>=12.0.0'}
+
resolution: {integrity: sha512-9U/jZUgjnSGyntRr6y5Muu1MJcwFl6kPu7k8qLF0IMNfLqvw0NZ4nnVDq0RVoZ0RvCyumib4Ez3KYrVfilrw+g==}
@@ -2100,6 +2177,9 @@ packages:
resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==}
+ resolution: {integrity: sha512-mxa9E9ITFOt0ban3j6L5MpjwegGz6lBQmM1IJkWeBZGcMxto50+eWdjC/52xDbS2vy0k7vIMK0Fe2wfL9OQSpQ==}
+
resolution: {integrity: sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA==}
hasBin: true
@@ -2269,6 +2349,9 @@ packages:
resolution: {integrity: sha512-9Ri+o0JYgehTaVBBDoMqIl8GXtbWg711O3srftcHhZ0dqnETqLaoIK0x17fUw9rFSlK/0NlsKe0Ahhyl5pXE2g==}
+ resolution: {integrity: sha512-CdzqowRJCeLU72bHvWqwRBBlLcMEtIvGrlvef74kMnV2AolS9Y8xUv1I0U/MNAWMhBlKIoyuEgoJ0t/bbwHbLQ==}
+
resolution: {integrity: sha512-4pfM1Ff0x50o0tQwb5ucw/RzNyD0/YJME6IVcStalZuMWxdt3sR3huStTtxz4PUmvZfRguvDejasvQ2kifR11g==}
engines: {node: 20 || >=22}
@@ -2506,6 +2589,10 @@ packages:
resolution: {integrity: sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==}
+ resolution: {integrity: sha512-//nshmD55c46FuFw26xV/xFAaB5HF9Xdap7HJBBnrKdAd6/GxDBaNA1870O79+9ueg61cZLSVc+OaFlfmObYVQ==}
+ engines: {node: '>= 14.16'}
+
resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==}
@@ -2672,6 +2759,9 @@ packages:
resolution: {integrity: sha512-Mb/GvXPHBAXdgGIcnfU5L3ldpn1XcxrGkPHwqgRx17/I2XRfqlFKk2vGkHWINn1kdXvzJZeuO3is6I9KLPFm0g==}
engines: {node: '>=20'}
+ resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==}
+
resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==}
engines: {node: '>=0.10.0'}
@@ -2688,9 +2778,18 @@ packages:
engines: {node: '>=20.16.0'}
hasBin: true
+ resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==}
+
+ resolution: {integrity: sha512-5GS12FdOZNliM5mAOxFRg7Ir0pWz8MdpYm6AY6VPkGpbA7ZzmbzNcBJQ0GPvvyWgcY7QAhCgf9Uy89I03faLkg==}
+
resolution: {integrity: sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg==}
+ resolution: {integrity: sha512-8r3mkIM/2+PpjHoOtiAW8Rg3jJLHaV7xPwG+YRGrv6FP0wwk/toTpATxWYOW0BKdWwl82VT2tFYi5DlROa0Mxg==}
+
resolution: {integrity: sha512-RjQetxJrrUJLQPHbLku6U/ocGtzyjbJMP9lCNK7Ag0CNh690nSH8woqWH9u16nMjYBAok+i7JO1NP2pOy8IsPQ==}
@@ -2708,6 +2807,12 @@ packages:
resolution: {integrity: sha512-g9ljZiwki/LfxmQADO3dEY1CbpmXT5Hm2fJ+QaGKwSXUylMybePR7/67YW7jOrrvjEgL1Fmz5kzyAjWVWLlucg==}
engines: {node: '>=6'}
+ resolution: {integrity: sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==}
+
+ resolution: {integrity: sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==}
+
resolution: {integrity: sha512-GCvB3aoys96IuDFBMcTB46JOR6mdMtAToqwiW8JlWhsoh1mhHi/xn9ss/Dg7N555GiJyEt2qzoG/NHCwM6h1EA==}
engines: {node: '>=18'}
@@ -2716,6 +2821,18 @@ packages:
resolution: {integrity: sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==}
engines: {node: '>=12.0.0'}
+ resolution: {integrity: sha512-Zba82s87IFq9A9XmjiX5uZA/ARWDrB03OHlq+Vw1fSdt0I+4/Kutwy8BP4Y/y/aORMo61FQ0vIb5j44vSo5Pkg==}
+ engines: {node: ^18.0.0 || >=20.0.0}
+
+ resolution: {integrity: sha512-op4nsTR47R6p0vMUUoYl/a+ljLFVtlfaXkLQmqfLR1qHma1h/ysYk4hEXZ880bf2CYgTskvTa/e196Vd5dDQXw==}
+ engines: {node: '>=14.0.0'}
+
+ resolution: {integrity: sha512-u8KszXvGfU68hVcZpRHKG28T0krMuv2G5nDhiHaMLen/gIuFEgIJhaJuO69qjnXg5paSrbPMFfx3brNuN8eVSg==}
+ engines: {node: '>=14.0.0'}
+
resolution: {integrity: sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==}
@@ -2855,6 +2972,11 @@ packages:
resolution: {integrity: sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==}
+ resolution: {integrity: sha512-EbKSKh+bh1E1IFxeO0pg1n4dvoOTt0UDiXMd/qn++r98+jPO1xtJilvXldeuQ8giIB5IkpjCgMleHMNEsGH6pg==}
+ engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0}
+ hasBin: true
+
resolution: {integrity: sha512-2cihq7zliibCCZ8P9cKJrQBkfgdvcFkOOc3Y02o3GWUDLgqjWsZudaoiuOwO/gzTzy17cS5F7ZPo4bsnS4DGkg==}
peerDependencies:
@@ -2908,12 +3030,45 @@ packages:
vite:
optional: true
+ resolution: {integrity: sha512-xejya+bT/j/+R/AGa1XOfRxLmNUlLtlwjRsFUILF+xHfzElmGcmFydy2gqqIrd62ptIEfwVMofd19uNWD9L7Nw==}
+ engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0}
+ hasBin: true
+ peerDependencies:
+ '@edge-runtime/vm': '*'
+ '@types/debug': ^4.1.12
+ '@types/node': ^18.0.0 || ^20.0.0 || >=22.0.0
+ '@vitest/browser': 3.2.6
+ '@vitest/ui': 3.2.6
+ happy-dom: '*'
+ jsdom: '*'
+ peerDependenciesMeta:
+ '@edge-runtime/vm':
+ optional: true
+ '@types/debug':
+ optional: true
+ '@types/node':
+ optional: true
+ '@vitest/browser':
+ optional: true
+ '@vitest/ui':
+ optional: true
+ happy-dom:
+ optional: true
+ jsdom:
+ optional: true
+
resolution: {integrity: sha512-bKr1DkiNa2krS7qxNtdrtHAmzuYGFQLiQ13TsorsdT6ULTkPLKuu5+GsFpDlg6JFjUTwX2DyhMPG2be8uPrqsQ==}
resolution: {integrity: sha512-66/V2i5hQanC51vBQKPH4aI8NMAcBW59FVBs+rC7eGHupMyfn34q7rZIE+ETlJ+XTevqfUhVVBgSUNSW2flEUQ==}
+ resolution: {integrity: sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==}
+ engines: {node: '>=8'}
+ hasBin: true
+
resolution: {integrity: sha512-oterQ1IFd3h7PjCfT4znSFOkJCvNQ6YMOyZ40YsnO3nrSpgB4TbJVYWFOnyJAw71/RQuupfVqZZWKvsy8GO3fw==}
engines: {node: '>=16'}
@@ -3110,13 +3265,13 @@ snapshots:
optionalDependencies:
workerd: 1.20260301.1
dependencies:
'@cloudflare/unenv-preset': 2.15.0([email protected])([email protected])
miniflare: 4.20260301.1(@types/[email protected])
unenv: 2.0.0-rc.24
- wrangler: 4.71.0(@types/[email protected])
+ wrangler: 4.71.0(@cloudflare/[email protected])(@types/[email protected])
ws: 8.21.3
transitivePeerDependencies:
- '@types/node'
@@ -3139,6 +3294,8 @@ snapshots:
'@cloudflare/[email protected]':
optional: true
+ '@cloudflare/[email protected]': {}
+
'@cspotcode/[email protected]':
dependencies:
'@jridgewell/trace-mapping': 0.3.9
@@ -4333,10 +4490,17 @@ snapshots:
dependencies:
'@babel/types': 7.29.0
+ '@types/[email protected]':
+ dependencies:
+ '@types/deep-eql': 4.0.2
+ assertion-error: 2.0.1
+
dependencies:
'@types/ms': 2.1.0
+ '@types/[email protected]': {}
+
dependencies:
'@types/estree': 1.0.9
@@ -4385,6 +4549,52 @@ snapshots:
transitivePeerDependencies:
- supports-color
+ '@vitest/[email protected]':
+ dependencies:
+ '@types/chai': 5.2.3
+ '@vitest/spy': 3.2.6
+ '@vitest/utils': 3.2.6
+ chai: 5.3.3
+ tinyrainbow: 2.0.0
+
+ dependencies:
+ '@vitest/spy': 3.2.6
+ estree-walker: 3.0.3
+ magic-string: 0.30.21
+ optionalDependencies:
+
+ '@vitest/[email protected]':
+ dependencies:
+ tinyrainbow: 2.0.0
+
+ '@vitest/[email protected]':
+ dependencies:
+ tinyrainbow: 2.0.0
+
+ '@vitest/[email protected]':
+ dependencies:
+ '@vitest/utils': 3.2.6
+ pathe: 2.0.3
+ strip-literal: 3.1.0
+
+ '@vitest/[email protected]':
+ dependencies:
+ '@vitest/pretty-format': 3.2.6
+ magic-string: 0.30.21
+ pathe: 2.0.3
+
+ '@vitest/[email protected]':
+ dependencies:
+ tinyspy: 4.0.6
+
+ '@vitest/[email protected]':
+ dependencies:
+ '@vitest/pretty-format': 3.2.6
+ loupe: 3.2.1
+ tinyrainbow: 2.0.0
+
dependencies:
acorn: 8.18.0
@@ -4399,6 +4609,8 @@ snapshots:
dependencies:
tslib: 2.8.1
+
@@ -4424,10 +4636,20 @@ snapshots:
node-releases: 2.0.55
update-browserslist-db: 1.3.2([email protected])
+
+ dependencies:
+ assertion-error: 2.0.1
+ check-error: 2.1.3
+ deep-eql: 5.0.2
+ loupe: 3.2.1
+ pathval: 2.0.1
+
@@ -4436,6 +4658,8 @@ snapshots:
+
dependencies:
readdirp: 4.1.2
@@ -4474,6 +4698,8 @@ snapshots:
dependencies:
character-entities: 2.0.2
+
@@ -4497,6 +4723,8 @@ snapshots:
+
dependencies:
'@types/estree-jsx': 1.0.5
@@ -4610,6 +4838,8 @@ snapshots:
dependencies:
'@types/estree': 1.0.9
+
@@ -4884,6 +5114,8 @@ snapshots:
+
dependencies:
argparse: 2.0.1
@@ -4994,6 +5226,8 @@ snapshots:
+
@@ -5505,6 +5739,8 @@ snapshots:
+
@@ -5759,6 +5995,8 @@ snapshots:
'@shikijs/vscode-textmate': 10.0.2
'@types/hast': 3.0.5
+
@@ -5767,11 +6005,19 @@ snapshots:
+
+
dependencies:
character-entities-html4: 2.1.0
character-entities-legacy: 3.0.0
+ dependencies:
+ js-tokens: 9.0.1
+
dependencies:
style-to-object: 1.0.14
@@ -5786,6 +6032,10 @@ snapshots:
+
+
@@ -5793,6 +6043,12 @@ snapshots:
fdir: 6.5.0([email protected])
picomatch: 4.0.7
+
+
+
@@ -5915,6 +6171,27 @@ snapshots:
'@types/unist': 3.0.3
vfile-message: 4.0.3
+ dependencies:
+ cac: 6.7.14
+ debug: 4.4.3
+ es-module-lexer: 1.7.0
+ pathe: 2.0.3
+ transitivePeerDependencies:
+ - '@types/node'
+ - jiti
+ - less
+ - lightningcss
+ - sass
+ - sass-embedded
+ - stylus
+ - sugarss
+ - supports-color
+ - terser
+ - tsx
+ - yaml
+
dependencies:
debug: 4.4.3
@@ -5945,10 +6222,57 @@ snapshots:
optionalDependencies:
+ dependencies:
+ '@types/chai': 5.2.3
+ '@vitest/expect': 3.2.6
+ '@vitest/pretty-format': 3.2.7
+ '@vitest/runner': 3.2.6
+ '@vitest/snapshot': 3.2.6
+ '@vitest/spy': 3.2.6
+ '@vitest/utils': 3.2.6
+ chai: 5.3.3
+ debug: 4.4.3
+ expect-type: 1.4.0
+ magic-string: 0.30.21
+ pathe: 2.0.3
+ picomatch: 4.0.7
+ std-env: 3.10.0
+ tinybench: 2.9.0
+ tinyexec: 0.3.2
+ tinyglobby: 0.2.17
+ tinypool: 1.1.1
+ tinyrainbow: 2.0.0
+ why-is-node-running: 2.3.0
+ optionalDependencies:
+ '@types/debug': 4.1.13
+ '@types/node': 22.19.15
+ transitivePeerDependencies:
+ - jiti
+ - less
+ - lightningcss
+ - msw
+ - sass
+ - sass-embedded
+ - stylus
+ - sugarss
+ - supports-color
+ - terser
+ - tsx
+ - yaml
+
+ dependencies:
+ siginfo: 2.0.0
+ stackback: 0.0.2
+
optionalDependencies:
'@cloudflare/workerd-darwin-64': 1.20260301.1
@@ -5957,7 +6281,7 @@ snapshots:
'@cloudflare/workerd-linux-arm64': 1.20260301.1
'@cloudflare/workerd-windows-64': 1.20260301.1
dependencies:
'@cloudflare/kv-asset-handler': 0.4.2
'@cloudflare/unenv-preset': 2.15.0([email protected])([email protected])
@@ -5968,6 +6292,7 @@ snapshots:
unenv: 2.0.0-rc.24
workerd: 1.20260301.1
optionalDependencies:
+ '@cloudflare/workers-types': 4.20260702.1
fsevents: 2.3.3
transitivePeerDependencies:
- '@types/node'
diff --git a/web/scripts/check-free-tool-budget.cjs b/web/scripts/check-free-tool-budget.cjs
new file mode 100644
index 00000000..98d88c0d
--- /dev/null
+++ b/web/scripts/check-free-tool-budget.cjs
@@ -0,0 +1,82 @@
+// Exercises the real Durable Object in workerd without any provider requests.
+const { createRequire } = require("node:module");
+const path = require("node:path");
+const fs = require("node:fs/promises");
+const os = require("node:os");
+const assert = require("node:assert/strict");
+const wranglerRequire = createRequire(require.resolve("wrangler/package.json"));
+const { Miniflare } = wranglerRequire("miniflare");
+const { build } = wranglerRequire("esbuild");
+
+(async () => {
+ const root = path.resolve(__dirname, "..");
+ const built = await build({
+ stdin: {
+ contents: `export { FreeToolBudget } from './src/lib/free-tools/budget';
+ export default { async fetch(request, env) {
+ const { group, ...input } = await request.json();
+ return Response.json(await env.FREE_TOOL_BUDGET.getByName(group).reserve(input));
+ }};`,
+ resolveDir: root,
+ sourcefile: "budget-harness.ts",
+ loader: "ts",
+ },
+ bundle: true,
+ write: false,
+ format: "esm",
+ platform: "browser",
+ external: ["cloudflare:workers"],
+ });
+ const persist = await fs.mkdtemp(path.join(os.tmpdir(), "openseo-budget-"));
+ const options = {
+ modules: true,
+ script: built.outputFiles[0].text,
+ compatibilityDate: "2026-02-19",
+ bindings: { FREE_TOOLS_DAILY_BUDGET_USD: "1.00" },
+ durableObjects: {
+ FREE_TOOL_BUDGET: { className: "FreeToolBudget", useSQLite: true },
+ },
+ durableObjectsPersist: persist,
+ };
+ let mf = new Miniflare(options);
+ const day = new Date().toISOString().slice(0, 10);
+ async function reserve(group, visitor, calls = 2, tool = "backlink-checker") {
+ const result = await mf.dispatchFetch("https://budget.test/", {
+ method: "POST",
+ body: JSON.stringify({
+ group,
+ visitor: visitor.toString(16).padStart(64, "0"),
+ calls,
+ tool,
+ day,
+ }),
+ });
+ assert.equal(result.status, 200);
+ return result.json();
+ }
+ try {
+ const burst = await Promise.all(
+ Array.from({ length: 50 }, (_, i) => reserve("burst", i)),
+ );
+ assert.equal(burst.filter((x) => x === "allowed").length, 20);
+ assert.equal(burst.filter((x) => x === "daily").length, 30);
+ for (let i = 0; i < 6; i++)
+ assert.equal(await reserve("ip", 1, 6, "keyword-generator"), "allowed");
+ assert.equal(await reserve("ip", 1, 6, "keyword-generator"), "visitor");
+ assert.equal(await reserve("ip", 1, 4, "keyword-generator"), "allowed");
+ assert.equal(await reserve("ip", 1, 1, "keyword-generator"), "visitor");
+ assert.equal(await reserve("ip", 2, 1, "keyword-generator"), "allowed");
+ await mf.dispose();
+ mf = new Miniflare(options);
+ assert.equal(await reserve("burst", 999), "daily");
+ console.log(
+ "PASS: 50 concurrent reservations cannot exceed budget; whole-run IP limit, rejected-reservation rollback, and persisted limits after restart.",
+ );
+ } finally {
+ await mf.dispose();
+ await fs.rm(persist, { recursive: true, force: true });
+ }
+})().catch((error) => {
+ console.error(error);
+ process.exitCode = 1;
+});
diff --git a/web/scripts/generate-sitemap.js b/web/scripts/generate-sitemap.js
index ba38fe0b..ada10584 100644
--- a/web/scripts/generate-sitemap.js
+++ b/web/scripts/generate-sitemap.js
@@ -4,6 +4,7 @@ import { existsSync, readdirSync, statSync, writeFileSync } from "node:fs";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
import { FEATURE_PAGE_SLUGS } from "../src/lib/feature-page-slugs.js";
+import { FREE_TOOL_PATHS } from "../src/lib/free-tools/free-tool-paths.js";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
@@ -25,7 +26,7 @@ const STATIC_PATHS = [
"/docs",
"/features",
"/features/mcp",
- "/backlink-checker",
+ "/tools",
"/open-source-seo",
"/about",
"/why-openseo",
@@ -33,6 +34,7 @@ const STATIC_PATHS = [
"/roadmap",
"/support",
...Object.values(FEATURE_PAGE_SLUGS).map((slug) => `/features/${slug}`),
+ ...Object.values(FREE_TOOL_PATHS),
];
function getContentEntries(
diff --git a/web/src/components/backlink-checker-tool.tsx b/web/src/components/backlink-checker-tool.tsx
index 21e0ec3b..c3d7be3e 100644
--- a/web/src/components/backlink-checker-tool.tsx
+++ b/web/src/components/backlink-checker-tool.tsx
@@ -1,23 +1,11 @@
-import { type FormEvent, useEffect, useRef, useState } from "react";
+import { ToolTable } from "@/lib/free-tools/tool-table";
+import { type FormEvent, useEffect, useState } from "react";
+import { FIELD_CLASS, SubmitButton, ToolForm } from "@/lib/free-tools/form";
+import { formatCount, InfoTip, MetricGrid } from "@/lib/free-tools/metric-grid";
+import { UpsellCard } from "@/lib/free-tools/upsell-card";
+import { useToolRun } from "@/lib/free-tools/use-tool-run";
-// Public site key. Cloudflare's always-passing test key is the dev-only
-// fallback; a prod build without VITE_TURNSTILE_SITE_KEY renders no widget.
-const TURNSTILE_SITE_KEY =
- (import.meta.env.VITE_TURNSTILE_SITE_KEY as string | undefined) ||
- (import.meta.env.DEV ? "1x00000000000000000000AA" : "");
-
-type TurnstileApi = {
- render(
- container: HTMLElement,
- options: {
- sitekey: string;
- appearance?: string;
- callback: (token: string) => void;
- "expired-callback"?: () => void;
- },
- ): string;
- reset(widgetId?: string): void;
-};
+const TOOL = "backlink-checker";
type BacklinkRow = {
domainFrom: string | null;
@@ -40,146 +28,33 @@ type CheckResult = {
topBacklinks: BacklinkRow[];
};
-function formatCount(value: number | null): string {
- return typeof value === "number" ? value.toLocaleString("en-US") : "—";
-}
-
-/** Small info icon that reveals an explanation on hover or focus. */
-function InfoTip({
- tip,
- align = "center",
+export function BacklinkCheckerTool({
+ initialTarget,
}: {
- tip: string;
- align?: "center" | "right";
+ initialTarget?: string;
}) {
- return (
- <span className="group relative inline-flex align-middle">
- <button
- type="button"
- aria-label={tip}
- className="ml-1 inline-flex h-3.5 w-3.5 items-center justify-center rounded-full text-neutral-400 hover:text-neutral-700 focus:text-neutral-700 focus:outline-none"
- >
- <svg
- viewBox="0 0 16 16"
- fill="none"
- aria-hidden="true"
- className="h-3.5 w-3.5"
- >
- <circle cx="8" cy="8" r="6.5" stroke="currentColor" />
- <path
- d="M8 7.25v3.25M8 5.25v.1"
- stroke="currentColor"
- strokeWidth="1.4"
- strokeLinecap="round"
- />
- </svg>
- </button>
- <span
- role="tooltip"
- aria-hidden="true"
- className={[
- "pointer-events-none absolute top-full z-10 mt-1.5 w-56 rounded-lg bg-neutral-950 px-3 py-2 text-left text-xs font-normal normal-case leading-5 text-white opacity-0 shadow-lg transition-opacity group-focus-within:opacity-100 group-hover:opacity-100",
- align === "right" ? "right-0" : "left-1/2 -translate-x-1/2",
- ].join(" ")}
- >
- {tip}
- </span>
- </span>
- );
-}
-
-export function BacklinkCheckerTool() {
const [target, setTarget] = useState("");
- const [status, setStatus] = useState<"idle" | "loading" | "done" | "error">(
- "idle",
- );
- const [errorMessage, setErrorMessage] = useState("");
- const [result, setResult] = useState<CheckResult | null>(null);
-
- const widgetContainerRef = useRef<HTMLDivElement>(null);
- const widgetIdRef = useRef<string | null>(null);
- const tokenRef = useRef("");
+ const { status, errorMessage, result, run, turnstile } =
+ useToolRun<CheckResult>(TOOL, "/api/backlink-check");
+ // Applied after hydration so the prerendered HTML and the first client
+ // render agree, whatever ?target= the visitor arrived with.
useEffect(() => {
- if (!TURNSTILE_SITE_KEY) return;
- const w = window as unknown as {
- turnstile?: TurnstileApi;
- onloadTurnstileCallback?: () => void;
- };
- const renderWidget = () => {
- if (!w.turnstile || !widgetContainerRef.current) return;
- if (widgetIdRef.current !== null) return;
- widgetIdRef.current = w.turnstile.render(widgetContainerRef.current, {
- sitekey: TURNSTILE_SITE_KEY,
- // Invisible unless Turnstile decides the visitor needs a challenge.
- appearance: "interaction-only",
- callback: (token) => {
- tokenRef.current = token;
- },
- "expired-callback": () => {
- tokenRef.current = "";
- },
- });
- };
-
- if (w.turnstile) {
- renderWidget();
- return;
- }
- w.onloadTurnstileCallback = renderWidget;
- if (!document.querySelector("script[data-turnstile]")) {
- const script = document.createElement("script");
- script.src =
- "https://challenges.cloudflare.com/turnstile/v0/api.js?onload=onloadTurnstileCallback";
- script.async = true;
- script.dataset.turnstile = "true";
- document.head.appendChild(script);
- }
- }, []);
+ if (initialTarget) setTarget(initialTarget);
+ }, [initialTarget]);
- const handleSubmit = async (e: FormEvent) => {
+ const handleSubmit = (e: FormEvent) => {
e.preventDefault();
- setStatus("loading");
- setErrorMessage("");
- try {
- const res = await fetch("/api/backlink-check", {
- method: "POST",
- headers: { "Content-Type": "application/json" },
- body: JSON.stringify({
- target,
- turnstileToken: tokenRef.current || undefined,
- }),
- });
- const data = (await res.json().catch(() => ({}))) as
- | CheckResult
- | { error?: string };
- if (!res.ok) {
- throw new Error(
- (data as { error?: string }).error || "Something went wrong",
- );
- }
- setResult(data as CheckResult);
- setStatus("done");
- } catch (err) {
- setStatus("error");
- setErrorMessage(
- err instanceof Error ? err.message : "Something went wrong",
- );
- } finally {
- // Tokens are single-use; get a fresh one for the next check.
- tokenRef.current = "";
- const w = window as unknown as { turnstile?: TurnstileApi };
- if (w.turnstile && widgetIdRef.current !== null) {
- w.turnstile.reset(widgetIdRef.current);
- }
- }
+ void run({ target });
};
return (
<div>
- <form
+ <ToolForm
onSubmit={handleSubmit}
- className="rounded-xl border border-[var(--color-border-subtle)] bg-white p-4 md:p-5"
+ turnstileRef={turnstile.containerRef}
+ status={status}
+ errorMessage={errorMessage}
>
<div className="flex flex-col gap-2 sm:flex-row">
<label htmlFor="backlink-target" className="sr-only">
@@ -197,24 +72,11 @@ export function BacklinkCheckerTool() {
onChange={(e) => setTarget(e.target.value)}
placeholder="example.com"
disabled={status === "loading"}
- className="h-11 min-w-0 flex-1 rounded-lg border border-[var(--color-border-subtle)] bg-white px-3.5 text-base text-neutral-900 placeholder:text-neutral-500 transition focus:border-neutral-900 focus:outline-none focus:ring-1 focus:ring-neutral-900"
+ className={FIELD_CLASS}
/>
- <button
- type="submit"
- disabled={status === "loading"}
- className="h-11 shrink-0 rounded-lg bg-neutral-950 px-6 text-sm font-medium text-white transition-colors hover:bg-neutral-800 disabled:opacity-50"
- >
- {status === "loading" ? "Checking…" : "Check backlinks"}
- </button>
+ <SubmitButton status={status} idleLabel="Check backlinks" />
</div>
- <div ref={widgetContainerRef} className="empty:hidden" />
- <p className="mt-2.5 text-xs text-[var(--color-brand-muted)]">
- Free &middot; No signup &middot; Instant results
- </p>
- {status === "error" && (
- <p className="mt-2 text-sm text-red-600">{errorMessage}</p>
- )}
- </form>
+ </ToolForm>
{status === "done" && result ? <CheckResults result={result} /> : null}
</div>
@@ -226,29 +88,6 @@ function CheckResults({ result }: { result: CheckResult }) {
const total = summary.backlinks;
const hasMore = typeof total === "number" && total > topBacklinks.length;
- const metrics = [
- {
- label: "Domain rank",
- value: formatCount(summary.rank),
- tip: "DataForSEO's 0-100 strength score for a domain's link profile. Similar idea to Ahrefs DR or Moz DA, but each tool uses its own index and formula, so numbers differ between tools.",
- },
- {
- label: "Backlinks",
- value: formatCount(summary.backlinks),
- tip: "Total individual links pointing at this domain, counting multiple links from the same website.",
- },
- {
- label: "Referring domains",
- value: formatCount(summary.referringDomains),
- tip: "Unique websites that link to this domain at least once.",
- },
- {
- label: "Broken backlinks",
- value: formatCount(summary.brokenBacklinks),
- tip: "Links pointing at pages on this domain that no longer load, such as deleted pages returning 404.",
- },
- ];
-
return (
<div className="mt-6">
<h2 className="text-lg font-semibold tracking-tight text-neutral-950">
@@ -258,35 +97,35 @@ function CheckResults({ result }: { result: CheckResult }) {
</span>
</h2>
- <dl className="mt-4 grid grid-cols-2 overflow-hidden rounded-lg border border-[var(--color-border-subtle)] bg-white md:grid-cols-4">
- {metrics.map((metric, index) => (
- <div
- key={metric.label}
- className={[
- "p-4 md:p-5",
- index % 2 === 1 && "border-l border-[var(--color-border-subtle)]",
- index > 1 && "border-t border-[var(--color-border-subtle)]",
- index > 0 && "md:border-l md:border-t-0",
- ]
- .filter(Boolean)
- .join(" ")}
- >
- <dt className="text-xs text-[var(--color-brand-muted)]">
- {metric.label}
- <InfoTip
- tip={metric.tip}
- align={index > 1 ? "right" : "center"}
- />
- </dt>
- <dd className="mt-1 text-xl font-semibold tabular-nums text-neutral-950">
- {metric.value}
- </dd>
- </div>
- ))}
- </dl>
+ <div className="mt-4">
+ <MetricGrid
+ metrics={[
+ {
+ label: "Domain rank",
+ value: formatCount(summary.rank),
+ tip: "DataForSEO's 0-100 strength score for a domain's link profile. Similar idea to Ahrefs DR or Moz DA, but each tool uses its own index and formula, so numbers differ between tools.",
+ },
+ {
+ label: "Backlinks",
+ value: formatCount(summary.backlinks),
+ tip: "Total individual links pointing at this domain, counting multiple links from the same website.",
+ },
+ {
+ label: "Referring domains",
+ value: formatCount(summary.referringDomains),
+ tip: "Unique websites that link to this domain at least once.",
+ },
+ {
+ label: "Broken backlinks",
+ value: formatCount(summary.brokenBacklinks),
+ tip: "Links pointing at pages on this domain that no longer load, such as deleted pages returning 404.",
+ },
+ ]}
+ />
+ </div>
{topBacklinks.length > 0 ? (
- <div className="mt-4 overflow-x-auto rounded-lg border border-[var(--color-border-subtle)] bg-white">
+ <ToolTable label="Backlink Checker results" className="mt-4">
<table className="w-full min-w-[720px] text-left text-sm">
<thead>
<tr className="border-b border-[var(--color-border-subtle)] text-xs text-[var(--color-brand-muted)]">
@@ -354,43 +193,30 @@ function CheckResults({ result }: { result: CheckResult }) {
))}
</tbody>
</table>
- </div>
+ </ToolTable>
) : (
<p className="mt-4 rounded-lg border border-[var(--color-border-subtle)] bg-white p-5 text-sm text-neutral-700">
No live backlinks found for this domain in the index yet.
</p>
)}
- <div className="mt-4 rounded-xl border border-[var(--color-border-subtle)] bg-white p-5 md:p-6">
- <p className="text-sm leading-6 text-neutral-700">
- {hasMore ? (
- <>
- Showing the top {topBacklinks.length} backlinks, one per referring
- domain, strongest domains first.{" "}
- <span className="font-medium text-neutral-950">
- {formatCount(total)} total backlinks
- </span>{" "}
- are in the index for this domain.
- </>
- ) : (
- <>
- Explore the full picture: referring domains, anchors, new and lost
- links, and spam signals.
- </>
- )}
- </p>
- <div className="mt-3">
- <a
- href="https://app.openseo.so/sign-up"
- className="inline-flex h-10 items-center justify-center rounded-lg bg-neutral-950 px-4 text-sm font-medium text-white transition-colors hover:bg-neutral-800"
- >
- Explore the full profile — free
- <span aria-hidden="true" className="ml-2">
- &rarr;
- </span>
- </a>
- </div>
- </div>
+ <UpsellCard tool={TOOL} cta="Explore more backlinks">
+ {hasMore ? (
+ <>
+ Showing the top {topBacklinks.length} backlinks, one per referring
+ domain, strongest domains first.{" "}
+ <span className="font-medium text-neutral-950">
+ {formatCount(total)} total backlinks
+ </span>{" "}
+ are in the index for this domain.
+ </>
+ ) : (
+ <>
+ Explore the full picture: referring domains, anchors, new and lost
+ links, and spam signals.
+ </>
+ )}
+ </UpsellCard>
</div>
);
}
diff --git a/web/src/components/competitor-analysis-tool.tsx b/web/src/components/competitor-analysis-tool.tsx
new file mode 100644
index 00000000..33c38139
--- /dev/null
+++ b/web/src/components/competitor-analysis-tool.tsx
@@ -0,0 +1,273 @@
+import { KeywordTable } from "@/lib/free-tools/keyword-table";
+import { ToolTable } from "@/lib/free-tools/tool-table";
+import { type FormEvent, useState } from "react";
+import { DEFAULT_COUNTRY_CODE } from "@/lib/free-tools/countries";
+import {
+ CountrySelect,
+ FIELD_CLASS,
+ FieldLabel,
+ SubmitButton,
+ ToolForm,
+} from "@/lib/free-tools/form";
+import {
+ formatCount,
+ formatMoney,
+ MetricGrid,
+} from "@/lib/free-tools/metric-grid";
+import { UpsellCard } from "@/lib/free-tools/upsell-card";
+import { useToolRun } from "@/lib/free-tools/use-tool-run";
+
+const TOOL = "competitor-analysis";
+
+type KeywordRow = {
+ keyword: string | null;
+ searchVolume: number | null;
+ difficulty: number | null;
+ position: number | null;
+ url: string | null;
+};
+
+type GapRow = KeywordRow & { traffic: number | null };
+
+type PageRow = {
+ url: string | null;
+ traffic: number | null;
+ keywords: number | null;
+};
+
+type OrganicMetrics = {
+ organicTraffic: number | null;
+ organicKeywords: number | null;
+ trafficValue: number | null;
+};
+
+type AnalysisResult = {
+ competitor: string;
+ yourDomain: string | null;
+ keywords: KeywordRow[];
+ totalKeywords: number | null;
+ pages: PageRow[];
+ totalPages: number | null;
+ comparison: { competitor: OrganicMetrics; you: OrganicMetrics } | null;
+ gap: GapRow[] | null;
+ gapFailed: boolean;
+};
+
+export function CompetitorAnalysisTool() {
+ const [competitor, setCompetitor] = useState("");
+ const [yourDomain, setYourDomain] = useState("");
+ const [locationCode, setLocationCode] = useState(DEFAULT_COUNTRY_CODE);
+ const { status, errorMessage, result, run, turnstile } =
+ useToolRun<AnalysisResult>(TOOL, "/api/competitor-analysis");
+
+ const handleSubmit = (e: FormEvent) => {
+ e.preventDefault();
+ void run({
+ competitor,
+ yourDomain: yourDomain.trim() || undefined,
+ locationCode,
+ });
+ };
+
+ return (
+ <div>
+ <ToolForm
+ onSubmit={handleSubmit}
+ turnstileRef={turnstile.containerRef}
+ status={status}
+ errorMessage={errorMessage}
+ >
+ <div className="grid gap-3 md:grid-cols-3">
+ <div>
+ <FieldLabel htmlFor="competitor-domain">
+ Competitor domain
+ </FieldLabel>
+ <input
+ id="competitor-domain"
+ name="competitor"
+ type="text"
+ inputMode="url"
+ autoComplete="off"
+ spellCheck={false}
+ required
+ value={competitor}
+ onChange={(e) => setCompetitor(e.target.value)}
+ placeholder="competitor.com"
+ disabled={status === "loading"}
+ className={`mt-1 ${FIELD_CLASS}`}
+ />
+ </div>
+ <div>
+ <FieldLabel htmlFor="competitor-your-domain">
+ Your domain (optional)
+ </FieldLabel>
+ <input
+ id="competitor-your-domain"
+ name="yourDomain"
+ type="text"
+ inputMode="url"
+ autoComplete="off"
+ spellCheck={false}
+ value={yourDomain}
+ onChange={(e) => setYourDomain(e.target.value)}
+ placeholder="example.com"
+ disabled={status === "loading"}
+ className={`mt-1 ${FIELD_CLASS}`}
+ />
+ </div>
+ <div>
+ <FieldLabel htmlFor="competitor-country">Country</FieldLabel>
+ <div className="mt-1">
+ <CountrySelect
+ id="competitor-country"
+ value={locationCode}
+ onChange={setLocationCode}
+ disabled={status === "loading"}
+ />
+ </div>
+ </div>
+ </div>
+ <div className="mt-3">
+ <SubmitButton status={status} idleLabel="Analyze competitor" />
+ </div>
+ </ToolForm>
+
+ {status === "done" && result ? <AnalysisReport result={result} /> : null}
+ </div>
+ );
+}
+
+function AnalysisReport({ result }: { result: AnalysisResult }) {
+ return (
+ <div className="mt-6 space-y-8">
+ {result.comparison ? (
+ <section>
+ <h2 className="text-lg font-semibold tracking-tight text-neutral-950">
+ {result.competitor} vs {result.yourDomain}
+ </h2>
+ <div className="mt-3">
+ <MetricGrid
+ metrics={[
+ {
+ label: `${result.competitor} traffic`,
+ value: formatCount(
+ result.comparison.competitor.organicTraffic,
+ ),
+ tip: "Estimated monthly organic visits for the competitor in the selected country.",
+ },
+ {
+ label: `${result.competitor} keywords`,
+ value: formatCount(
+ result.comparison.competitor.organicKeywords,
+ ),
+ },
+ {
+ label: `${result.yourDomain} traffic`,
+ value: formatCount(result.comparison.you.organicTraffic),
+ tip: "Estimated monthly organic visits for your domain in the selected country.",
+ },
+ {
+ label: `${result.yourDomain} keywords`,
+ value: formatCount(result.comparison.you.organicKeywords),
+ },
+ ]}
+ />
+ </div>
+ <p className="mt-2 text-xs text-[var(--color-brand-muted)]">
+ Traffic value:{" "}
+ {formatMoney(result.comparison.competitor.trafficValue)} vs{" "}
+ {formatMoney(result.comparison.you.trafficValue)} per month.
+ </p>
+ </section>
+ ) : null}
+
+ {result.gap && result.gap.length > 0 ? (
+ <section>
+ <h2 className="text-lg font-semibold tracking-tight text-neutral-950">
+ Keywords they rank for that you don&rsquo;t
+ </h2>
+ <KeywordTable rows={result.gap} showTraffic />
+ </section>
+ ) : null}
+
+ {result.gapFailed ? (
+ <p className="rounded-lg border border-[var(--color-border-subtle)] bg-white p-5 text-sm text-neutral-700">
+ We couldn't load the keyword comparison. Try again. The competitor's
+ keywords and pages below are still available.
+ </p>
+ ) : null}
+
+ {result.gap && result.gap.length === 0 ? (
+ <p className="rounded-lg border border-[var(--color-border-subtle)] bg-white p-5 text-sm text-neutral-700">
+ No competitor-only keywords were found in the available data for this
+ country.
+ </p>
+ ) : null}
+
+ <section>
+ <h2 className="text-lg font-semibold tracking-tight text-neutral-950">
+ Top keywords for{" "}
+ <span className="text-[var(--color-brand-accent)]">
+ {result.competitor}
+ </span>
+ </h2>
+ <KeywordTable rows={result.keywords} />
+ </section>
+
+ <section>
+ <h2 className="text-lg font-semibold tracking-tight text-neutral-950">
+ Top pages
+ </h2>
+ {result.pages.length === 0 ? (
+ <p className="mt-3 rounded-lg border border-[var(--color-border-subtle)] bg-white p-5 text-sm text-neutral-700">
+ No ranking pages found in the available data for this country.
+ </p>
+ ) : (
+ <ToolTable label="Competitor top pages" className="mt-3">
+ <table className="w-full min-w-[520px] text-left text-sm">
+ <thead>
+ <tr className="border-b border-[var(--color-border-subtle)] text-xs text-[var(--color-brand-muted)]">
+ <th className="px-4 py-3 font-medium">URL</th>
+ <th className="px-4 py-3 font-medium">Traffic</th>
+ <th className="px-4 py-3 font-medium">Keywords</th>
+ </tr>
+ </thead>
+ <tbody className="divide-y divide-[var(--color-border-subtle)]">
+ {result.pages.map((row) => (
+ <tr key={row.url ?? ""}>
+ <td className="max-w-[420px] truncate px-4 py-3 align-top text-neutral-950">
+ {row.url ?? "—"}
+ </td>
+ <td className="px-4 py-3 align-top tabular-nums text-neutral-700">
+ {formatCount(row.traffic)}
+ </td>
+ <td className="px-4 py-3 align-top tabular-nums text-neutral-700">
+ {formatCount(row.keywords)}
+ </td>
+ </tr>
+ ))}
+ </tbody>
+ </table>
+ </ToolTable>
+ )}
+ </section>
+
+ <UpsellCard tool={TOOL} cta="Explore more competitor keywords">
+ {result.keywords.length > 0 ? (
+ <>
+ Showing {result.keywords.length}
+ {result.totalKeywords !== null
+ ? ` of ${formatCount(result.totalKeywords)}`
+ : ""}{" "}
+ ranking keywords.{" "}
+ </>
+ ) : (
+ <>Try another country or competitor to explore more ranking data. </>
+ )}
+ Browse more competitor keywords in OpenSEO, filter by search volume,
+ difficulty, and ranking position, and save keywords for further
+ research.
+ </UpsellCard>
+ </div>
+ );
+}
diff --git a/web/src/components/domain-age-checker-tool.tsx b/web/src/components/domain-age-checker-tool.tsx
new file mode 100644
index 00000000..96a892f8
--- /dev/null
+++ b/web/src/components/domain-age-checker-tool.tsx
@@ -0,0 +1,154 @@
+import { ToolTable } from "@/lib/free-tools/tool-table";
+import { type FormEvent, useState } from "react";
+import { FIELD_CLASS, SubmitButton, ToolForm } from "@/lib/free-tools/form";
+import { UpsellCard } from "@/lib/free-tools/upsell-card";
+import { useToolRun } from "@/lib/free-tools/use-tool-run";
+
+const TOOL = "domain-age-checker";
+const MAX_DOMAINS = 10;
+
+type AgeRow = {
+ domain: string;
+ created: string | null;
+ updated: string | null;
+ expires: string | null;
+ registrar: string | null;
+ ageYears: number | null;
+ ageMonths: number | null;
+ error: string | null;
+};
+
+function formatDate(value: string | null): string {
+ if (!value) return "—";
+ const date = new Date(value);
+ if (Number.isNaN(date.getTime())) return "—";
+ return date.toLocaleDateString("en-US", {
+ year: "numeric",
+ month: "short",
+ day: "numeric",
+ });
+}
+
+function formatAge(row: AgeRow): string {
+ if (row.ageYears === null || row.ageMonths === null) return "—";
+ const years = row.ageYears === 1 ? "1 year" : `${row.ageYears} years`;
+ const months = row.ageMonths === 1 ? "1 month" : `${row.ageMonths} months`;
+ return row.ageYears === 0 ? months : `${years}, ${months}`;
+}
+
+export function DomainAgeCheckerTool() {
+ const [domains, setDomains] = useState("");
+ const { status, errorMessage, result, run, turnstile } = useToolRun<{
+ rows: AgeRow[];
+ }>(TOOL, "/api/domain-age-checker");
+
+ const entered = domains
+ .split("\n")
+ .map((line) => line.trim())
+ .filter(Boolean);
+ const overLimit = entered.length > MAX_DOMAINS;
+
+ const handleSubmit = (e: FormEvent) => {
+ e.preventDefault();
+ void run({ domains: entered.slice(0, MAX_DOMAINS) });
+ };
+
+ return (
+ <div>
+ <ToolForm
+ onSubmit={handleSubmit}
+ turnstileRef={turnstile.containerRef}
+ status={status}
+ errorMessage={errorMessage}
+ cacheDuration="7 days"
+ >
+ <label htmlFor="age-domains" className="sr-only">
+ Domains to check, one per line
+ </label>
+ <textarea
+ id="age-domains"
+ name="domains"
+ rows={5}
+ required
+ spellCheck={false}
+ value={domains}
+ onChange={(e) => setDomains(e.target.value)}
+ placeholder={"example.com\ncompetitor.com"}
+ disabled={status === "loading"}
+ className={`${FIELD_CLASS} h-auto py-2.5`}
+ />
+ <p className="mt-2 text-xs text-[var(--color-brand-muted)]">
+ One domain per line, up to {MAX_DOMAINS}.
+ </p>
+ {overLimit ? (
+ <p className="mt-1 text-xs text-neutral-900">
+ You pasted {entered.length} domains. Only the first {MAX_DOMAINS}{" "}
+ domains are checked.
+ </p>
+ ) : null}
+ <div className="mt-3">
+ <SubmitButton status={status} idleLabel="Check domain age" />
+ </div>
+ </ToolForm>
+
+ {status === "done" && result ? (
+ <div className="mt-6">
+ <ToolTable label="Domain Age Checker results">
+ <table className="w-full min-w-[720px] text-left text-sm">
+ <thead>
+ <tr className="border-b border-[var(--color-border-subtle)] text-xs text-[var(--color-brand-muted)]">
+ <th className="px-4 py-3 font-medium">Domain</th>
+ <th className="px-4 py-3 font-medium">Age</th>
+ <th className="px-4 py-3 font-medium">Registered</th>
+ <th className="px-4 py-3 font-medium">Updated</th>
+ <th className="px-4 py-3 font-medium">Expires</th>
+ <th className="px-4 py-3 font-medium">Registrar</th>
+ </tr>
+ </thead>
+ <tbody className="divide-y divide-[var(--color-border-subtle)]">
+ {result.rows.map((row) => (
+ <tr key={row.domain}>
+ <td className="px-4 py-3 align-top font-medium text-neutral-950">
+ {row.domain}
+ </td>
+ {row.error ? (
+ <td
+ colSpan={5}
+ className="px-4 py-3 align-top text-neutral-600"
+ >
+ {row.error}
+ </td>
+ ) : (
+ <>
+ <td className="px-4 py-3 align-top text-neutral-950">
+ {formatAge(row)}
+ </td>
+ <td className="px-4 py-3 align-top text-neutral-700">
+ {formatDate(row.created)}
+ </td>
+ <td className="px-4 py-3 align-top text-neutral-700">
+ {formatDate(row.updated)}
+ </td>
+ <td className="px-4 py-3 align-top text-neutral-700">
+ {formatDate(row.expires)}
+ </td>
+ <td className="max-w-[200px] truncate px-4 py-3 align-top text-neutral-700">
+ {row.registrar ?? "—"}
+ </td>
+ </>
+ )}
+ </tr>
+ ))}
+ </tbody>
+ </table>
+ </ToolTable>
+
+ <UpsellCard tool={TOOL} cta="See ranking keywords">
+ Age alone says very little. What matters is whether the domain has
+ earned links and rankings in those years — OpenSEO shows both.
+ </UpsellCard>
+ </div>
+ ) : null}
+ </div>
+ );
+}
diff --git a/web/src/components/keyword-discovery-tool.tsx b/web/src/components/keyword-discovery-tool.tsx
new file mode 100644
index 00000000..d9a24650
--- /dev/null
+++ b/web/src/components/keyword-discovery-tool.tsx
@@ -0,0 +1,144 @@
+import { type FormEvent, useState } from "react";
+import { DEFAULT_COUNTRY_CODE, countryLabel } from "@/lib/free-tools/countries";
+import {
+ CountrySelect,
+ FIELD_CLASS,
+ FieldLabel,
+ SubmitButton,
+ ToolForm,
+} from "@/lib/free-tools/form";
+import { KeywordTable } from "@/lib/free-tools/keyword-table";
+import type { RankedKeywordRow } from "@/lib/free-tools/labs";
+import type { KeywordIdea } from "@/lib/free-tools/labs";
+import { formatCount } from "@/lib/free-tools/metric-grid";
+import { ToolTable } from "@/lib/free-tools/tool-table";
+import { UpsellCard } from "@/lib/free-tools/upsell-card";
+import { useToolRun } from "@/lib/free-tools/use-tool-run";
+
+type Result =
+ | { target: string; locationCode: number; keywords: RankedKeywordRow[] }
+ | { keyword: string; locationCode: number; keywords: KeywordIdea[] };
+export function KeywordDiscoveryTool({
+ tool,
+}: {
+ tool: "competitor-keyword-finder" | "keyword-generator";
+}) {
+ const competitor = tool === "competitor-keyword-finder";
+ const [input, setInput] = useState("");
+ const [locationCode, setLocationCode] = useState(DEFAULT_COUNTRY_CODE);
+ const { status, errorMessage, result, run, turnstile } = useToolRun<Result>(
+ tool,
+ `/api/${tool}`,
+ );
+ const handleSubmit = (event: FormEvent) => {
+ event.preventDefault();
+ void run({ [competitor ? "target" : "keyword"]: input, locationCode });
+ };
+ return (
+ <div>
+ <ToolForm
+ onSubmit={handleSubmit}
+ turnstileRef={turnstile.containerRef}
+ status={status}
+ errorMessage={errorMessage}
+ >
+ <div className="grid gap-3 md:grid-cols-[2fr_1fr]">
+ <div>
+ <FieldLabel htmlFor={`${tool}-input`}>
+ {competitor ? "Competitor domain" : "Topic or keyword"}
+ </FieldLabel>
+ <input
+ id={`${tool}-input`}
+ name={competitor ? "target" : "keyword"}
+ type="text"
+ inputMode={competitor ? "url" : "text"}
+ autoComplete="off"
+ required
+ maxLength={competitor ? 300 : 100}
+ value={input}
+ onChange={(e) => setInput(e.target.value)}
+ placeholder={
+ competitor ? "competitor.com" : "e.g. email marketing"
+ }
+ disabled={status === "loading"}
+ className={`mt-1 ${FIELD_CLASS}`}
+ />
+ </div>
+ <div>
+ <FieldLabel htmlFor={`${tool}-country`}>Country</FieldLabel>
+ <div className="mt-1">
+ <CountrySelect
+ id={`${tool}-country`}
+ value={locationCode}
+ onChange={setLocationCode}
+ disabled={status === "loading"}
+ />
+ </div>
+ </div>
+ </div>
+ <div className="mt-3">
+ <SubmitButton
+ status={status}
+ idleLabel={
+ competitor ? "Find competitor keywords" : "Generate keyword ideas"
+ }
+ loadingLabel="Finding keywords…"
+ />
+ </div>
+ </ToolForm>
+ {status === "done" && result ? (
+ <section className="mt-6 space-y-4" aria-label="Keyword results">
+ <h2 className="break-words text-xl font-semibold text-neutral-950">
+ {"target" in result
+ ? `Top keywords for ${result.target}`
+ : `Keyword ideas for “${result.keyword}”`}
+ </h2>
+ <p className="text-sm leading-6 text-[var(--color-brand-muted)]">
+ Showing {result.keywords.length} keywords. Volume is estimated
+ monthly searches in {countryLabel(result.locationCode)}. Difficulty
+ estimates how hard it may be to rank, from 0 to 100. Lower scores
+ suggest easier competition. A dash means data is unavailable.
+ </p>
+ {"target" in result ? (
+ <KeywordTable rows={result.keywords} />
+ ) : result.keywords.length ? (
+ <ToolTable label="Keyword ideas">
+ <table className="w-full min-w-[360px] text-left text-sm">
+ <thead>
+ <tr className="border-b border-[var(--color-border-subtle)] text-xs text-[var(--color-brand-muted)]">
+ <th className="px-4 py-3 font-medium">Keyword</th>
+ <th className="px-4 py-3 font-medium">Volume</th>
+ <th className="px-4 py-3 font-medium">Difficulty</th>
+ </tr>
+ </thead>
+ <tbody className="divide-y divide-[var(--color-border-subtle)]">
+ {result.keywords.map((row) => (
+ <tr key={row.keyword}>
+ <td className="max-w-[320px] break-words px-4 py-3 font-medium">
+ {row.keyword}
+ </td>
+ <td className="px-4 py-3 tabular-nums">
+ {formatCount(row.searchVolume)}
+ </td>
+ <td className="px-4 py-3 tabular-nums">
+ {formatCount(row.difficulty)}
+ </td>
+ </tr>
+ ))}
+ </tbody>
+ </table>
+ </ToolTable>
+ ) : (
+ <p className="rounded-lg border border-[var(--color-border-subtle)] bg-white p-5 text-sm">
+ No keyword ideas found in the available data. Try a broader topic
+ or another country.
+ </p>
+ )}
+ <UpsellCard tool={tool} cta="Continue keyword research">
+ Explore more keywords and save the ones worth pursuing in OpenSEO.
+ </UpsellCard>
+ </section>
+ ) : null}
+ </div>
+ );
+}
diff --git a/web/src/components/landing-page.css b/web/src/components/landing-page.css
index cda42783..28a50c99 100644
--- a/web/src/components/landing-page.css
+++ b/web/src/components/landing-page.css
@@ -547,6 +547,20 @@
margin-top: 24px;
}
+/* ── Free tools row ── */
+.itc-free-tools-row {
+ align-items: center;
+ display: flex;
+ flex-wrap: wrap;
+ gap: 20px;
+ margin-top: 32px;
+}
+
+.itc-free-tools-label {
+ font-weight: 500;
+ margin: 0;
+}
+
/* ── MCP (the single orange moment) ── */
.itc-mcp-section {
background: #eee8de;
diff --git a/web/src/components/landing-page.tsx b/web/src/components/landing-page.tsx
index f786bf57..0c94f86b 100644
--- a/web/src/components/landing-page.tsx
+++ b/web/src/components/landing-page.tsx
@@ -10,6 +10,7 @@ import { NewsletterSignup } from "@/components/newsletter-signup";
import { ProductHuntLaurel } from "@/components/product-hunt-laurel";
import { SiteFooter } from "@/components/site-footer";
import { featurePages } from "@/lib/feature-pages";
+import { freeTools } from "@/lib/free-tools/tool-pages";
import "./landing-page.css";
const SIGNUP_URL = "https://app.openseo.so/sign-up";
@@ -356,6 +357,14 @@ function DemoVideo() {
);
}
+// One restrained row on the home page; the hub at /tools has the rest.
+const FREE_TOOL_LINKS = [
+ freeTools["backlink-checker"],
+ freeTools["competitor-keyword-finder"],
+ freeTools["website-traffic-checker"],
+ freeTools["competitor-analysis"],
+];
+
function ProductSection() {
return (
<section className="itc-section itc-section-demo">
@@ -400,6 +409,15 @@ function ProductSection() {
All features <IconArrowRight size={15} className="itc-arrow" />
</a>
</div>
+
+ <div className="itc-free-tools-row">
+ <p className="itc-body-sm itc-free-tools-label">Try a free tool</p>
+ {FREE_TOOL_LINKS.map((tool) => (
+ <a key={tool.slug} href={tool.path} className="itc-textlink">
+ {tool.name} <IconArrowRight size={15} className="itc-arrow" />
+ </a>
+ ))}
+ </div>
</Container>
</section>
);
diff --git a/web/src/components/serp-simulator-tool.tsx b/web/src/components/serp-simulator-tool.tsx
new file mode 100644
index 00000000..f210965c
--- /dev/null
+++ b/web/src/components/serp-simulator-tool.tsx
@@ -0,0 +1,207 @@
+import { useEffect, useRef, useState } from "react";
+import { trackTool } from "@/lib/free-tools/analytics";
+import { FIELD_CLASS, FieldLabel } from "@/lib/free-tools/form";
+
+const TOOL = "serp-simulator";
+const DESKTOP_TITLE_WIDTH = 600;
+const TITLE_FONT = "20px Arial, sans-serif";
+
+const EXAMPLE = {
+ title: "Free SERP Simulator: Preview Your Google Snippet | OpenSEO",
+ description:
+ "Preview your title and meta description on desktop and mobile. Check how your text fits before publishing. Free, no signup.",
+ url: "https://openseo.so/serp-simulator",
+};
+
+export function SerpSimulatorTool() {
+ const [title, setTitle] = useState(EXAMPLE.title);
+ const [description, setDescription] = useState(EXAMPLE.description);
+ const [url, setUrl] = useState(EXAMPLE.url);
+ const [showDate, setShowDate] = useState(false);
+ const [device, setDevice] = useState<"desktop" | "mobile">("desktop");
+ const [titleWidth, setTitleWidth] = useState<number | null>(null);
+ const canvas = useRef<HTMLCanvasElement | null>(null);
+ const editTracked = useRef(false);
+
+ useEffect(() => {
+ canvas.current ??= document.createElement("canvas");
+ const context = canvas.current.getContext("2d");
+ if (!context) return;
+ context.font = TITLE_FONT;
+ setTitleWidth(Math.round(context.measureText(title).width));
+ }, [title]);
+
+ const trackFirstEdit = () => {
+ if (editTracked.current) return;
+ editTracked.current = true;
+ trackTool("tool_run", TOOL);
+ trackTool("tool_result", TOOL);
+ };
+
+ const displayUrl = url.replace(/^https?:\/\//, "").replace(/\/+$/, "");
+ const [host, ...segments] = displayUrl.split("/");
+ const today = new Date().toLocaleDateString("en-US", {
+ month: "short",
+ day: "numeric",
+ year: "numeric",
+ });
+ const desktop = device === "desktop";
+ const overDesktop = titleWidth !== null && titleWidth > DESKTOP_TITLE_WIDTH;
+
+ return (
+ <div>
+ <div className="rounded-xl border border-[var(--color-border-subtle)] bg-white p-4 md:p-5">
+ <div className="grid gap-3">
+ <div>
+ <FieldLabel htmlFor="serp-title">Page title</FieldLabel>
+ <input
+ id="serp-title"
+ type="text"
+ maxLength={300}
+ value={title}
+ onChange={(e) => {
+ trackFirstEdit();
+ setTitle(e.target.value);
+ }}
+ className={`mt-1 ${FIELD_CLASS}`}
+ />
+ <p
+ className={`mt-1.5 text-xs ${overDesktop ? "text-amber-800" : "text-[var(--color-brand-muted)]"}`}
+ >
+ {title.length} characters &middot;{" "}
+ {titleWidth === null ? "Measuring width…" : `${titleWidth}px`}
+ {overDesktop
+ ? " · Exceeds the 600px desktop preview"
+ : " · Desktop guide: 600px"}
+ </p>
+ </div>
+
+ <div>
+ <FieldLabel htmlFor="serp-description">Meta description</FieldLabel>
+ <textarea
+ id="serp-description"
+ rows={3}
+ maxLength={1000}
+ value={description}
+ onChange={(e) => {
+ trackFirstEdit();
+ setDescription(e.target.value);
+ }}
+ className={`mt-1 ${FIELD_CLASS} h-auto py-2.5`}
+ />
+ <p className="mt-1.5 text-xs text-[var(--color-brand-muted)]">
+ {description.length} characters &middot; Check how the text wraps
+ in each preview.
+ </p>
+ </div>
+
+ <div className="grid gap-3 md:grid-cols-[1fr_auto] md:items-end">
+ <div>
+ <FieldLabel htmlFor="serp-url">URL</FieldLabel>
+ <input
+ id="serp-url"
+ type="text"
+ inputMode="url"
+ spellCheck={false}
+ value={url}
+ onChange={(e) => {
+ trackFirstEdit();
+ setUrl(e.target.value);
+ }}
+ className={`mt-1 ${FIELD_CLASS}`}
+ />
+ </div>
+ <label className="flex h-11 items-center gap-2 text-sm text-neutral-700">
+ <input
+ type="checkbox"
+ checked={showDate}
+ onChange={(e) => setShowDate(e.target.checked)}
+ className="h-4 w-4 rounded border-[var(--color-border-subtle)]"
+ />
+ Show date
+ </label>
+ </div>
+ </div>
+ <p className="mt-2.5 text-xs text-[var(--color-brand-muted)]">
+ Free &middot; No signup &middot; Your text stays in your browser
+ </p>
+ </div>
+
+ <section className="mt-6" aria-label="Search result preview">
+ <div className="flex flex-wrap items-center justify-between gap-3">
+ <h2 className="text-lg font-semibold text-neutral-950">
+ Search preview
+ </h2>
+ <div
+ role="group"
+ aria-label="Preview device"
+ className="inline-flex rounded-lg border border-[var(--color-border-subtle)] bg-white p-1"
+ >
+ {(["desktop", "mobile"] as const).map((option) => (
+ <button
+ key={option}
+ type="button"
+ aria-pressed={device === option}
+ onClick={() => setDevice(option)}
+ className={`min-h-11 rounded-md px-4 text-sm font-medium capitalize focus-visible:outline-2 focus-visible:outline-offset-2 ${device === option ? "bg-neutral-950 text-white" : "text-neutral-700 hover:bg-neutral-100"}`}
+ >
+ {option}
+ </button>
+ ))}
+ </div>
+ </div>
+ <p className="mt-2 text-xs text-[var(--color-brand-muted)]">
+ {desktop
+ ? "Desktop preview at 600px text width."
+ : "Mobile preview at 328px text width."}{" "}
+ Layout and truncation are approximate.
+ </p>
+ <p
+ className={`mt-2 text-xs text-[var(--color-brand-muted)] ${desktop ? "min-[700px]:hidden" : "min-[420px]:hidden"}`}
+ >
+ Scroll sideways to see the full preview.
+ </p>
+ <div
+ role="region"
+ aria-label={`${device} search preview`}
+ tabIndex={0}
+ className="mt-3 overflow-x-auto rounded-xl focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-900"
+ >
+ <div
+ className={`w-max rounded-xl border border-[var(--color-border-subtle)] bg-white ${desktop ? "p-5" : "p-4"}`}
+ >
+ <div
+ className={desktop ? "w-[600px]" : "w-[328px]"}
+ style={{ fontFamily: "Arial, sans-serif" }}
+ >
+ <p className="truncate text-xs text-neutral-700">
+ {host}
+ {desktop && segments.length > 0
+ ? ` › ${segments.join(" › ")}`
+ : ""}
+ </p>
+ <p
+ className={`mt-1 text-[20px] leading-7 text-[#1a0dab] ${desktop ? "truncate" : "line-clamp-2 [overflow-wrap:anywhere]"}`}
+ >
+ {title}
+ </p>
+ <p
+ className={`mt-1 text-[14px] leading-[22px] text-neutral-600 [overflow-wrap:anywhere] ${desktop ? "line-clamp-2" : "line-clamp-3"}`}
+ >
+ {showDate ? (
+ <span className="text-neutral-500">{today} — </span>
+ ) : null}
+ {description}
+ </p>
+ </div>
+ </div>
+ </div>
+ </section>
+
+ <p className="mt-3 text-xs text-[var(--color-brand-muted)]">
+ Google may rewrite your title or description for a search query. Actual
+ results also vary by screen size and layout.
+ </p>
+ </div>
+ );
+}
diff --git a/web/src/components/site-footer.tsx b/web/src/components/site-footer.tsx
index 31e20826..4c965197 100644
--- a/web/src/components/site-footer.tsx
+++ b/web/src/components/site-footer.tsx
@@ -1,5 +1,6 @@
import { Link } from "@tanstack/react-router";
import { featureGroups } from "@/lib/feature-pages";
+import { freeToolList } from "@/lib/free-tools/tool-pages";
const featureLinks = featureGroups.flatMap((group) =>
group.pages.map((page) => ({
@@ -53,7 +54,15 @@ export function SiteFooter({ className }: { className?: string }) {
<div>
<p className="font-semibold text-neutral-900">Free Tools</p>
<div className="mt-2 flex flex-col gap-1.5">
- <Link to="/backlink-checker">Backlink Checker</Link>
+ {freeToolList.map((tool) => (
+ <a key={tool.slug} href={tool.path}>
+ {tool.name}
+ </a>
+ ))}
+ <Link to="/google-search-console-mcp">
+ Google Search Console MCP
+ </Link>
+ <Link to="/tools">All free tools</Link>
</div>
</div>
diff --git a/web/src/components/spam-score-checker-tool.tsx b/web/src/components/spam-score-checker-tool.tsx
new file mode 100644
index 00000000..49676f6e
--- /dev/null
+++ b/web/src/components/spam-score-checker-tool.tsx
@@ -0,0 +1,164 @@
+import { ToolTable } from "@/lib/free-tools/tool-table";
+import { type FormEvent, useState } from "react";
+import { FIELD_CLASS, SubmitButton, ToolForm } from "@/lib/free-tools/form";
+import { formatCount, MetricGrid } from "@/lib/free-tools/metric-grid";
+import { UpsellCard } from "@/lib/free-tools/upsell-card";
+import { useToolRun } from "@/lib/free-tools/use-tool-run";
+
+const TOOL = "spam-score-checker";
+
+type SpamResult = {
+ target: string;
+ spamScore: number | null;
+ targetSpamScore: number | null;
+ rank: number | null;
+ backlinks: number | null;
+ referringDomains: number | null;
+ worstBacklinks: Array<{
+ domainFrom: string | null;
+ urlFrom: string | null;
+ anchor: string | null;
+ dofollow: boolean | null;
+ domainRank: number | null;
+ spamScore: number | null;
+ }>;
+};
+
+export function SpamScoreCheckerTool() {
+ const [target, setTarget] = useState("");
+ const { status, errorMessage, result, run, turnstile } =
+ useToolRun<SpamResult>(TOOL, "/api/spam-score-checker");
+
+ const handleSubmit = (e: FormEvent) => {
+ e.preventDefault();
+ void run({ target });
+ };
+
+ return (
+ <div>
+ <ToolForm
+ onSubmit={handleSubmit}
+ turnstileRef={turnstile.containerRef}
+ status={status}
+ errorMessage={errorMessage}
+ >
+ <div className="flex flex-col gap-2 sm:flex-row">
+ <label htmlFor="spam-target" className="sr-only">
+ Domain to check
+ </label>
+ <input
+ id="spam-target"
+ name="target"
+ type="text"
+ inputMode="url"
+ autoComplete="off"
+ spellCheck={false}
+ required
+ value={target}
+ onChange={(e) => setTarget(e.target.value)}
+ placeholder="example.com"
+ disabled={status === "loading"}
+ className={FIELD_CLASS}
+ />
+ <SubmitButton status={status} idleLabel="Check spam score" />
+ </div>
+ </ToolForm>
+
+ {status === "done" && result ? (
+ <div className="mt-6">
+ <h2 className="text-lg font-semibold tracking-tight text-neutral-950">
+ Spam signals for{" "}
+ <span className="text-[var(--color-brand-accent)]">
+ {result.target}
+ </span>
+ </h2>
+
+ <div className="mt-3">
+ <MetricGrid
+ metrics={[
+ {
+ label: "Backlink spam score",
+ value: formatCount(result.spamScore),
+ tip: "DataForSEO's 0-100 estimate of how spammy the links pointing at this domain look, based on signals like the linking sites' own profiles. Higher is worse.",
+ },
+ {
+ label: "Domain spam score",
+ value: formatCount(result.targetSpamScore),
+ tip: "The same 0-100 scale applied to this domain itself rather than to the links pointing at it.",
+ },
+ {
+ label: "Referring domains",
+ value: formatCount(result.referringDomains),
+ tip: "Unique websites linking to this domain at least once.",
+ },
+ {
+ label: "Domain rank",
+ value: formatCount(result.rank),
+ tip: "DataForSEO's 0-100 link-profile strength score for this domain.",
+ },
+ ]}
+ />
+ </div>
+
+ <h3 className="mt-6 text-base font-semibold text-neutral-950">
+ The spammiest links pointing here
+ </h3>
+ {result.worstBacklinks.length > 0 ? (
+ <ToolTable label="Spam Score Checker results" className="mt-3">
+ <table className="w-full min-w-[640px] text-left text-sm">
+ <thead>
+ <tr className="border-b border-[var(--color-border-subtle)] text-xs text-[var(--color-brand-muted)]">
+ <th className="px-4 py-3 font-medium">Spam score</th>
+ <th className="px-4 py-3 font-medium">Linking page</th>
+ <th className="px-4 py-3 font-medium">Anchor</th>
+ <th className="px-4 py-3 font-medium">Type</th>
+ </tr>
+ </thead>
+ <tbody className="divide-y divide-[var(--color-border-subtle)]">
+ {result.worstBacklinks.map((row) => (
+ <tr key={row.urlFrom ?? row.domainFrom ?? ""}>
+ <td className="px-4 py-3 align-top tabular-nums text-neutral-950">
+ {formatCount(row.spamScore)}
+ </td>
+ <td className="max-w-[320px] px-4 py-3 align-top">
+ <p className="truncate font-medium text-neutral-950">
+ {row.domainFrom ?? "—"}
+ </p>
+ {row.urlFrom ? (
+ <span className="block truncate text-xs text-[var(--color-brand-muted)]">
+ {row.urlFrom}
+ </span>
+ ) : null}
+ </td>
+ <td className="max-w-[200px] truncate px-4 py-3 align-top text-neutral-700">
+ {row.anchor ?? "—"}
+ </td>
+ <td className="px-4 py-3 align-top text-neutral-700">
+ {row.dofollow ? "Follow" : "Nofollow"}
+ </td>
+ </tr>
+ ))}
+ </tbody>
+ </table>
+ </ToolTable>
+ ) : (
+ <p className="mt-3 rounded-lg border border-[var(--color-border-subtle)] bg-white p-5 text-sm text-neutral-700">
+ No live backlinks found for this domain in the index yet.
+ </p>
+ )}
+ <p className="mt-2 text-xs text-[var(--color-brand-muted)]">
+ Spammy links are normal. A handful of scraper sites is not a
+ problem; a profile where most referring domains score high is worth
+ a closer look.
+ </p>
+
+ <UpsellCard tool={TOOL} cta="Audit the whole profile">
+ The free check lists the 10 spammiest referring domains. OpenSEO
+ filters the full backlink profile by spam score so you can see how
+ much of it is junk.
+ </UpsellCard>
+ </div>
+ ) : null}
+ </div>
+ );
+}
diff --git a/web/src/components/website-traffic-checker-tool.tsx b/web/src/components/website-traffic-checker-tool.tsx
new file mode 100644
index 00000000..a877eeb0
--- /dev/null
+++ b/web/src/components/website-traffic-checker-tool.tsx
@@ -0,0 +1,342 @@
+import { ToolTable } from "@/lib/free-tools/tool-table";
+import { type FormEvent, useState } from "react";
+import { DEFAULT_COUNTRY_CODE } from "@/lib/free-tools/countries";
+import {
+ CountrySelect,
+ FIELD_CLASS,
+ FieldLabel,
+ SubmitButton,
+ ToolForm,
+} from "@/lib/free-tools/form";
+import {
+ formatCount,
+ formatMoney,
+ MetricGrid,
+} from "@/lib/free-tools/metric-grid";
+import { UpsellCard } from "@/lib/free-tools/upsell-card";
+import { useToolRun } from "@/lib/free-tools/use-tool-run";
+
+const TOOL = "website-traffic-checker";
+
+type KeywordRow = {
+ keyword: string | null;
+ searchVolume: number | null;
+ position: number | null;
+ url: string | null;
+};
+
+type PageRow = {
+ url: string | null;
+ traffic: number | null;
+ keywords: number | null;
+};
+
+type DomainTraffic = {
+ domain: string;
+ organicTraffic: number | null;
+ organicKeywords: number | null;
+ trafficValue: number | null;
+ topKeywords: KeywordRow[];
+ topPages: PageRow[];
+ totalPages: number | null;
+};
+
+type TrafficResult = {
+ locationCode: number;
+ primary: DomainTraffic;
+ comparison: DomainTraffic | null;
+};
+
+export function WebsiteTrafficCheckerTool() {
+ const [target, setTarget] = useState("");
+ const [compare, setCompare] = useState("");
+ const [locationCode, setLocationCode] = useState(DEFAULT_COUNTRY_CODE);
+ const { status, errorMessage, result, run, turnstile } =
+ useToolRun<TrafficResult>(TOOL, "/api/website-traffic-checker");
+
+ const handleSubmit = (e: FormEvent) => {
+ e.preventDefault();
+ void run({ target, compare: compare.trim() || undefined, locationCode });
+ };
+
+ return (
+ <div>
+ <ToolForm
+ onSubmit={handleSubmit}
+ turnstileRef={turnstile.containerRef}
+ status={status}
+ errorMessage={errorMessage}
+ >
+ <div className="grid gap-3 md:grid-cols-3">
+ <div>
+ <FieldLabel htmlFor="traffic-target">Domain</FieldLabel>
+ <input
+ id="traffic-target"
+ name="target"
+ type="text"
+ inputMode="url"
+ autoComplete="off"
+ spellCheck={false}
+ required
+ value={target}
+ onChange={(e) => setTarget(e.target.value)}
+ placeholder="example.com"
+ disabled={status === "loading"}
+ className={`mt-1 ${FIELD_CLASS}`}
+ />
+ </div>
+ <div>
+ <FieldLabel htmlFor="traffic-compare">
+ Compare with (optional)
+ </FieldLabel>
+ <input
+ id="traffic-compare"
+ name="compare"
+ type="text"
+ inputMode="url"
+ autoComplete="off"
+ spellCheck={false}
+ value={compare}
+ onChange={(e) => setCompare(e.target.value)}
+ placeholder="competitor.com"
+ disabled={status === "loading"}
+ className={`mt-1 ${FIELD_CLASS}`}
+ />
+ </div>
+ <div>
+ <FieldLabel htmlFor="traffic-country">Country</FieldLabel>
+ <div className="mt-1">
+ <CountrySelect
+ id="traffic-country"
+ value={locationCode}
+ onChange={setLocationCode}
+ disabled={status === "loading"}
+ />
+ </div>
+ </div>
+ </div>
+ <div className="mt-3">
+ <SubmitButton status={status} idleLabel="Check traffic" />
+ </div>
+ </ToolForm>
+
+ {status === "done" && result ? (
+ <div className="mt-6 space-y-8">
+ {result.comparison ? (
+ <section>
+ <h2 className="text-lg font-semibold text-neutral-950">
+ Compare domains
+ </h2>
+ <ToolTable label="Domain traffic comparison" className="mt-3">
+ <table className="w-full min-w-[520px] text-left text-sm">
+ <thead>
+ <tr className="border-b border-[var(--color-border-subtle)]">
+ <th scope="col" className="px-4 py-3 font-medium">
+ Metric
+ </th>
+ <th
+ scope="col"
+ className="max-w-[240px] break-words px-4 py-3 font-medium"
+ >
+ {result.primary.domain}
+ </th>
+ <th
+ scope="col"
+ className="max-w-[240px] break-words px-4 py-3 font-medium"
+ >
+ {result.comparison.domain}
+ </th>
+ </tr>
+ </thead>
+ <tbody className="divide-y divide-[var(--color-border-subtle)]">
+ {[
+ {
+ label: "Estimated visits / month",
+ key: "organicTraffic" as const,
+ format: formatCount,
+ },
+ {
+ label: "Organic keywords",
+ key: "organicKeywords" as const,
+ format: formatCount,
+ },
+ {
+ label: "Traffic value / month",
+ key: "trafficValue" as const,
+ format: formatMoney,
+ },
+ {
+ label: "Ranking pages",
+ key: "totalPages" as const,
+ format: formatCount,
+ },
+ ].map(({ label, key, format }) => (
+ <tr key={key}>
+ <th
+ scope="row"
+ className="px-4 py-3 font-normal text-neutral-700"
+ >
+ {label}
+ </th>
+ <td className="px-4 py-3 font-semibold tabular-nums">
+ {format(result.primary[key])}
+ </td>
+ <td className="px-4 py-3 font-semibold tabular-nums">
+ {format(result.comparison?.[key])}
+ </td>
+ </tr>
+ ))}
+ </tbody>
+ </table>
+ </ToolTable>
+ <p className="mt-2 text-xs text-[var(--color-brand-muted)]">
+ Traffic is estimated from rankings. Traffic value estimates the
+ monthly cost of equivalent Google Ads clicks.
+ </p>
+ </section>
+ ) : null}
+ <DomainReport
+ data={result.primary}
+ showMetrics={!result.comparison}
+ />
+ {result.comparison ? (
+ <DomainReport data={result.comparison} showMetrics={false} />
+ ) : null}
+ <UpsellCard tool={TOOL} cta="Explore more keywords and pages">
+ The free checker shows the top 5 keywords and pages per domain.
+ OpenSEO lets you browse more keywords and pages, filter the results,
+ and save keywords for rank tracking.
+ </UpsellCard>
+ </div>
+ ) : null}
+ </div>
+ );
+}
+
+function DomainReport({
+ data,
+ showMetrics = true,
+}: {
+ data: DomainTraffic;
+ showMetrics?: boolean;
+}) {
+ return (
+ <section>
+ <h2 className="text-lg font-semibold tracking-tight text-neutral-950">
+ <span className="text-[var(--color-brand-accent)]">{data.domain}</span>
+ </h2>
+
+ {showMetrics ? (
+ <div className="mt-3">
+ <MetricGrid
+ metrics={[
+ {
+ label: "Organic traffic / month",
+ value: formatCount(data.organicTraffic),
+ tip: "DataForSEO's estimated monthly organic visits, derived from the keywords this domain ranks for and their search volume. An estimate, not analytics data.",
+ },
+ {
+ label: "Organic keywords",
+ value: formatCount(data.organicKeywords),
+ tip: "How many keywords this domain ranks for in the selected country's top 100 organic results.",
+ },
+ {
+ label: "Traffic value",
+ value: formatMoney(data.trafficValue),
+ tip: "What this organic traffic would cost per month to buy through Google Ads at current CPCs.",
+ },
+ {
+ label: "Ranking pages",
+ value: formatCount(data.totalPages),
+ tip: "How many pages on this domain rank for at least one keyword in the selected country.",
+ },
+ ]}
+ />
+ </div>
+ ) : null}
+
+ <div className="mt-4 grid gap-4 lg:grid-cols-2">
+ <ToolTable label={`Top keywords for ${data.domain}`}>
+ <table className="w-full min-w-[320px] text-left text-sm">
+ <thead>
+ <tr className="border-b border-[var(--color-border-subtle)] text-xs text-[var(--color-brand-muted)]">
+ <th className="px-4 py-3 font-medium">Top keyword</th>
+ <th className="px-4 py-3 font-medium">Volume</th>
+ <th className="px-4 py-3 font-medium">Position</th>
+ </tr>
+ </thead>
+ <tbody className="divide-y divide-[var(--color-border-subtle)]">
+ {data.topKeywords.map((row) => (
+ <tr key={row.keyword ?? row.url ?? ""}>
+ <td className="max-w-[240px] px-4 py-3 align-top">
+ <p className="truncate font-medium text-neutral-950">
+ {row.keyword ?? "—"}
+ </p>
+ {row.url ? (
+ <p className="truncate text-xs text-[var(--color-brand-muted)]">
+ {row.url}
+ </p>
+ ) : null}
+ </td>
+ <td className="px-4 py-3 align-top tabular-nums text-neutral-700">
+ {formatCount(row.searchVolume)}
+ </td>
+ <td className="px-4 py-3 align-top tabular-nums text-neutral-700">
+ {formatCount(row.position)}
+ </td>
+ </tr>
+ ))}
+ {data.topKeywords.length === 0 ? (
+ <tr>
+ <td
+ colSpan={3}
+ className="px-4 py-4 text-sm text-neutral-700"
+ >
+ No ranking keywords found for this country.
+ </td>
+ </tr>
+ ) : null}
+ </tbody>
+ </table>
+ </ToolTable>
+
+ <ToolTable label={`Top pages for ${data.domain}`}>
+ <table className="w-full min-w-[320px] text-left text-sm">
+ <thead>
+ <tr className="border-b border-[var(--color-border-subtle)] text-xs text-[var(--color-brand-muted)]">
+ <th className="px-4 py-3 font-medium">Top page</th>
+ <th className="px-4 py-3 font-medium">Traffic</th>
+ <th className="px-4 py-3 font-medium">Keywords</th>
+ </tr>
+ </thead>
+ <tbody className="divide-y divide-[var(--color-border-subtle)]">
+ {data.topPages.map((row) => (
+ <tr key={row.url ?? ""}>
+ <td className="max-w-[240px] truncate px-4 py-3 align-top text-neutral-950">
+ {row.url ?? "—"}
+ </td>
+ <td className="px-4 py-3 align-top tabular-nums text-neutral-700">
+ {formatCount(row.traffic)}
+ </td>
+ <td className="px-4 py-3 align-top tabular-nums text-neutral-700">
+ {formatCount(row.keywords)}
+ </td>
+ </tr>
+ ))}
+ {data.topPages.length === 0 ? (
+ <tr>
+ <td
+ colSpan={3}
+ className="px-4 py-4 text-sm text-neutral-700"
+ >
+ No ranking pages found for this country.
+ </td>
+ </tr>
+ ) : null}
+ </tbody>
+ </table>
+ </ToolTable>
+ </div>
+ </section>
+ );
+}
diff --git a/web/src/lib/feature-pages.ts b/web/src/lib/feature-pages.ts
index 3a8710b6..1d555569 100644
--- a/web/src/lib/feature-pages.ts
+++ b/web/src/lib/feature-pages.ts
@@ -100,6 +100,12 @@ export const featurePages = {
"DataForSEO-backed metrics without locking the research process into a black box.",
"MCP access so AI agents can research and save keywords for you.",
],
+ featuredLink: {
+ title: "Free competitor analysis tool",
+ description:
+ "Pull a competitor's top organic keywords and the terms they rank for that you don't. No signup required.",
+ href: "/competitor-analysis",
+ },
related: [
{ label: "Keyword Clustering", href: "/docs/skills/keyword-clustering" },
{
@@ -210,6 +216,12 @@ export const featurePages = {
"Open-source implementation for teams that want to inspect or extend the audit flow.",
"Simple reports that expose page-level signals and optional Lighthouse findings instead of relying only on a generic score.",
],
+ featuredLink: {
+ title: "Free SERP simulator",
+ description:
+ "Preview how a title and meta description render on Google, with pixel widths. No signup required.",
+ href: "/serp-simulator",
+ },
related: [
{ label: "Domain Overview", href: "/features/domain-overview" },
{ label: "Backlinks", href: "/features/backlink-checker" },
@@ -353,7 +365,6 @@ export const featurePages = {
href: "/docs/skills/link-prospecting",
},
{ label: "Domain Overview", href: "/features/domain-overview" },
- { label: "OpenSEO MCP", href: "/features/mcp" },
],
faqs: [
{
@@ -423,6 +434,12 @@ export const featurePages = {
"Built around ranking keywords, estimated traffic, and top pages for practical competitor research.",
"Open-source and self-hostable for teams that want control over their SEO stack.",
],
+ featuredLink: {
+ title: "Free website traffic checker",
+ description:
+ "Estimate any domain's organic traffic, keywords, and top pages. No signup required.",
+ href: "/website-traffic-checker",
+ },
related: [
{
label: "Competitor Analysis",
@@ -539,6 +556,12 @@ export const featurePages = {
"Optional desktop and mobile tracking helps teams avoid one-dimensional rank reports.",
"OpenSEO can expose ranking data to AI agents through MCP.",
],
+ featuredLink: {
+ title: "Free competitor keyword finder",
+ description:
+ "Find the keywords a competitor ranks for before choosing what to track. No signup required.",
+ href: "/competitor-keyword-finder",
+ },
related: [
{ label: "Keyword Clustering", href: "/docs/skills/keyword-clustering" },
{
diff --git a/web/src/lib/free-tools/analytics.ts b/web/src/lib/free-tools/analytics.ts
new file mode 100644
index 00000000..97ee7495
--- /dev/null
+++ b/web/src/lib/free-tools/analytics.ts
@@ -0,0 +1,18 @@
+type PlausibleEvent = "tool_run" | "tool_result" | "tool_cta_click";
+
+/**
+ * Plausible is loaded lazily through the first-party proxy in __root.tsx, so
+ * `window.plausible` may not exist yet (or at all, with an ad blocker). Every
+ * call is optional — analytics must never break a tool.
+ */
+export function trackTool(event: PlausibleEvent, tool: string) {
+ if (typeof window === "undefined") return;
+ (
+ window as unknown as {
+ plausible?: (
+ name: string,
+ options?: { props?: Record<string, string> },
+ ) => void;
+ }
+ ).plausible?.(event, { props: { tool } });
+}
diff --git a/web/src/lib/free-tools/budget.ts b/web/src/lib/free-tools/budget.ts
new file mode 100644
index 00000000..d31ae4e9
--- /dev/null
+++ b/web/src/lib/free-tools/budget.ts
@@ -0,0 +1,138 @@
+import { DurableObject } from "cloudflare:workers";
+import { z } from "zod";
+import {
+ ALL_TOOLS_CALLS_PER_DAY,
+ dataforseoCallsPerDay,
+ PER_IP_CALLS_PER_DAY,
+ reservedMicroDollarsPerCall,
+} from "./spend";
+
+const reservationSchema = z.object({
+ tool: z.enum([
+ "backlink-checker",
+ "competitor-keyword-finder",
+ "keyword-generator",
+ "website-traffic-checker",
+ "competitor-analysis",
+ "spam-score-checker",
+ ]),
+ calls: z.number().int().min(1).max(6),
+ visitor: z.string().regex(/^[a-f0-9]{64}$/),
+ day: z.string().regex(/^\d{4}-\d{2}-\d{2}$/),
+});
+
+export type BudgetReservation = z.infer<typeof reservationSchema>;
+type BudgetDecision = "allowed" | "visitor" | "tool" | "daily";
+
+type BudgetEnv = { FREE_TOOLS_DAILY_BUDGET_USD: string };
+
+/** One coordination object per UTC day's paid cache misses, not per request. */
+export class FreeToolBudget extends DurableObject<BudgetEnv> {
+ constructor(ctx: DurableObjectState, env: BudgetEnv) {
+ super(ctx, env);
+ ctx.storage.sql.exec(`CREATE TABLE IF NOT EXISTS counters (
+ key TEXT PRIMARY KEY, calls INTEGER NOT NULL, micro_dollars INTEGER NOT NULL
+ )`);
+ }
+
+ async reserve(input: BudgetReservation): Promise<BudgetDecision> {
+ const { tool, calls, visitor, day } = reservationSchema.parse(input);
+ const dollars = Number(this.env.FREE_TOOLS_DAILY_BUDGET_USD);
+ if (
+ !Number.isFinite(dollars) ||
+ dollars < 0 ||
+ !this.env.FREE_TOOLS_DAILY_BUDGET_USD?.trim()
+ ) {
+ throw new Error("Missing or invalid free tools daily budget");
+ }
+ // Old daily objects and their hashed visitor counters expire automatically.
+ if ((await this.ctx.storage.getAlarm()) === null) {
+ await this.ctx.storage.setAlarm(
+ Date.parse(`${day}T00:00:00Z`) + 3 * 86_400_000,
+ );
+ }
+ // Fail closed if an RPC crossed midnight; never charge tomorrow's work
+ // against yesterday's separate object.
+ if (day !== new Date().toISOString().slice(0, 10)) {
+ throw new Error("Budget reservation crossed UTC midnight; retry");
+ }
+ const cost = reservedMicroDollarsPerCall[tool] * calls;
+ return this.ctx.storage.transactionSync(() => {
+ const counters = [
+ {
+ key: "all",
+ ceiling: ALL_TOOLS_CALLS_PER_DAY,
+ reason: "daily" as const,
+ },
+ {
+ key: `tool:${tool}`,
+ ceiling: dataforseoCallsPerDay[tool],
+ reason: "tool" as const,
+ },
+ {
+ key: `visitor:${visitor}`,
+ ceiling: PER_IP_CALLS_PER_DAY,
+ reason: "visitor" as const,
+ },
+ ];
+ for (const counter of counters) {
+ const previous = this.ctx.storage.sql
+ .exec<{
+ calls: number;
+ micro_dollars: number;
+ }>(
+ "SELECT calls, micro_dollars FROM counters WHERE key = ?",
+ counter.key,
+ )
+ .toArray()[0];
+ if ((previous?.calls ?? 0) + calls > counter.ceiling) {
+ console.warn(
+ JSON.stringify({
+ event: "free_tool_limit_reached",
+ limit: `${counter.reason}_calls`,
+ tool,
+ day,
+ usedCalls: previous?.calls ?? 0,
+ requestedCalls: calls,
+ limitCalls: counter.ceiling,
+ }),
+ );
+ return counter.reason;
+ }
+ if (
+ counter.key === "all" &&
+ (previous?.micro_dollars ?? 0) + cost >
+ Math.floor(dollars * 1_000_000)
+ ) {
+ console.warn(
+ JSON.stringify({
+ event: "free_tool_limit_reached",
+ limit: "daily_spend",
+ tool,
+ day,
+ usedEstimatedUsd: (previous?.micro_dollars ?? 0) / 1_000_000,
+ requestedEstimatedUsd: cost / 1_000_000,
+ limitUsd: dollars,
+ }),
+ );
+ return "daily";
+ }
+ }
+ for (const counter of counters) {
+ this.ctx.storage.sql.exec(
+ `INSERT INTO counters (key, calls, micro_dollars) VALUES (?, ?, ?)
+ ON CONFLICT(key) DO UPDATE SET calls = calls + excluded.calls,
+ micro_dollars = micro_dollars + excluded.micro_dollars`,
+ counter.key,
+ calls,
+ cost,
+ );
+ }
+ return "allowed";
+ });
+ }
+
+ async alarm() {
+ await this.ctx.storage.deleteAll();
+ }
+}
diff --git a/web/src/lib/free-tools/countries.ts b/web/src/lib/free-tools/countries.ts
new file mode 100644
index 00000000..0ca0f652
--- /dev/null
+++ b/web/src/lib/free-tools/countries.ts
@@ -0,0 +1,32 @@
+/**
+ * The countries the free tools offer. Codes are DataForSEO location codes;
+ * the language is the one DataForSEO expects for that market. The client only
+ * ever sends a location code — the server derives the language from this list,
+ * so an unknown code is rejected rather than passed through.
+ */
+export const TOOL_COUNTRIES = [
+ { code: 2840, label: "United States", language: "en" },
+ { code: 2826, label: "United Kingdom", language: "en" },
+ { code: 2124, label: "Canada", language: "en" },
+ { code: 2036, label: "Australia", language: "en" },
+ { code: 2276, label: "Germany", language: "de" },
+ { code: 2250, label: "France", language: "fr" },
+ { code: 2724, label: "Spain", language: "es" },
+ { code: 2356, label: "India", language: "en" },
+ { code: 2528, label: "Netherlands", language: "nl" },
+ { code: 2076, label: "Brazil", language: "pt" },
+] as const;
+
+export const DEFAULT_COUNTRY_CODE = 2840;
+
+export function countryLanguage(code: number): string | null {
+ return (
+ TOOL_COUNTRIES.find((country) => country.code === code)?.language ?? null
+ );
+}
+
+export function countryLabel(code: number): string {
+ return (
+ TOOL_COUNTRIES.find((country) => country.code === code)?.label ?? "Unknown"
+ );
+}
diff --git a/web/src/lib/free-tools/form.tsx b/web/src/lib/free-tools/form.tsx
new file mode 100644
index 00000000..2de42d02
--- /dev/null
+++ b/web/src/lib/free-tools/form.tsx
@@ -0,0 +1,121 @@
+import type { FormEvent, ReactNode, RefObject } from "react";
+import { TOOL_COUNTRIES } from "@/lib/free-tools/countries";
+
+export type ToolStatus = "idle" | "loading" | "done" | "error";
+
+export const FIELD_CLASS =
+ "h-11 w-full min-w-0 rounded-lg border border-[var(--color-border-subtle)] bg-white px-3.5 text-base text-neutral-900 placeholder:text-neutral-500 transition focus:border-neutral-900 focus:outline-none focus:ring-1 focus:ring-neutral-900";
+
+export function FieldLabel({
+ htmlFor,
+ children,
+}: {
+ htmlFor: string;
+ children: ReactNode;
+}) {
+ return (
+ <label
+ htmlFor={htmlFor}
+ className="block text-xs font-medium text-[var(--color-brand-muted)]"
+ >
+ {children}
+ </label>
+ );
+}
+
+export function CountrySelect({
+ id,
+ value,
+ onChange,
+ disabled,
+}: {
+ id: string;
+ value: number;
+ onChange: (code: number) => void;
+ disabled?: boolean;
+}) {
+ return (
+ <select
+ id={id}
+ name="country"
+ value={value}
+ disabled={disabled}
+ onChange={(event) => onChange(Number(event.target.value))}
+ className={FIELD_CLASS}
+ >
+ {TOOL_COUNTRIES.map((country) => (
+ <option key={country.code} value={country.code}>
+ {country.label}
+ </option>
+ ))}
+ </select>
+ );
+}
+
+export function SubmitButton({
+ status,
+ idleLabel,
+ loadingLabel = "Checking…",
+}: {
+ status: ToolStatus;
+ idleLabel: string;
+ loadingLabel?: string;
+}) {
+ return (
+ <button
+ type="submit"
+ disabled={status === "loading"}
+ className="h-11 shrink-0 rounded-lg bg-neutral-950 px-6 text-sm font-medium text-white transition-colors hover:bg-neutral-800 disabled:opacity-50"
+ >
+ {status === "loading" ? loadingLabel : idleLabel}
+ </button>
+ );
+}
+
+/**
+ * The card every tool form lives in: fields, the invisible Turnstile mount,
+ * the "Free · No signup" microcopy, and the error line.
+ */
+export function ToolForm({
+ onSubmit,
+ turnstileRef,
+ status,
+ errorMessage,
+ cacheDuration = "24 hours",
+ children,
+}: {
+ onSubmit: (event: FormEvent) => void;
+ turnstileRef?: RefObject<HTMLDivElement | null>;
+ status: ToolStatus;
+ errorMessage: string;
+ cacheDuration?: string;
+ children: ReactNode;
+}) {
+ return (
+ <form
+ onSubmit={onSubmit}
+ className="rounded-xl border border-[var(--color-border-subtle)] bg-white p-4 md:p-5"
+ >
+ {children}
+ {turnstileRef ? (
+ <div ref={turnstileRef} className="empty:hidden" />
+ ) : null}
+ <p className="mt-2.5 text-xs text-[var(--color-brand-muted)]">
+ Free &middot; No signup
+ </p>
+ {status === "error" && errorMessage ? (
+ <p role="alert" className="mt-2 text-sm text-red-600">
+ {errorMessage}
+ </p>
+ ) : null}
+ {status === "done" ? (
+ <p
+ role="status"
+ className="mt-2 text-xs text-[var(--color-brand-muted)]"
+ >
+ Results may be cached for up to {cacheDuration}.
+ </p>
+ ) : null}
+ </form>
+ );
+}
diff --git a/web/src/lib/free-tools/free-tool-paths.js b/web/src/lib/free-tools/free-tool-paths.js
new file mode 100644
index 00000000..5254404f
--- /dev/null
+++ b/web/src/lib/free-tools/free-tool-paths.js
@@ -0,0 +1,12 @@
+// Plain JS so scripts/generate-sitemap.js can import it without a TS step.
+// Keys are the tool slugs used for routes, cache keys, and budget counters.
+export const FREE_TOOL_PATHS = {
+ "backlink-checker": "/backlink-checker",
+ "competitor-keyword-finder": "/competitor-keyword-finder",
+ "keyword-generator": "/keyword-generator",
+ "website-traffic-checker": "/website-traffic-checker",
+ "competitor-analysis": "/competitor-analysis",
+ "spam-score-checker": "/spam-score-checker",
+ "domain-age-checker": "/domain-age-checker",
+ "serp-simulator": "/serp-simulator",
+};
diff --git a/web/src/lib/free-tools/keyword-table.tsx b/web/src/lib/free-tools/keyword-table.tsx
new file mode 100644
index 00000000..131fa8b7
--- /dev/null
+++ b/web/src/lib/free-tools/keyword-table.tsx
@@ -0,0 +1,80 @@
+import { ToolTable } from "./tool-table";
+import { formatCount } from "./metric-grid";
+import type { RankedKeywordRow as KeywordRow } from "./labs";
+
+export function KeywordTable({
+ rows,
+ showTraffic = false,
+}: {
+ rows: Array<KeywordRow & { traffic?: number | null }>;
+ showTraffic?: boolean;
+}) {
+ if (rows.length === 0) {
+ return (
+ <p className="mt-3 rounded-lg border border-[var(--color-border-subtle)] bg-white p-5 text-sm text-neutral-700">
+ No ranking keywords found in the available data for this country.
+ </p>
+ );
+ }
+
+ return (
+ <ToolTable
+ label={
+ showTraffic ? "Competitor-only keywords" : "Competitor top keywords"
+ }
+ className="mt-3"
+ >
+ <table className="w-full min-w-[640px] text-left text-sm">
+ <thead>
+ <tr className="border-b border-[var(--color-border-subtle)] text-xs text-[var(--color-brand-muted)]">
+ <th className="px-4 py-3 font-medium">Keyword</th>
+ <th className="px-4 py-3 font-medium">Volume</th>
+ <th className="px-4 py-3 font-medium">Difficulty</th>
+ <th className="px-4 py-3 font-medium">Position</th>
+ {showTraffic ? (
+ <th className="px-4 py-3 font-medium">Traffic</th>
+ ) : null}
+ <th className="px-4 py-3 font-medium">Ranking URL</th>
+ </tr>
+ </thead>
+ <tbody className="divide-y divide-[var(--color-border-subtle)]">
+ {rows.map((row) => (
+ <tr key={`${row.keyword}-${row.url}`}>
+ <td className="max-w-[240px] truncate px-4 py-3 align-top font-medium text-neutral-950">
+ {row.keyword ?? "—"}
+ </td>
+ <td className="px-4 py-3 align-top tabular-nums text-neutral-700">
+ {formatCount(row.searchVolume)}
+ </td>
+ <td className="px-4 py-3 align-top tabular-nums text-neutral-700">
+ {formatCount(row.difficulty)}
+ </td>
+ <td className="px-4 py-3 align-top tabular-nums text-neutral-700">
+ {formatCount(row.position)}
+ </td>
+ {showTraffic ? (
+ <td className="px-4 py-3 align-top tabular-nums text-neutral-700">
+ {formatCount(row.traffic ?? null)}
+ </td>
+ ) : null}
+ <td className="max-w-[260px] px-4 py-3 align-top">
+ {row.url ? (
+ <a
+ href={row.url}
+ target="_blank"
+ rel="nofollow noopener noreferrer"
+ className="block truncate text-xs text-[var(--color-brand-muted)] hover:text-neutral-900 hover:underline"
+ >
+ {row.url}
+ </a>
+ ) : (
+ "—"
+ )}
+ </td>
+ </tr>
+ ))}
+ </tbody>
+ </table>
+ </ToolTable>
+ );
+}
diff --git a/web/src/lib/free-tools/labs.ts b/web/src/lib/free-tools/labs.ts
new file mode 100644
index 00000000..604c0ce0
--- /dev/null
+++ b/web/src/lib/free-tools/labs.ts
@@ -0,0 +1,149 @@
+import { z } from "zod";
+
+/** DataForSEO Labs response parsers shared by the free research tools. */
+
+const organicMetricsSchema = z
+ .object({
+ metrics: z
+ .object({
+ organic: z
+ .object({
+ etv: z.number().nullable().optional(),
+ count: z.number().nullable().optional(),
+ estimated_paid_traffic_cost: z.number().nullable().optional(),
+ })
+ .passthrough()
+ .nullable()
+ .optional(),
+ })
+ .passthrough()
+ .nullable()
+ .optional(),
+ })
+ .passthrough();
+
+export type OrganicMetrics = {
+ organicTraffic: number | null;
+ organicKeywords: number | null;
+ trafficValue: number | null;
+};
+
+/** `domain_rank_overview` returns one item; `relevant_pages` items share the shape. */
+export function readOrganicMetrics(input: unknown): OrganicMetrics {
+ const organic = organicMetricsSchema.parse(input ?? {}).metrics?.organic;
+ return {
+ organicTraffic: organic?.etv != null ? Math.round(organic.etv) : null,
+ organicKeywords: organic?.count != null ? Math.round(organic.count) : null,
+ trafficValue:
+ organic?.estimated_paid_traffic_cost != null
+ ? Math.round(organic.estimated_paid_traffic_cost)
+ : null,
+ };
+}
+
+const rankedKeywordSchema = z
+ .object({
+ keyword_data: z
+ .object({
+ keyword: z.string().nullable().optional(),
+ keyword_info: z
+ .object({ search_volume: z.number().nullable().optional() })
+ .passthrough()
+ .nullable()
+ .optional(),
+ keyword_properties: z
+ .object({ keyword_difficulty: z.number().nullable().optional() })
+ .passthrough()
+ .nullable()
+ .optional(),
+ })
+ .passthrough()
+ .nullable()
+ .optional(),
+ ranked_serp_element: z
+ .object({
+ serp_item: z
+ .object({
+ rank_group: z.number().nullable().optional(),
+ rank_absolute: z.number().nullable().optional(),
+ url: z.string().nullable().optional(),
+ etv: z.number().nullable().optional(),
+ })
+ .passthrough()
+ .nullable()
+ .optional(),
+ })
+ .passthrough()
+ .nullable()
+ .optional(),
+ })
+ .passthrough();
+
+export type RankedKeywordRow = {
+ keyword: string | null;
+ searchVolume: number | null;
+ difficulty: number | null;
+ position: number | null;
+ url: string | null;
+};
+
+export function readRankedKeyword(input: unknown): RankedKeywordRow {
+ const item = rankedKeywordSchema.parse(input ?? {});
+ const serpItem = item.ranked_serp_element?.serp_item;
+ return {
+ keyword: item.keyword_data?.keyword ?? null,
+ searchVolume: item.keyword_data?.keyword_info?.search_volume ?? null,
+ difficulty:
+ item.keyword_data?.keyword_properties?.keyword_difficulty ?? null,
+ position: serpItem?.rank_group ?? serpItem?.rank_absolute ?? null,
+ url: serpItem?.url ?? null,
+ };
+}
+
+const relevantPageSchema = z
+ .object({ page_address: z.string().nullable().optional() })
+ .passthrough();
+
+export type RelevantPageRow = {
+ url: string | null;
+ traffic: number | null;
+ keywords: number | null;
+};
+
+export function readRelevantPage(input: unknown): RelevantPageRow {
+ const metrics = readOrganicMetrics(input);
+ return {
+ url: relevantPageSchema.parse(input ?? {}).page_address ?? null,
+ traffic: metrics.organicTraffic,
+ keywords: metrics.organicKeywords,
+ };
+}
+
+/** Order ranked keywords by the traffic the ranking page earns. */
+export const RANKED_KEYWORDS_ORDER = ["ranked_serp_element.serp_item.etv,desc"];
+export const RELEVANT_PAGES_ORDER = ["metrics.organic.etv,desc"];
+
+const keywordIdeaSchema = z.object({
+ keyword: z.string(),
+ keyword_info: z
+ .object({ search_volume: z.number().nullable().optional() })
+ .nullable()
+ .optional(),
+ keyword_properties: z
+ .object({ keyword_difficulty: z.number().nullable().optional() })
+ .nullable()
+ .optional(),
+});
+export type KeywordIdea = {
+ keyword: string;
+ searchVolume: number | null;
+ difficulty: number | null;
+};
+export function readKeywordIdea(input: unknown): KeywordIdea {
+ const item = keywordIdeaSchema.parse(input);
+ return {
+ keyword: item.keyword,
+ searchVolume: item.keyword_info?.search_volume ?? null,
+ difficulty: item.keyword_properties?.keyword_difficulty ?? null,
+ };
+}
diff --git a/web/src/lib/free-tools/metric-grid.tsx b/web/src/lib/free-tools/metric-grid.tsx
new file mode 100644
index 00000000..a315c0a4
--- /dev/null
+++ b/web/src/lib/free-tools/metric-grid.tsx
@@ -0,0 +1,87 @@
+import * as Popover from "@radix-ui/react-popover";
+
+export function formatCount(value: number | null | undefined): string {
+ return typeof value === "number"
+ ? Math.round(value).toLocaleString("en-US")
+ : "—";
+}
+
+export function formatMoney(value: number | null | undefined): string {
+ if (typeof value !== "number") return "—";
+ return `$${Math.round(value).toLocaleString("en-US")}`;
+}
+
+/** Tap or click for details; the portal keeps help outside clipped cards. */
+export function InfoTip({
+ tip,
+ align = "center",
+}: {
+ tip: string;
+ align?: "center" | "right";
+}) {
+ return (
+ <Popover.Root>
+ <Popover.Trigger asChild>
+ <button
+ type="button"
+ aria-label={tip}
+ className="ml-0.5 inline-flex h-7 w-7 items-center justify-center rounded-full align-middle text-neutral-500 hover:bg-neutral-100 hover:text-neutral-900 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-900"
+ >
+ <svg
+ viewBox="0 0 16 16"
+ fill="none"
+ aria-hidden="true"
+ className="h-3.5 w-3.5"
+ >
+ <circle cx="8" cy="8" r="6.5" stroke="currentColor" />
+ <path
+ d="M8 7.25v3.25M8 5.25v.1"
+ stroke="currentColor"
+ strokeWidth="1.4"
+ strokeLinecap="round"
+ />
+ </svg>
+ </button>
+ </Popover.Trigger>
+ <Popover.Portal>
+ <Popover.Content
+ aria-label="More information"
+ sideOffset={6}
+ collisionPadding={12}
+ align={align === "right" ? "end" : "center"}
+ className="z-[60] w-64 max-w-[calc(100vw-24px)] rounded-lg bg-neutral-950 px-4 py-3 text-left text-sm font-normal leading-6 text-white shadow-lg"
+ >
+ {tip}
+ </Popover.Content>
+ </Popover.Portal>
+ </Popover.Root>
+ );
+}
+
+type Metric = {
+ label: string;
+ value: string;
+ tip?: string;
+};
+
+/** Stack on narrow phones, then use two or four columns as space allows. */
+export function MetricGrid({ metrics }: { metrics: Metric[] }) {
+ return (
+ <dl className="grid grid-cols-1 gap-px overflow-hidden rounded-lg border border-[var(--color-border-subtle)] bg-[var(--color-border-subtle)] min-[360px]:grid-cols-2 md:grid-cols-4">
+ {metrics.map((metric) => (
+ <div
+ key={metric.label}
+ className="min-w-0 bg-white p-4 [overflow-wrap:anywhere] md:p-5"
+ >
+ <dt className="text-xs text-[var(--color-brand-muted)]">
+ {metric.label}
+ {metric.tip ? <InfoTip tip={metric.tip} /> : null}
+ </dt>
+ <dd className="mt-1 text-lg font-semibold tabular-nums text-neutral-950 sm:text-xl">
+ {metric.value}
+ </dd>
+ </div>
+ ))}
+ </dl>
+ );
+}
diff --git a/web/src/lib/free-tools/server.ts b/web/src/lib/free-tools/server.ts
new file mode 100644
index 00000000..727772c0
--- /dev/null
+++ b/web/src/lib/free-tools/server.ts
@@ -0,0 +1,347 @@
+import { env } from "cloudflare:workers";
+import { z } from "zod";
+import { dataforseoCallsPerDay } from "@/lib/free-tools/spend";
+import type {
+ FreeToolBudget,
+ BudgetReservation,
+} from "@/lib/free-tools/budget";
+import type { FreeToolSlug } from "@/lib/free-tools/tool-pages";
+
+const DATAFORSEO_BASE = "https://api.dataforseo.com";
+
+/** Every free tool shares the same per-visitor rate limiter. */
+type RateLimiter = {
+ limit(options: { key: string }): Promise<{ success: boolean }>;
+};
+
+type Bindings = {
+ DATAFORSEO_API_KEY?: string;
+ TURNSTILE_SECRET_KEY?: string;
+ BACKLINK_CHECK_RATE_LIMIT?: RateLimiter;
+ FREE_TOOL_BUDGET?: DurableObjectNamespace<FreeToolBudget>;
+};
+
+function bindings(): Bindings {
+ return env as unknown as Bindings;
+}
+
+export function normalizeDomain(input: string): string | null {
+ let hostname: string;
+ try {
+ hostname = new URL(input.includes("://") ? input : `https://${input}`)
+ .hostname;
+ } catch {
+ return null;
+ }
+ const domain = hostname.replace(/^www\./, "").toLowerCase();
+ const isValid =
+ /^(?=.{1,253}$)[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$/.test(
+ domain,
+ );
+ return isValid ? domain : null;
+}
+
+export function jsonResponse(
+ data: unknown,
+ status = 200,
+ headers?: HeadersInit,
+) {
+ return new Response(JSON.stringify(data), {
+ status,
+ headers: { "Content-Type": "application/json", ...headers },
+ });
+}
+
+export function cacheableJson(data: unknown, maxAgeSeconds: number) {
+ return jsonResponse(data, 200, {
+ "Cache-Control": `public, max-age=${maxAgeSeconds}`,
+ });
+}
+
+/** Shared 502 shape. Short max-age so a failing target isn't retried in a loop. */
+export function failureResponse(message: string) {
+ return jsonResponse({ error: message }, 502, {
+ "Cache-Control": "public, max-age=120",
+ });
+}
+
+export function dataforseoKey(): string | undefined {
+ return bindings().DATAFORSEO_API_KEY;
+}
+
+export function serviceUnavailable(tool: string) {
+ console.error(`Missing DATAFORSEO_API_KEY for ${tool}`);
+ return jsonResponse({ error: "Service temporarily unavailable" }, 503);
+}
+
+const UNAVAILABLE =
+ "This tool is temporarily unavailable. Please try again later.";
+const turnstileResultSchema = z.object({
+ success: z.boolean(),
+ hostname: z.string().optional(),
+ action: z.string().optional(),
+});
+
+/** Bound the bytes read, including requests without Content-Length. */
+export async function readToolBody(
+ request: Request,
+): Promise<unknown | Response> {
+ if (
+ !request.headers
+ .get("content-type")
+ ?.toLowerCase()
+ .startsWith("application/json")
+ ) {
+ return jsonResponse({ error: "Send a JSON request" }, 415);
+ }
+ const reader = request.body?.getReader();
+ if (!reader) return jsonResponse({ error: "Invalid request" }, 400);
+ const chunks: Uint8Array[] = [];
+ let size = 0;
+ try {
+ while (true) {
+ const { value, done } = await reader.read();
+ if (done) break;
+ size += value.byteLength;
+ if (size > 16_384) {
+ await reader.cancel();
+ return jsonResponse({ error: "Request is too large" }, 413);
+ }
+ chunks.push(value);
+ }
+ const bytes = new Uint8Array(size);
+ let offset = 0;
+ for (const chunk of chunks) {
+ bytes.set(chunk, offset);
+ offset += chunk.length;
+ }
+ return JSON.parse(new TextDecoder().decode(bytes));
+ } catch {
+ return jsonResponse({ error: "Invalid JSON request" }, 400);
+ } finally {
+ reader.releaseLock();
+ }
+}
+
+/** Production protection must be present; development bypass is build-time only. */
+export async function guardToolRequest(input: {
+ tool: string;
+ request: Request;
+ turnstileToken?: string;
+}): Promise<Response | null> {
+ const { TURNSTILE_SECRET_KEY, BACKLINK_CHECK_RATE_LIMIT } = bindings();
+ const url = new URL(input.request.url);
+ const origin = input.request.headers.get("origin");
+ if (origin && origin !== url.origin) {
+ return jsonResponse(
+ { error: "Cross-site submissions are not allowed" },
+ 403,
+ );
+ }
+ const ip = input.request.headers.get("cf-connecting-ip");
+ const secret = TURNSTILE_SECRET_KEY?.trim();
+ if (
+ !import.meta.env.DEV &&
+ (!secret || /^[123]x0+/.test(secret) || !BACKLINK_CHECK_RATE_LIMIT || !ip)
+ ) {
+ console.error(`Missing production abuse protection for ${input.tool}`);
+ return jsonResponse({ error: UNAVAILABLE }, 503);
+ }
+ // Across all tools, before Siteverify, so switching tools cannot reset the
+ // allowance and invalid tokens cannot flood the verification service.
+ if (BACKLINK_CHECK_RATE_LIMIT) {
+ try {
+ const { success } = await BACKLINK_CHECK_RATE_LIMIT.limit({
+ key: `free-tools:${ip ?? "local"}`,
+ });
+ if (!success)
+ return jsonResponse(
+ { error: "Too many checks. Try again in a minute." },
+ 429,
+ { "Retry-After": "60" },
+ );
+ } catch {
+ return jsonResponse({ error: UNAVAILABLE }, 503);
+ }
+ }
+ if (!secret && import.meta.env.DEV) return null;
+ if (!input.turnstileToken || input.turnstileToken.length > 2048) {
+ return jsonResponse(
+ { error: "Human verification failed. Refresh the page and try again." },
+ 403,
+ );
+ }
+ try {
+ const body = new URLSearchParams({
+ secret: secret!,
+ response: input.turnstileToken,
+ });
+ if (ip) body.set("remoteip", ip);
+ const response = await fetch(
+ "https://challenges.cloudflare.com/turnstile/v0/siteverify",
+ {
+ method: "POST",
+ body,
+ signal: AbortSignal.timeout(5_000),
+ },
+ );
+ if (!response.ok) return jsonResponse({ error: UNAVAILABLE }, 503);
+ const result = turnstileResultSchema.safeParse(await response.json());
+ if (
+ !result.success ||
+ !result.data.success ||
+ result.data.hostname !== url.hostname ||
+ result.data.action !== "free_tool"
+ ) {
+ return jsonResponse(
+ { error: "Human verification failed. Refresh the page and try again." },
+ 403,
+ );
+ }
+ return null;
+ } catch {
+ return jsonResponse({ error: UNAVAILABLE }, 503);
+ }
+}
+
+/** Reserve the entire uncached run before the first paid call. Never fail open. */
+export async function chargeToolBudget(input: {
+ tool: FreeToolSlug;
+ request: Request;
+ calls: number;
+}): Promise<Response | null> {
+ if (dataforseoCallsPerDay[input.tool] === null || input.calls <= 0)
+ return null;
+ const namespace = bindings().FREE_TOOL_BUDGET;
+ if (!namespace) return jsonResponse({ error: UNAVAILABLE }, 503);
+ try {
+ const day = new Date().toISOString().slice(0, 10);
+ const ip = input.request.headers.get("cf-connecting-ip") ?? "local";
+ // Date-scoped hash avoids storing raw IPs; it is not an anonymity guarantee.
+ const digest = await crypto.subtle.digest(
+ "SHA-256",
+ new TextEncoder().encode(`${day}:${ip}`),
+ );
+ const visitor = Array.from(new Uint8Array(digest), (byte) =>
+ byte.toString(16).padStart(2, "0"),
+ ).join("");
+ const decision = await namespace.getByName(day).reserve({
+ tool: input.tool as BudgetReservation["tool"],
+ calls: input.calls,
+ visitor,
+ day,
+ });
+ if (decision === "allowed") return null;
+ const message =
+ decision === "visitor"
+ ? "You've hit today's free limit. Sign up for the full workspace."
+ : "This free tool has reached today's limit. Try again tomorrow, or sign up for OpenSEO to keep researching.";
+ return jsonResponse({ error: message }, 429);
+ } catch (err) {
+ console.error(`Free tool budget unavailable (${input.tool}):`, err);
+ return jsonResponse({ error: UNAVAILABLE }, 503);
+ }
+}
+
+// ---------------------------------------------------------------------------
+// Per-key result cache (Cloudflare Cache API, per colo). Stores parsed results
+// and short-lived failures so repeated lookups avoid another provider call.
+// ---------------------------------------------------------------------------
+
+type CachedEnvelope<T> = { ok: true; data: T } | { ok: false; error: string };
+
+function cacheStore(): Cache {
+ return (caches as unknown as { default: Cache }).default;
+}
+
+function cacheRequest(tool: string, key: string): Request {
+ return new Request(
+ `https://openseo.so/api/${tool}/${encodeURIComponent(key)}`,
+ );
+}
+
+export async function readCached<T>(
+ tool: string,
+ key: string,
+): Promise<CachedEnvelope<T> | null> {
+ const hit = await cacheStore().match(cacheRequest(tool, key));
+ if (!hit) return null;
+ return (await hit.json().catch(() => null)) as CachedEnvelope<T> | null;
+}
+
+export async function writeCached(
+ tool: string,
+ key: string,
+ envelope: CachedEnvelope<unknown>,
+ ttlSeconds: number,
+): Promise<void> {
+ const body = jsonResponse(envelope, 200, {
+ "Cache-Control": `public, max-age=${ttlSeconds}`,
+ });
+ await cacheStore()
+ .put(cacheRequest(tool, key), body)
+ .catch(() => {});
+}
+
+// ---------------------------------------------------------------------------
+// DataForSEO
+// ---------------------------------------------------------------------------
+
+// DataForSEO task envelope: HTTP 200 with per-task status codes; 20000 = ok.
+const taskEnvelopeSchema = z.object({
+ tasks: z
+ .array(
+ z
+ .object({
+ status_code: z.number().optional(),
+ status_message: z.string().optional(),
+ result: z
+ .array(z.record(z.string(), z.unknown()))
+ .nullable()
+ .optional(),
+ })
+ .passthrough(),
+ )
+ .optional(),
+});
+
+export async function fetchDataforseoResult(
+ path: string,
+ payload: Record<string, unknown>,
+ apiKey: string,
+) {
+ const response = await fetch(`${DATAFORSEO_BASE}${path}`, {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ Authorization: `Basic ${apiKey}`,
+ },
+ body: JSON.stringify([payload]),
+ signal: AbortSignal.timeout(30_000),
+ });
+ if (!response.ok) {
+ throw new Error(`DataForSEO HTTP ${response.status} on ${path}`);
+ }
+ const task = taskEnvelopeSchema.parse(await response.json()).tasks?.[0];
+ // "No Search Results" is a successful empty result, not a failure — an
+ // obscure keyword or an unknown domain lands here. Match on the message, not
+ // the 40501 code alone: that code also covers validation rejections like
+ // "Invalid Field: 'target'.", which are real charged failures we must
+ // surface. Mirrors isNoResultsTask in src/server/lib/dataforseo/envelope.ts.
+ const noResults =
+ task?.status_message?.toLowerCase().includes("no search results") ?? false;
+ if (!task || (task.status_code !== 20000 && !noResults)) {
+ throw new Error(
+ `DataForSEO task ${task?.status_code ?? "missing"} on ${path}: ${task?.status_message ?? "no task"}`,
+ );
+ }
+ return task.result?.[0] ?? null;
+}
+
+/** `result[0].items` for the endpoints that return a single result block. */
+export const itemsResultSchema = z
+ .object({
+ items: z.array(z.record(z.string(), z.unknown())).nullable().optional(),
+ total_count: z.number().nullable().optional(),
+ })
+ .passthrough();
diff --git a/web/src/lib/free-tools/spend.ts b/web/src/lib/free-tools/spend.ts
new file mode 100644
index 00000000..99bbeacd
--- /dev/null
+++ b/web/src/lib/free-tools/spend.ts
@@ -0,0 +1,43 @@
+import type { FreeToolSlug } from "@/lib/free-tools/tool-pages";
+
+/**
+ * Spend controls for the free tools. These live away from the marketing
+ * registry on purpose: a copy edit to a tool's name or blurb must not be able
+ * to move a spend ceiling.
+ *
+ * Every number below counts BILLABLE DATAFORSEO CALLS PER DAY, not tool runs —
+ * one traffic check is three calls, one competitor analysis with your own
+ * domain is five. `null` means the tool makes no paid call at all.
+ *
+ * Reservations are atomic in a Durable Object per UTC day. Reserve before
+ * contacting the provider, including attempts that subsequently fail.
+ */
+export const dataforseoCallsPerDay = {
+ "backlink-checker": 1000,
+ "competitor-keyword-finder": 2000,
+ "keyword-generator": 2000,
+ "website-traffic-checker": 3000,
+ "competitor-analysis": 2500,
+ "spam-score-checker": 600,
+ "domain-age-checker": null,
+ "serp-simulator": null,
+} satisfies Record<FreeToolSlug, number | null>;
+
+/** Ceiling across every paid tool combined, below the sum of the per-tool caps. */
+export const ALL_TOOLS_CALLS_PER_DAY = 6000;
+
+/** Ceiling for one visitor across every paid tool, on top of the 5/min limit. */
+export const PER_IP_CALLS_PER_DAY = 40;
+
+/** Conservative USD ceilings in millionths, at the routes' fixed result limits.
+ * Revisit when provider pricing, endpoints, row limits, or SERP depth change.
+ * No refunds: failed or partially completed upstream requests remain reserved.
+ */
+export const reservedMicroDollarsPerCall = {
+ "backlink-checker": 25_000,
+ "competitor-keyword-finder": 15_000,
+ "keyword-generator": 15_000,
+ "website-traffic-checker": 15_000,
+ "competitor-analysis": 15_000,
+ "spam-score-checker": 25_000,
+} as const;
diff --git a/web/src/lib/free-tools/tool-frame.tsx b/web/src/lib/free-tools/tool-frame.tsx
new file mode 100644
index 00000000..a8bd2256
--- /dev/null
+++ b/web/src/lib/free-tools/tool-frame.tsx
@@ -0,0 +1,221 @@
+import type { ReactNode } from "react";
+import { trackTool } from "@/lib/free-tools/analytics";
+import { type FreeTool, freeTools } from "@/lib/free-tools/tool-pages";
+import { buildBreadcrumbJsonLd, SITE_URL, toCanonicalUrl } from "@/lib/seo";
+
+const SIGNUP_URL = "https://app.openseo.so/sign-up";
+
+type ToolHighlight = { title: string; description: string };
+
+type ToolFrameProps = {
+ tool: FreeTool;
+ heading: string;
+ subhead: string;
+ highlights: ToolHighlight[];
+ faqs: ToolFaq[];
+ cta: { heading: string; body: string; featureLabel: string };
+ children: ReactNode;
+};
+
+/**
+ * The shared shape of a free tool page: hero, the tool itself, what you get,
+ * FAQ, closing CTA, sibling tools, and the JSON-LD blocks.
+ */
+export function ToolFrame({
+ tool,
+ heading,
+ subhead,
+ highlights,
+ faqs,
+ cta,
+ children,
+}: ToolFrameProps) {
+ return (
+ <article className="mx-auto max-w-5xl">
+ <header className="max-w-3xl">
+ <p className="text-sm font-medium text-[var(--color-brand-accent)]">
+ Free tool
+ </p>
+ <h1 className="mt-3 text-4xl font-semibold leading-tight tracking-tight text-neutral-950 md:text-6xl">
+ {heading}
+ </h1>
+ <p className="mt-5 text-lg leading-8 text-[var(--color-brand-muted)]">
+ {subhead}
+ </p>
+ </header>
+
+ <div className="mt-8">{children}</div>
+
+ <section className="mt-12">
+ <h2 className="text-2xl font-semibold tracking-tight text-neutral-950">
+ What you get
+ </h2>
+ <ol className="mt-5 grid gap-4 md:grid-cols-3">
+ {highlights.map((item, index) => (
+ <li
+ key={item.title}
+ className="rounded-lg border border-[var(--color-border-subtle)] bg-white p-5"
+ >
+ <span className="font-mono text-sm tabular-nums text-[var(--color-brand-accent)]">
+ {String(index + 1).padStart(2, "0")}
+ </span>
+ <h3 className="mt-4 text-base font-semibold text-neutral-950">
+ {item.title}
+ </h3>
+ <p className="mt-2 text-sm leading-6 text-[var(--color-brand-muted)]">
+ {item.description}
+ </p>
+ </li>
+ ))}
+ </ol>
+ </section>
+
+ <section className="mt-12">
+ <h2 className="text-2xl font-semibold tracking-tight text-neutral-950">
+ FAQ
+ </h2>
+ <div className="mt-5 divide-y divide-[var(--color-border-subtle)] rounded-lg border border-[var(--color-border-subtle)] bg-white">
+ {faqs.map((faq) => (
+ <div key={faq.question} className="p-5">
+ <h3 className="text-sm font-semibold text-neutral-900">
+ {faq.question}
+ </h3>
+ <p className="mt-1.5 text-sm leading-6 text-[var(--color-brand-muted)]">
+ {faq.answer}
+ </p>
+ </div>
+ ))}
+ </div>
+ </section>
+
+ <section className="mt-12 rounded-xl border border-[var(--color-border-subtle)] bg-white p-6 md:p-8">
+ <h2 className="text-2xl font-semibold tracking-tight text-neutral-950">
+ {cta.heading}
+ </h2>
+ <p className="mt-2 max-w-2xl text-sm leading-6 text-[var(--color-brand-muted)]">
+ {cta.body}
+ </p>
+ <div className="mt-4 flex flex-wrap items-center gap-4">
+ <a
+ href={SIGNUP_URL}
+ onClick={() => trackTool("tool_cta_click", tool.slug)}
+ className="inline-flex h-10 items-center justify-center rounded-lg bg-neutral-950 px-4 text-sm font-medium text-white transition-colors hover:bg-neutral-800"
+ >
+ Try OpenSEO
+ <span aria-hidden="true" className="ml-2">
+ &rarr;
+ </span>
+ </a>
+ <a
+ href={tool.featureHref}
+ className="text-sm font-medium text-neutral-950 underline decoration-[var(--color-brand-accent)] underline-offset-4"
+ >
+ {cta.featureLabel}
+ <span aria-hidden="true" className="ml-1">
+ &rarr;
+ </span>
+ </a>
+ </div>
+ </section>
+
+ <RelatedTools tool={tool} />
+
+ {buildToolJsonLd(tool, faqs).map((block) => (
+ <script
+ key={block["@type"]}
+ type="application/ld+json"
+ dangerouslySetInnerHTML={{ __html: JSON.stringify(block) }}
+ />
+ ))}
+ </article>
+ );
+}
+
+function RelatedTools({ tool }: { tool: FreeTool }) {
+ return (
+ <section className="mt-12">
+ <h2 className="text-2xl font-semibold tracking-tight text-neutral-950">
+ More free tools
+ </h2>
+ <div className="mt-4 grid gap-3 md:grid-cols-3">
+ {tool.related
+ .map((slug) => freeTools[slug])
+ .map((sibling) => (
+ <a
+ key={sibling.slug}
+ href={sibling.path}
+ className="rounded-lg border border-[var(--color-border-subtle)] bg-white p-4 transition-colors hover:border-neutral-900"
+ >
+ <span className="text-sm font-medium text-neutral-950">
+ {sibling.name}
+ <span
+ aria-hidden="true"
+ className="ml-1 text-[var(--color-brand-accent)]"
+ >
+ &rarr;
+ </span>
+ </span>
+ <span className="mt-1 block text-xs leading-5 text-[var(--color-brand-muted)]">
+ {sibling.shortDescription}
+ </span>
+ </a>
+ ))}
+ </div>
+ <div className="mt-4">
+ <a
+ href="/tools"
+ className="text-sm font-medium text-neutral-950 underline decoration-[var(--color-brand-accent)] underline-offset-4"
+ >
+ All free SEO tools
+ <span aria-hidden="true" className="ml-1">
+ &rarr;
+ </span>
+ </a>
+ </div>
+ </section>
+ );
+}
+
+type ToolFaq = { question: string; answer: string };
+
+/**
+ * Every free tool page emits the same three blocks: the tool itself, its FAQ,
+ * and the Home -> Free tools -> Tool trail.
+ */
+function buildToolJsonLd(tool: FreeTool, faqs: ToolFaq[]) {
+ return [
+ {
+ "@context": "https://schema.org",
+ "@type": "SoftwareApplication",
+ name: `OpenSEO ${tool.name}`,
+ applicationCategory: "SEO",
+ operatingSystem: "Web",
+ url: toCanonicalUrl(tool.path),
+ description: tool.shortDescription,
+ offers: {
+ "@type": "Offer",
+ price: "0",
+ priceCurrency: "USD",
+ },
+ provider: {
+ "@type": "Organization",
+ name: "OpenSEO",
+ url: SITE_URL,
+ },
+ },
+ {
+ "@context": "https://schema.org",
+ "@type": "FAQPage",
+ mainEntity: faqs.map((faq) => ({
+ "@type": "Question",
+ name: faq.question,
+ acceptedAnswer: { "@type": "Answer", text: faq.answer },
+ })),
+ },
+ buildBreadcrumbJsonLd([
+ { name: "Home", path: "/" },
+ { name: "Free tools", path: "/tools" },
+ { name: tool.name, path: tool.path },
+ ]),
+ ];
+}
diff --git a/web/src/lib/free-tools/tool-pages.ts b/web/src/lib/free-tools/tool-pages.ts
new file mode 100644
index 00000000..22bbf9b7
--- /dev/null
+++ b/web/src/lib/free-tools/tool-pages.ts
@@ -0,0 +1,114 @@
+import { FREE_TOOL_PATHS } from "@/lib/free-tools/free-tool-paths";
+
+export type FreeToolSlug = keyof typeof FREE_TOOL_PATHS;
+
+export type FreeTool = {
+ slug: FreeToolSlug;
+ path: string;
+ name: string;
+ shortDescription: string;
+ /** The paid feature this tool is the free sample of. */
+ featureHref: string;
+ related: FreeToolSlug[];
+};
+
+// Spend ceilings deliberately live in spend.ts, not here — this file is
+// marketing copy, and a copy edit must not be able to move a spend control.
+
+export const freeTools = {
+ "backlink-checker": {
+ slug: "backlink-checker",
+ path: FREE_TOOL_PATHS["backlink-checker"],
+ name: "Backlink Checker",
+ shortDescription:
+ "Domain rank, referring domains, and the top backlinks pointing at any site.",
+ featureHref: "/features/backlink-checker",
+ related: ["spam-score-checker", "website-traffic-checker"],
+ },
+ "competitor-keyword-finder": {
+ slug: "competitor-keyword-finder",
+ path: FREE_TOOL_PATHS["competitor-keyword-finder"],
+ name: "Competitor Keyword Finder",
+ shortDescription:
+ "Find a competitor's top organic keywords, search volumes, positions, and ranking pages.",
+ featureHref: "/features/domain-overview",
+ related: [
+ "keyword-generator",
+ "competitor-analysis",
+ "website-traffic-checker",
+ ],
+ },
+ "keyword-generator": {
+ slug: "keyword-generator",
+ path: FREE_TOOL_PATHS["keyword-generator"],
+ name: "Keyword Generator",
+ shortDescription:
+ "Turn a topic into keyword ideas with search volume and difficulty estimates.",
+ featureHref: "/features/keyword-research",
+ related: [
+ "competitor-keyword-finder",
+ "competitor-analysis",
+ "serp-simulator",
+ ],
+ },
+ "website-traffic-checker": {
+ slug: "website-traffic-checker",
+ path: FREE_TOOL_PATHS["website-traffic-checker"],
+ name: "Website Traffic Checker",
+ shortDescription:
+ "Estimated organic traffic, keyword count, top keywords, and top pages for any domain.",
+ featureHref: "/features/domain-overview",
+ related: [
+ "competitor-analysis",
+ "competitor-keyword-finder",
+ "backlink-checker",
+ ],
+ },
+ "competitor-analysis": {
+ slug: "competitor-analysis",
+ path: FREE_TOOL_PATHS["competitor-analysis"],
+ name: "Competitor Analysis",
+ shortDescription:
+ "A competitor's top keywords and pages, and the keywords they rank for that you don't.",
+ featureHref: "/features/domain-overview",
+ related: [
+ "website-traffic-checker",
+ "competitor-keyword-finder",
+ "backlink-checker",
+ ],
+ },
+ "spam-score-checker": {
+ slug: "spam-score-checker",
+ path: FREE_TOOL_PATHS["spam-score-checker"],
+ name: "Spam Score Checker",
+ shortDescription:
+ "A domain's backlink spam score and the spammiest links pointing at it.",
+ featureHref: "/features/backlink-checker",
+ related: ["backlink-checker", "domain-age-checker"],
+ },
+ "domain-age-checker": {
+ slug: "domain-age-checker",
+ path: FREE_TOOL_PATHS["domain-age-checker"],
+ name: "Domain Age Checker",
+ shortDescription:
+ "Find when a domain was registered, when it expires, and which registrar it uses.",
+ featureHref: "/features/domain-overview",
+ related: ["backlink-checker", "website-traffic-checker"],
+ },
+ "serp-simulator": {
+ slug: "serp-simulator",
+ path: FREE_TOOL_PATHS["serp-simulator"],
+ name: "SERP Simulator",
+ shortDescription:
+ "Preview your title and description in desktop and mobile search results.",
+ featureHref: "/features/site-audit",
+ related: [
+ "competitor-keyword-finder",
+ "competitor-analysis",
+ "website-traffic-checker",
+ ],
+ },
+} satisfies Record<FreeToolSlug, FreeTool>;
+
+/** Registry order drives the hub and the footer column. */
+export const freeToolList: FreeTool[] = Object.values(freeTools);
diff --git a/web/src/lib/free-tools/tool-table.tsx b/web/src/lib/free-tools/tool-table.tsx
new file mode 100644
index 00000000..50f023b8
--- /dev/null
+++ b/web/src/lib/free-tools/tool-table.tsx
@@ -0,0 +1,47 @@
+import { type ReactNode, useEffect, useRef, useState } from "react";
+
+/** Give wide result tables a visible scroll hint and keyboard access. */
+export function ToolTable({
+ label,
+ className,
+ children,
+}: {
+ label: string;
+ className?: string;
+ children: ReactNode;
+}) {
+ const ref = useRef<HTMLDivElement>(null);
+ const [scrollable, setScrollable] = useState(false);
+
+ useEffect(() => {
+ const container = ref.current;
+ if (!container) return;
+ const update = () =>
+ setScrollable(container.scrollWidth > container.clientWidth + 1);
+ const observer = new ResizeObserver(update);
+ observer.observe(container);
+ if (container.firstElementChild)
+ observer.observe(container.firstElementChild);
+ update();
+ return () => observer.disconnect();
+ }, []);
+
+ return (
+ <div className={`min-w-0 ${className ?? ""}`}>
+ {scrollable ? (
+ <p className="mb-2 text-xs text-[var(--color-brand-muted)]">
+ Scroll sideways to see all columns.
+ </p>
+ ) : null}
+ <div
+ ref={ref}
+ role="region"
+ aria-label={label}
+ tabIndex={scrollable ? 0 : undefined}
+ className="overflow-x-auto rounded-lg border border-[var(--color-border-subtle)] bg-white focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-900"
+ >
+ {children}
+ </div>
+ </div>
+ );
+}
diff --git a/web/src/lib/free-tools/turnstile.ts b/web/src/lib/free-tools/turnstile.ts
new file mode 100644
index 00000000..9d8d23d1
--- /dev/null
+++ b/web/src/lib/free-tools/turnstile.ts
@@ -0,0 +1,101 @@
+import { useEffect, useRef } from "react";
+
+// Public site key. Cloudflare's always-passing test key is the dev-only
+// fallback; a build without VITE_TURNSTILE_SITE_KEY renders no widget.
+const TURNSTILE_SITE_KEY =
+ (import.meta.env.VITE_TURNSTILE_SITE_KEY as string | undefined)?.trim() ||
+ (import.meta.env.DEV ? "1x00000000000000000000AA" : "");
+
+// A deployable build without this key is rejected by the
+// openseo:require-turnstile-site-key plugin in vite.config.ts — a throw here
+// would only be swallowed by the prerenderer.
+
+/** How long a submit waits for the widget to produce its first token. */
+const TOKEN_WAIT_MS = 3_000;
+
+type TurnstileApi = {
+ render(
+ container: HTMLElement,
+ options: {
+ sitekey: string;
+ appearance?: string;
+ action?: string;
+ callback: (token: string) => void;
+ "expired-callback"?: () => void;
+ },
+ ): string;
+ reset(widgetId?: string): void;
+};
+
+/**
+ * Renders Turnstile into `containerRef`. `waitForToken()` waits for verification;
+ * `reset()` clears the single-use token after every submit.
+ */
+export function useTurnstile() {
+ const containerRef = useRef<HTMLDivElement>(null);
+ const widgetIdRef = useRef<string | null>(null);
+ const tokenRef = useRef("");
+
+ useEffect(() => {
+ if (!TURNSTILE_SITE_KEY) return;
+ const w = window as unknown as {
+ turnstile?: TurnstileApi;
+ onloadTurnstileCallback?: () => void;
+ };
+ const renderWidget = () => {
+ if (!w.turnstile || !containerRef.current) return;
+ if (widgetIdRef.current !== null) return;
+ widgetIdRef.current = w.turnstile.render(containerRef.current, {
+ sitekey: TURNSTILE_SITE_KEY,
+ // Invisible unless Turnstile decides the visitor needs a challenge.
+ appearance: "interaction-only",
+ action: "free_tool",
+ callback: (token) => {
+ tokenRef.current = token;
+ },
+ "expired-callback": () => {
+ tokenRef.current = "";
+ },
+ });
+ };
+
+ if (w.turnstile) {
+ renderWidget();
+ return;
+ }
+ w.onloadTurnstileCallback = renderWidget;
+ if (!document.querySelector("script[data-turnstile]")) {
+ const script = document.createElement("script");
+ script.src =
+ "https://challenges.cloudflare.com/turnstile/v0/api.js?onload=onloadTurnstileCallback";
+ script.async = true;
+ script.dataset.turnstile = "true";
+ document.head.appendChild(script);
+ }
+ }, []);
+
+ return {
+ containerRef,
+ /**
+ * Turnstile solves asynchronously, so an immediate first submit can race
+ * the widget and come back 403. Wait briefly for a token instead of
+ * POSTing without one. Resolves immediately when Turnstile isn't
+ * configured. Local development uses a public test site key.
+ */
+ waitForToken: async () => {
+ if (!TURNSTILE_SITE_KEY) return undefined;
+ const deadline = Date.now() + TOKEN_WAIT_MS;
+ while (!tokenRef.current && Date.now() < deadline) {
+ await new Promise((resolve) => setTimeout(resolve, 100));
+ }
+ return tokenRef.current || undefined;
+ },
+ reset: () => {
+ tokenRef.current = "";
+ const w = window as unknown as { turnstile?: TurnstileApi };
+ if (w.turnstile && widgetIdRef.current !== null) {
+ w.turnstile.reset(widgetIdRef.current);
+ }
+ },
+ };
+}
diff --git a/web/src/lib/free-tools/upsell-card.tsx b/web/src/lib/free-tools/upsell-card.tsx
new file mode 100644
index 00000000..876e649c
--- /dev/null
+++ b/web/src/lib/free-tools/upsell-card.tsx
@@ -0,0 +1,33 @@
+import type { ReactNode } from "react";
+import { trackTool } from "@/lib/free-tools/analytics";
+
+const SIGNUP_URL = "https://app.openseo.so/sign-up";
+
+/** Shown under truncated results: what the free run leaves out, and the CTA. */
+export function UpsellCard({
+ tool,
+ children,
+ cta = "Explore more in OpenSEO",
+}: {
+ tool: string;
+ children: ReactNode;
+ cta?: string;
+}) {
+ return (
+ <div className="mt-4 rounded-xl border border-[var(--color-border-subtle)] bg-white p-5 md:p-6">
+ <p className="text-sm leading-6 text-neutral-700">{children}</p>
+ <div className="mt-3">
+ <a
+ href={SIGNUP_URL}
+ onClick={() => trackTool("tool_cta_click", tool)}
+ className="inline-flex min-h-11 max-w-full items-center justify-center py-2 rounded-lg bg-neutral-950 px-4 text-sm font-medium text-white transition-colors hover:bg-neutral-800"
+ >
+ {cta}
+ <span aria-hidden="true" className="ml-2">
+ &rarr;
+ </span>
+ </a>
+ </div>
+ </div>
+ );
+}
diff --git a/web/src/lib/free-tools/use-tool-run.ts b/web/src/lib/free-tools/use-tool-run.ts
new file mode 100644
index 00000000..d692a871
--- /dev/null
+++ b/web/src/lib/free-tools/use-tool-run.ts
@@ -0,0 +1,52 @@
+import { useState } from "react";
+import { trackTool } from "@/lib/free-tools/analytics";
+import type { ToolStatus } from "@/lib/free-tools/form";
+import { useTurnstile } from "@/lib/free-tools/turnstile";
+
+/**
+ * The submit cycle every API-backed free tool shares: status machine, error
+ * message, Plausible events, and a single-use Turnstile token.
+ */
+export function useToolRun<T>(tool: string, path: string) {
+ const [status, setStatus] = useState<ToolStatus>("idle");
+ const [errorMessage, setErrorMessage] = useState("");
+ const [result, setResult] = useState<T | null>(null);
+ const turnstile = useTurnstile();
+
+ const run = async (body: Record<string, unknown>) => {
+ setStatus("loading");
+ setErrorMessage("");
+ trackTool("tool_run", tool);
+ try {
+ // Blocks only while Turnstile is still solving; resolves immediately
+ // when no widget is configured.
+ const turnstileToken = await turnstile.waitForToken();
+ const res = await fetch(path, {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({ ...body, turnstileToken }),
+ });
+ const data = (await res.json().catch(() => ({}))) as
+ | T
+ | { error?: string };
+ if (!res.ok) {
+ throw new Error(
+ (data as { error?: string }).error || "Something went wrong",
+ );
+ }
+ setResult(data as T);
+ setStatus("done");
+ trackTool("tool_result", tool);
+ } catch (err) {
+ setStatus("error");
+ setErrorMessage(
+ err instanceof Error ? err.message : "Something went wrong",
+ );
+ } finally {
+ // Turnstile tokens are single-use; get a fresh one for the next run.
+ turnstile.reset();
+ }
+ };
+
+ return { status, errorMessage, result, run, turnstile };
+}
diff --git a/web/src/routeTree.gen.ts b/web/src/routeTree.gen.ts
index ca2f4862..df579f15 100644
--- a/web/src/routeTree.gen.ts
+++ b/web/src/routeTree.gen.ts
@@ -18,17 +18,31 @@ import { Route as JsScriptDotjsRouteImport } from './routes/js/script[.]js'
import { Route as GuidesSplatRouteImport } from './routes/guides/$'
import { Route as DocsSplatRouteImport } from './routes/docs/$'
import { Route as BlogsSplatRouteImport } from './routes/blogs/$'
+import { Route as ApiWebsiteTrafficCheckerRouteImport } from './routes/api/website-traffic-checker'
import { Route as ApiSubscribeRouteImport } from './routes/api/subscribe'
+import { Route as ApiSpamScoreCheckerRouteImport } from './routes/api/spam-score-checker'
+import { Route as ApiKeywordGeneratorRouteImport } from './routes/api/keyword-generator'
import { Route as ApiEventRouteImport } from './routes/api/event'
+import { Route as ApiDomainAgeCheckerRouteImport } from './routes/api/domain-age-checker'
+import { Route as ApiCompetitorKeywordFinderRouteImport } from './routes/api/competitor-keyword-finder'
+import { Route as ApiCompetitorAnalysisRouteImport } from './routes/api/competitor-analysis'
import { Route as ApiBacklinkCheckRouteImport } from './routes/api/backlink-check'
import { Route as MarketingWhyOpenseoRouteImport } from './routes/_marketing/why-openseo'
+import { Route as MarketingWebsiteTrafficCheckerRouteImport } from './routes/_marketing/website-traffic-checker'
+import { Route as MarketingToolsRouteImport } from './routes/_marketing/tools'
import { Route as MarketingTermsAndConditionsRouteImport } from './routes/_marketing/terms-and-conditions'
import { Route as MarketingSupportRouteImport } from './routes/_marketing/support'
+import { Route as MarketingSpamScoreCheckerRouteImport } from './routes/_marketing/spam-score-checker'
+import { Route as MarketingSerpSimulatorRouteImport } from './routes/_marketing/serp-simulator'
import { Route as MarketingRoadmapRouteImport } from './routes/_marketing/roadmap'
import { Route as MarketingPrivacyRouteImport } from './routes/_marketing/privacy'
import { Route as MarketingPricingRouteImport } from './routes/_marketing/pricing'
import { Route as MarketingOpenSourceSeoRouteImport } from './routes/_marketing/open-source-seo'
+import { Route as MarketingKeywordGeneratorRouteImport } from './routes/_marketing/keyword-generator'
import { Route as MarketingGoogleSearchConsoleMcpRouteImport } from './routes/_marketing/google-search-console-mcp'
+import { Route as MarketingDomainAgeCheckerRouteImport } from './routes/_marketing/domain-age-checker'
+import { Route as MarketingCompetitorKeywordFinderRouteImport } from './routes/_marketing/competitor-keyword-finder'
+import { Route as MarketingCompetitorAnalysisRouteImport } from './routes/_marketing/competitor-analysis'
import { Route as MarketingBacklinkCheckerRouteImport } from './routes/_marketing/backlink-checker'
import { Route as MarketingAboutRouteImport } from './routes/_marketing/about'
import { Route as MarketingLibraryIndexRouteImport } from './routes/_marketing/library/index'
@@ -120,16 +134,48 @@ const BlogsSplatRoute = BlogsSplatRouteImport.update({
path: '/blogs/$',
getParentRoute: () => rootRouteImport,
} as any)
+const ApiWebsiteTrafficCheckerRoute =
+ ApiWebsiteTrafficCheckerRouteImport.update({
+ id: '/api/website-traffic-checker',
+ path: '/api/website-traffic-checker',
+ getParentRoute: () => rootRouteImport,
+ } as any)
const ApiSubscribeRoute = ApiSubscribeRouteImport.update({
id: '/api/subscribe',
path: '/api/subscribe',
getParentRoute: () => rootRouteImport,
} as any)
+const ApiSpamScoreCheckerRoute = ApiSpamScoreCheckerRouteImport.update({
+ id: '/api/spam-score-checker',
+ path: '/api/spam-score-checker',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const ApiKeywordGeneratorRoute = ApiKeywordGeneratorRouteImport.update({
+ id: '/api/keyword-generator',
+ path: '/api/keyword-generator',
+ getParentRoute: () => rootRouteImport,
+} as any)
const ApiEventRoute = ApiEventRouteImport.update({
id: '/api/event',
path: '/api/event',
getParentRoute: () => rootRouteImport,
} as any)
+const ApiDomainAgeCheckerRoute = ApiDomainAgeCheckerRouteImport.update({
+ id: '/api/domain-age-checker',
+ path: '/api/domain-age-checker',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const ApiCompetitorKeywordFinderRoute =
+ ApiCompetitorKeywordFinderRouteImport.update({
+ id: '/api/competitor-keyword-finder',
+ path: '/api/competitor-keyword-finder',
+ getParentRoute: () => rootRouteImport,
+ } as any)
+const ApiCompetitorAnalysisRoute = ApiCompetitorAnalysisRouteImport.update({
+ id: '/api/competitor-analysis',
+ path: '/api/competitor-analysis',
+ getParentRoute: () => rootRouteImport,
+} as any)
const ApiBacklinkCheckRoute = ApiBacklinkCheckRouteImport.update({
id: '/api/backlink-check',
path: '/api/backlink-check',
@@ -140,6 +186,17 @@ const MarketingWhyOpenseoRoute = MarketingWhyOpenseoRouteImport.update({
path: '/why-openseo',
getParentRoute: () => MarketingRoute,
} as any)
+const MarketingWebsiteTrafficCheckerRoute =
+ MarketingWebsiteTrafficCheckerRouteImport.update({
+ id: '/website-traffic-checker',
+ path: '/website-traffic-checker',
+ getParentRoute: () => MarketingRoute,
+ } as any)
+const MarketingToolsRoute = MarketingToolsRouteImport.update({
+ id: '/tools',
+ path: '/tools',
+ getParentRoute: () => MarketingRoute,
+} as any)
const MarketingTermsAndConditionsRoute =
MarketingTermsAndConditionsRouteImport.update({
id: '/terms-and-conditions',
@@ -151,6 +208,17 @@ const MarketingSupportRoute = MarketingSupportRouteImport.update({
path: '/support',
getParentRoute: () => MarketingRoute,
} as any)
+const MarketingSpamScoreCheckerRoute =
+ MarketingSpamScoreCheckerRouteImport.update({
+ id: '/spam-score-checker',
+ path: '/spam-score-checker',
+ getParentRoute: () => MarketingRoute,
+ } as any)
+const MarketingSerpSimulatorRoute = MarketingSerpSimulatorRouteImport.update({
+ id: '/serp-simulator',
+ path: '/serp-simulator',
+ getParentRoute: () => MarketingRoute,
+} as any)
const MarketingRoadmapRoute = MarketingRoadmapRouteImport.update({
id: '/roadmap',
path: '/roadmap',
@@ -171,12 +239,36 @@ const MarketingOpenSourceSeoRoute = MarketingOpenSourceSeoRouteImport.update({
path: '/open-source-seo',
getParentRoute: () => MarketingRoute,
} as any)
+const MarketingKeywordGeneratorRoute =
+ MarketingKeywordGeneratorRouteImport.update({
+ id: '/keyword-generator',
+ path: '/keyword-generator',
+ getParentRoute: () => MarketingRoute,
+ } as any)
const MarketingGoogleSearchConsoleMcpRoute =
MarketingGoogleSearchConsoleMcpRouteImport.update({
id: '/google-search-console-mcp',
path: '/google-search-console-mcp',
getParentRoute: () => MarketingRoute,
} as any)
+const MarketingDomainAgeCheckerRoute =
+ MarketingDomainAgeCheckerRouteImport.update({
+ id: '/domain-age-checker',
+ path: '/domain-age-checker',
+ getParentRoute: () => MarketingRoute,
+ } as any)
+const MarketingCompetitorKeywordFinderRoute =
+ MarketingCompetitorKeywordFinderRouteImport.update({
+ id: '/competitor-keyword-finder',
+ path: '/competitor-keyword-finder',
+ getParentRoute: () => MarketingRoute,
+ } as any)
+const MarketingCompetitorAnalysisRoute =
+ MarketingCompetitorAnalysisRouteImport.update({
+ id: '/competitor-analysis',
+ path: '/competitor-analysis',
+ getParentRoute: () => MarketingRoute,
+ } as any)
const MarketingBacklinkCheckerRoute =
MarketingBacklinkCheckerRouteImport.update({
id: '/backlink-checker',
@@ -458,17 +550,31 @@ export interface FileRoutesByFullPath {
'/': typeof MarketingIndexRoute
'/about': typeof MarketingAboutRoute
'/backlink-checker': typeof MarketingBacklinkCheckerRoute
+ '/competitor-analysis': typeof MarketingCompetitorAnalysisRoute
+ '/competitor-keyword-finder': typeof MarketingCompetitorKeywordFinderRoute
+ '/domain-age-checker': typeof MarketingDomainAgeCheckerRoute
'/google-search-console-mcp': typeof MarketingGoogleSearchConsoleMcpRoute
+ '/keyword-generator': typeof MarketingKeywordGeneratorRoute
'/open-source-seo': typeof MarketingOpenSourceSeoRoute
'/pricing': typeof MarketingPricingRoute
'/privacy': typeof MarketingPrivacyRoute
'/roadmap': typeof MarketingRoadmapRoute
+ '/serp-simulator': typeof MarketingSerpSimulatorRoute
+ '/spam-score-checker': typeof MarketingSpamScoreCheckerRoute
'/support': typeof MarketingSupportRoute
'/terms-and-conditions': typeof MarketingTermsAndConditionsRoute
+ '/tools': typeof MarketingToolsRoute
+ '/website-traffic-checker': typeof MarketingWebsiteTrafficCheckerRoute
'/why-openseo': typeof MarketingWhyOpenseoRoute
'/api/backlink-check': typeof ApiBacklinkCheckRoute
+ '/api/competitor-analysis': typeof ApiCompetitorAnalysisRoute
+ '/api/competitor-keyword-finder': typeof ApiCompetitorKeywordFinderRoute
+ '/api/domain-age-checker': typeof ApiDomainAgeCheckerRoute
'/api/event': typeof ApiEventRoute
+ '/api/keyword-generator': typeof ApiKeywordGeneratorRoute
+ '/api/spam-score-checker': typeof ApiSpamScoreCheckerRoute
'/api/subscribe': typeof ApiSubscribeRoute
+ '/api/website-traffic-checker': typeof ApiWebsiteTrafficCheckerRoute
'/blogs/$': typeof BlogsSplatRoute
'/docs/$': typeof DocsSplatRoute
'/guides/$': typeof GuidesSplatRoute
@@ -524,17 +630,31 @@ export interface FileRoutesByFullPath {
export interface FileRoutesByTo {
'/about': typeof MarketingAboutRoute
'/backlink-checker': typeof MarketingBacklinkCheckerRoute
+ '/competitor-analysis': typeof MarketingCompetitorAnalysisRoute
+ '/competitor-keyword-finder': typeof MarketingCompetitorKeywordFinderRoute
+ '/domain-age-checker': typeof MarketingDomainAgeCheckerRoute
'/google-search-console-mcp': typeof MarketingGoogleSearchConsoleMcpRoute
+ '/keyword-generator': typeof MarketingKeywordGeneratorRoute
'/open-source-seo': typeof MarketingOpenSourceSeoRoute
'/pricing': typeof MarketingPricingRoute
'/privacy': typeof MarketingPrivacyRoute
'/roadmap': typeof MarketingRoadmapRoute
+ '/serp-simulator': typeof MarketingSerpSimulatorRoute
+ '/spam-score-checker': typeof MarketingSpamScoreCheckerRoute
'/support': typeof MarketingSupportRoute
'/terms-and-conditions': typeof MarketingTermsAndConditionsRoute
+ '/tools': typeof MarketingToolsRoute
+ '/website-traffic-checker': typeof MarketingWebsiteTrafficCheckerRoute
'/why-openseo': typeof MarketingWhyOpenseoRoute
'/api/backlink-check': typeof ApiBacklinkCheckRoute
+ '/api/competitor-analysis': typeof ApiCompetitorAnalysisRoute
+ '/api/competitor-keyword-finder': typeof ApiCompetitorKeywordFinderRoute
+ '/api/domain-age-checker': typeof ApiDomainAgeCheckerRoute
'/api/event': typeof ApiEventRoute
+ '/api/keyword-generator': typeof ApiKeywordGeneratorRoute
+ '/api/spam-score-checker': typeof ApiSpamScoreCheckerRoute
'/api/subscribe': typeof ApiSubscribeRoute
+ '/api/website-traffic-checker': typeof ApiWebsiteTrafficCheckerRoute
'/blogs/$': typeof BlogsSplatRoute
'/docs/$': typeof DocsSplatRoute
'/guides/$': typeof GuidesSplatRoute
@@ -593,17 +713,31 @@ export interface FileRoutesById {
'/_marketing': typeof MarketingRouteWithChildren
'/_marketing/about': typeof MarketingAboutRoute
'/_marketing/backlink-checker': typeof MarketingBacklinkCheckerRoute
+ '/_marketing/competitor-analysis': typeof MarketingCompetitorAnalysisRoute
+ '/_marketing/competitor-keyword-finder': typeof MarketingCompetitorKeywordFinderRoute
+ '/_marketing/domain-age-checker': typeof MarketingDomainAgeCheckerRoute
'/_marketing/google-search-console-mcp': typeof MarketingGoogleSearchConsoleMcpRoute
+ '/_marketing/keyword-generator': typeof MarketingKeywordGeneratorRoute
'/_marketing/open-source-seo': typeof MarketingOpenSourceSeoRoute
'/_marketing/pricing': typeof MarketingPricingRoute
'/_marketing/privacy': typeof MarketingPrivacyRoute
'/_marketing/roadmap': typeof MarketingRoadmapRoute
+ '/_marketing/serp-simulator': typeof MarketingSerpSimulatorRoute
+ '/_marketing/spam-score-checker': typeof MarketingSpamScoreCheckerRoute
'/_marketing/support': typeof MarketingSupportRoute
'/_marketing/terms-and-conditions': typeof MarketingTermsAndConditionsRoute
+ '/_marketing/tools': typeof MarketingToolsRoute
+ '/_marketing/website-traffic-checker': typeof MarketingWebsiteTrafficCheckerRoute
'/_marketing/why-openseo': typeof MarketingWhyOpenseoRoute
'/api/backlink-check': typeof ApiBacklinkCheckRoute
+ '/api/competitor-analysis': typeof ApiCompetitorAnalysisRoute
+ '/api/competitor-keyword-finder': typeof ApiCompetitorKeywordFinderRoute
+ '/api/domain-age-checker': typeof ApiDomainAgeCheckerRoute
'/api/event': typeof ApiEventRoute
+ '/api/keyword-generator': typeof ApiKeywordGeneratorRoute
+ '/api/spam-score-checker': typeof ApiSpamScoreCheckerRoute
'/api/subscribe': typeof ApiSubscribeRoute
+ '/api/website-traffic-checker': typeof ApiWebsiteTrafficCheckerRoute
'/blogs/$': typeof BlogsSplatRoute
'/docs/$': typeof DocsSplatRoute
'/guides/$': typeof GuidesSplatRoute
@@ -663,17 +797,31 @@ export interface FileRouteTypes {
| '/'
| '/about'
| '/backlink-checker'
+ | '/competitor-analysis'
+ | '/competitor-keyword-finder'
+ | '/domain-age-checker'
| '/google-search-console-mcp'
+ | '/keyword-generator'
| '/open-source-seo'
| '/pricing'
| '/privacy'
| '/roadmap'
+ | '/serp-simulator'
+ | '/spam-score-checker'
| '/support'
| '/terms-and-conditions'
+ | '/tools'
+ | '/website-traffic-checker'
| '/why-openseo'
| '/api/backlink-check'
+ | '/api/competitor-analysis'
+ | '/api/competitor-keyword-finder'
+ | '/api/domain-age-checker'
| '/api/event'
+ | '/api/keyword-generator'
+ | '/api/spam-score-checker'
| '/api/subscribe'
+ | '/api/website-traffic-checker'
| '/blogs/$'
| '/docs/$'
| '/guides/$'
@@ -729,17 +877,31 @@ export interface FileRouteTypes {
to:
| '/about'
| '/backlink-checker'
+ | '/competitor-analysis'
+ | '/competitor-keyword-finder'
+ | '/domain-age-checker'
| '/google-search-console-mcp'
+ | '/keyword-generator'
| '/open-source-seo'
| '/pricing'
| '/privacy'
| '/roadmap'
+ | '/serp-simulator'
+ | '/spam-score-checker'
| '/support'
| '/terms-and-conditions'
+ | '/tools'
+ | '/website-traffic-checker'
| '/why-openseo'
| '/api/backlink-check'
+ | '/api/competitor-analysis'
+ | '/api/competitor-keyword-finder'
+ | '/api/domain-age-checker'
| '/api/event'
+ | '/api/keyword-generator'
+ | '/api/spam-score-checker'
| '/api/subscribe'
+ | '/api/website-traffic-checker'
| '/blogs/$'
| '/docs/$'
| '/guides/$'
@@ -797,17 +959,31 @@ export interface FileRouteTypes {
| '/_marketing'
| '/_marketing/about'
| '/_marketing/backlink-checker'
+ | '/_marketing/competitor-analysis'
+ | '/_marketing/competitor-keyword-finder'
+ | '/_marketing/domain-age-checker'
| '/_marketing/google-search-console-mcp'
+ | '/_marketing/keyword-generator'
| '/_marketing/open-source-seo'
| '/_marketing/pricing'
| '/_marketing/privacy'
| '/_marketing/roadmap'
+ | '/_marketing/serp-simulator'
+ | '/_marketing/spam-score-checker'
| '/_marketing/support'
| '/_marketing/terms-and-conditions'
+ | '/_marketing/tools'
+ | '/_marketing/website-traffic-checker'
| '/_marketing/why-openseo'
| '/api/backlink-check'
+ | '/api/competitor-analysis'
+ | '/api/competitor-keyword-finder'
+ | '/api/domain-age-checker'
| '/api/event'
+ | '/api/keyword-generator'
+ | '/api/spam-score-checker'
| '/api/subscribe'
+ | '/api/website-traffic-checker'
| '/blogs/$'
| '/docs/$'
| '/guides/$'
@@ -865,8 +1041,14 @@ export interface FileRouteTypes {
export interface RootRouteChildren {
MarketingRoute: typeof MarketingRouteWithChildren
ApiBacklinkCheckRoute: typeof ApiBacklinkCheckRoute
+ ApiCompetitorAnalysisRoute: typeof ApiCompetitorAnalysisRoute
+ ApiCompetitorKeywordFinderRoute: typeof ApiCompetitorKeywordFinderRoute
+ ApiDomainAgeCheckerRoute: typeof ApiDomainAgeCheckerRoute
ApiEventRoute: typeof ApiEventRoute
+ ApiKeywordGeneratorRoute: typeof ApiKeywordGeneratorRoute
+ ApiSpamScoreCheckerRoute: typeof ApiSpamScoreCheckerRoute
ApiSubscribeRoute: typeof ApiSubscribeRoute
+ ApiWebsiteTrafficCheckerRoute: typeof ApiWebsiteTrafficCheckerRoute
BlogsSplatRoute: typeof BlogsSplatRoute
DocsSplatRoute: typeof DocsSplatRoute
GuidesSplatRoute: typeof GuidesSplatRoute
@@ -941,6 +1123,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof BlogsSplatRouteImport
parentRoute: typeof rootRouteImport
}
+ '/api/website-traffic-checker': {
+ id: '/api/website-traffic-checker'
+ path: '/api/website-traffic-checker'
+ fullPath: '/api/website-traffic-checker'
+ preLoaderRoute: typeof ApiWebsiteTrafficCheckerRouteImport
+ parentRoute: typeof rootRouteImport
+ }
'/api/subscribe': {
id: '/api/subscribe'
path: '/api/subscribe'
@@ -948,6 +1137,20 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof ApiSubscribeRouteImport
parentRoute: typeof rootRouteImport
}
+ '/api/spam-score-checker': {
+ id: '/api/spam-score-checker'
+ path: '/api/spam-score-checker'
+ fullPath: '/api/spam-score-checker'
+ preLoaderRoute: typeof ApiSpamScoreCheckerRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/api/keyword-generator': {
+ id: '/api/keyword-generator'
+ path: '/api/keyword-generator'
+ fullPath: '/api/keyword-generator'
+ preLoaderRoute: typeof ApiKeywordGeneratorRouteImport
+ parentRoute: typeof rootRouteImport
+ }
'/api/event': {
id: '/api/event'
path: '/api/event'
@@ -955,6 +1158,27 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof ApiEventRouteImport
parentRoute: typeof rootRouteImport
}
+ '/api/domain-age-checker': {
+ id: '/api/domain-age-checker'
+ path: '/api/domain-age-checker'
+ fullPath: '/api/domain-age-checker'
+ preLoaderRoute: typeof ApiDomainAgeCheckerRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/api/competitor-keyword-finder': {
+ id: '/api/competitor-keyword-finder'
+ path: '/api/competitor-keyword-finder'
+ fullPath: '/api/competitor-keyword-finder'
+ preLoaderRoute: typeof ApiCompetitorKeywordFinderRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/api/competitor-analysis': {
+ id: '/api/competitor-analysis'
+ path: '/api/competitor-analysis'
+ fullPath: '/api/competitor-analysis'
+ preLoaderRoute: typeof ApiCompetitorAnalysisRouteImport
+ parentRoute: typeof rootRouteImport
+ }
'/api/backlink-check': {
id: '/api/backlink-check'
path: '/api/backlink-check'
@@ -969,6 +1193,20 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof MarketingWhyOpenseoRouteImport
parentRoute: typeof MarketingRoute
}
+ '/_marketing/website-traffic-checker': {
+ id: '/_marketing/website-traffic-checker'
+ path: '/website-traffic-checker'
+ fullPath: '/website-traffic-checker'
+ preLoaderRoute: typeof MarketingWebsiteTrafficCheckerRouteImport
+ parentRoute: typeof MarketingRoute
+ }
+ '/_marketing/tools': {
+ id: '/_marketing/tools'
+ path: '/tools'
+ fullPath: '/tools'
+ preLoaderRoute: typeof MarketingToolsRouteImport
+ parentRoute: typeof MarketingRoute
+ }
'/_marketing/terms-and-conditions': {
id: '/_marketing/terms-and-conditions'
path: '/terms-and-conditions'
@@ -983,6 +1221,20 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof MarketingSupportRouteImport
parentRoute: typeof MarketingRoute
}
+ '/_marketing/spam-score-checker': {
+ id: '/_marketing/spam-score-checker'
+ path: '/spam-score-checker'
+ fullPath: '/spam-score-checker'
+ preLoaderRoute: typeof MarketingSpamScoreCheckerRouteImport
+ parentRoute: typeof MarketingRoute
+ }
+ '/_marketing/serp-simulator': {
+ id: '/_marketing/serp-simulator'
+ path: '/serp-simulator'
+ fullPath: '/serp-simulator'
+ preLoaderRoute: typeof MarketingSerpSimulatorRouteImport
+ parentRoute: typeof MarketingRoute
+ }
'/_marketing/roadmap': {
id: '/_marketing/roadmap'
path: '/roadmap'
@@ -1011,6 +1263,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof MarketingOpenSourceSeoRouteImport
parentRoute: typeof MarketingRoute
}
+ '/_marketing/keyword-generator': {
+ id: '/_marketing/keyword-generator'
+ path: '/keyword-generator'
+ fullPath: '/keyword-generator'
+ preLoaderRoute: typeof MarketingKeywordGeneratorRouteImport
+ parentRoute: typeof MarketingRoute
+ }
'/_marketing/google-search-console-mcp': {
id: '/_marketing/google-search-console-mcp'
path: '/google-search-console-mcp'
@@ -1018,6 +1277,27 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof MarketingGoogleSearchConsoleMcpRouteImport
parentRoute: typeof MarketingRoute
}
+ '/_marketing/domain-age-checker': {
+ id: '/_marketing/domain-age-checker'
+ path: '/domain-age-checker'
+ fullPath: '/domain-age-checker'
+ preLoaderRoute: typeof MarketingDomainAgeCheckerRouteImport
+ parentRoute: typeof MarketingRoute
+ }
+ '/_marketing/competitor-keyword-finder': {
+ id: '/_marketing/competitor-keyword-finder'
+ path: '/competitor-keyword-finder'
+ fullPath: '/competitor-keyword-finder'
+ preLoaderRoute: typeof MarketingCompetitorKeywordFinderRouteImport
+ parentRoute: typeof MarketingRoute
+ }
+ '/_marketing/competitor-analysis': {
+ id: '/_marketing/competitor-analysis'
+ path: '/competitor-analysis'
+ fullPath: '/competitor-analysis'
+ preLoaderRoute: typeof MarketingCompetitorAnalysisRouteImport
+ parentRoute: typeof MarketingRoute
+ }
'/_marketing/backlink-checker': {
id: '/_marketing/backlink-checker'
path: '/backlink-checker'
@@ -1346,13 +1626,21 @@ declare module '@tanstack/react-router' {
interface MarketingRouteChildren {
MarketingAboutRoute: typeof MarketingAboutRoute
MarketingBacklinkCheckerRoute: typeof MarketingBacklinkCheckerRoute
+ MarketingCompetitorAnalysisRoute: typeof MarketingCompetitorAnalysisRoute
+ MarketingCompetitorKeywordFinderRoute: typeof MarketingCompetitorKeywordFinderRoute
+ MarketingDomainAgeCheckerRoute: typeof MarketingDomainAgeCheckerRoute
MarketingGoogleSearchConsoleMcpRoute: typeof MarketingGoogleSearchConsoleMcpRoute
+ MarketingKeywordGeneratorRoute: typeof MarketingKeywordGeneratorRoute
MarketingOpenSourceSeoRoute: typeof MarketingOpenSourceSeoRoute
MarketingPricingRoute: typeof MarketingPricingRoute
MarketingPrivacyRoute: typeof MarketingPrivacyRoute
MarketingRoadmapRoute: typeof MarketingRoadmapRoute
+ MarketingSerpSimulatorRoute: typeof MarketingSerpSimulatorRoute
+ MarketingSpamScoreCheckerRoute: typeof MarketingSpamScoreCheckerRoute
MarketingSupportRoute: typeof MarketingSupportRoute
MarketingTermsAndConditionsRoute: typeof MarketingTermsAndConditionsRoute
+ MarketingToolsRoute: typeof MarketingToolsRoute
+ MarketingWebsiteTrafficCheckerRoute: typeof MarketingWebsiteTrafficCheckerRoute
MarketingWhyOpenseoRoute: typeof MarketingWhyOpenseoRoute
MarketingIndexRoute: typeof MarketingIndexRoute
MarketingFeaturesAiBrandVisibilityRoute: typeof MarketingFeaturesAiBrandVisibilityRoute
@@ -1404,13 +1692,21 @@ interface MarketingRouteChildren {
const MarketingRouteChildren: MarketingRouteChildren = {
MarketingAboutRoute: MarketingAboutRoute,
MarketingBacklinkCheckerRoute: MarketingBacklinkCheckerRoute,
+ MarketingCompetitorAnalysisRoute: MarketingCompetitorAnalysisRoute,
+ MarketingCompetitorKeywordFinderRoute: MarketingCompetitorKeywordFinderRoute,
+ MarketingDomainAgeCheckerRoute: MarketingDomainAgeCheckerRoute,
MarketingGoogleSearchConsoleMcpRoute: MarketingGoogleSearchConsoleMcpRoute,
+ MarketingKeywordGeneratorRoute: MarketingKeywordGeneratorRoute,
MarketingOpenSourceSeoRoute: MarketingOpenSourceSeoRoute,
MarketingPricingRoute: MarketingPricingRoute,
MarketingPrivacyRoute: MarketingPrivacyRoute,
MarketingRoadmapRoute: MarketingRoadmapRoute,
+ MarketingSerpSimulatorRoute: MarketingSerpSimulatorRoute,
+ MarketingSpamScoreCheckerRoute: MarketingSpamScoreCheckerRoute,
MarketingSupportRoute: MarketingSupportRoute,
MarketingTermsAndConditionsRoute: MarketingTermsAndConditionsRoute,
+ MarketingToolsRoute: MarketingToolsRoute,
+ MarketingWebsiteTrafficCheckerRoute: MarketingWebsiteTrafficCheckerRoute,
MarketingWhyOpenseoRoute: MarketingWhyOpenseoRoute,
MarketingIndexRoute: MarketingIndexRoute,
MarketingFeaturesAiBrandVisibilityRoute:
@@ -1497,8 +1793,14 @@ const MarketingRouteWithChildren = MarketingRoute._addFileChildren(
const rootRouteChildren: RootRouteChildren = {
MarketingRoute: MarketingRouteWithChildren,
ApiBacklinkCheckRoute: ApiBacklinkCheckRoute,
+ ApiCompetitorAnalysisRoute: ApiCompetitorAnalysisRoute,
+ ApiCompetitorKeywordFinderRoute: ApiCompetitorKeywordFinderRoute,
+ ApiDomainAgeCheckerRoute: ApiDomainAgeCheckerRoute,
ApiEventRoute: ApiEventRoute,
+ ApiKeywordGeneratorRoute: ApiKeywordGeneratorRoute,
+ ApiSpamScoreCheckerRoute: ApiSpamScoreCheckerRoute,
ApiSubscribeRoute: ApiSubscribeRoute,
+ ApiWebsiteTrafficCheckerRoute: ApiWebsiteTrafficCheckerRoute,
BlogsSplatRoute: BlogsSplatRoute,
DocsSplatRoute: DocsSplatRoute,
GuidesSplatRoute: GuidesSplatRoute,
diff --git a/web/src/routes/_marketing/backlink-checker.tsx b/web/src/routes/_marketing/backlink-checker.tsx
index b7463dff..cc7e39eb 100644
--- a/web/src/routes/_marketing/backlink-checker.tsx
+++ b/web/src/routes/_marketing/backlink-checker.tsx
@@ -1,14 +1,21 @@
import { createFileRoute } from "@tanstack/react-router";
import { BacklinkCheckerTool } from "@/components/backlink-checker-tool";
+import { ToolFrame } from "@/lib/free-tools/tool-frame";
+import { freeTools } from "@/lib/free-tools/tool-pages";
import { buildPageSeo } from "@/lib/seo";
+const TOOL = freeTools["backlink-checker"];
+
export const Route = createFileRoute("/_marketing/backlink-checker")({
+ // `?target=example.com` prefills the input. Plain links still work.
+ validateSearch: (search: Record<string, unknown>): { target?: string } =>
+ typeof search.target === "string" ? { target: search.target } : {},
head: () =>
buildPageSeo({
title: "Free Backlink Checker: Check Backlinks to Any Website",
description:
- "Check backlinks for any domain: referring domains, top backlinks, anchor text, and follow status. Instant results, no signup required.",
- path: "/backlink-checker",
+ "Check backlinks for any domain: referring domains, top backlinks, anchor text, and follow status. Instant results, no signup, no email.",
+ path: TOOL.path,
titleSuffix: "OpenSEO",
imageAlt: "OpenSEO free backlink checker",
}),
@@ -29,7 +36,7 @@ const FAQS = [
{
question: "Can I check a competitor's backlinks?",
answer:
- "Yes. Enter any domain — yours, a competitor's, or a site you're evaluating for outreach. Backlink data is public-web data, so no site ownership or verification is needed.",
+ "Yes. Enter your domain, a competitor's, or a site you're evaluating for outreach. Backlink data is public-web data, so no site ownership or verification is needed.",
},
{
question: "What is domain rank?",
@@ -38,114 +45,41 @@ const FAQS = [
},
];
-function BacklinkCheckerPage() {
- return (
- <article className="mx-auto max-w-5xl">
- <header className="max-w-3xl">
- <p className="text-sm font-medium text-[var(--color-brand-accent)]">
- Free tool
- </p>
- <h1 className="mt-3 text-4xl font-semibold leading-tight tracking-tight text-neutral-950 md:text-6xl">
- Free Backlink Checker
- </h1>
- <p className="mt-5 text-lg leading-8 text-[var(--color-brand-muted)]">
- Check the backlinks of any website. Enter a domain and get its domain
- rank, referring domains, and top backlinks with anchor text and follow
- status.
- </p>
- </header>
-
- <div className="mt-8">
- <BacklinkCheckerTool />
- </div>
-
- <section className="mt-12">
- <h2 className="text-2xl font-semibold tracking-tight text-neutral-950">
- What you get
- </h2>
- <ol className="mt-5 grid gap-4 md:grid-cols-3">
- {[
- {
- title: "Link profile summary",
- description:
- "Domain rank, total backlinks, referring domains, and broken backlinks for the domain you check.",
- },
- {
- title: "Top backlinks",
- description:
- "The strongest links pointing at the domain, one per referring domain, with anchor text and follow status.",
- },
- {
- title: "Competitor visibility",
- description:
- "Works on any domain, so you can see who links to competitors and where their authority comes from.",
- },
- ].map((item, index) => (
- <li
- key={item.title}
- className="rounded-lg border border-[var(--color-border-subtle)] bg-white p-5"
- >
- <span className="font-mono text-sm tabular-nums text-[var(--color-brand-accent)]">
- {String(index + 1).padStart(2, "0")}
- </span>
- <h3 className="mt-4 text-base font-semibold text-neutral-950">
- {item.title}
- </h3>
- <p className="mt-2 text-sm leading-6 text-[var(--color-brand-muted)]">
- {item.description}
- </p>
- </li>
- ))}
- </ol>
- </section>
+const HIGHLIGHTS = [
+ {
+ title: "Link profile summary",
+ description:
+ "Domain rank, total backlinks, referring domains, and broken backlinks for the domain you check.",
+ },
+ {
+ title: "Top backlinks",
+ description:
+ "The strongest links pointing at the domain, one per referring domain, with anchor text and follow status.",
+ },
+ {
+ title: "Competitor visibility",
+ description:
+ "Works on any domain, so you can see who links to competitors and where their authority comes from.",
+ },
+];
- <section className="mt-12">
- <h2 className="text-2xl font-semibold tracking-tight text-neutral-950">
- FAQ
- </h2>
- <div className="mt-5 divide-y divide-[var(--color-border-subtle)] rounded-lg border border-[var(--color-border-subtle)] bg-white">
- {FAQS.map((faq) => (
- <div key={faq.question} className="p-5">
- <h3 className="text-sm font-semibold text-neutral-900">
- {faq.question}
- </h3>
- <p className="mt-1.5 text-sm leading-6 text-[var(--color-brand-muted)]">
- {faq.answer}
- </p>
- </div>
- ))}
- </div>
- </section>
+function BacklinkCheckerPage() {
+ const { target } = Route.useSearch();
- <section className="mt-12 rounded-xl border border-[var(--color-border-subtle)] bg-white p-6 md:p-8">
- <h2 className="text-2xl font-semibold tracking-tight text-neutral-950">
- Go deeper than a spot check
- </h2>
- <p className="mt-2 max-w-2xl text-sm leading-6 text-[var(--color-brand-muted)]">
- OpenSEO puts full backlink analysis next to keyword research, rank
- tracking, and site audits — open source, starting free.
- </p>
- <div className="mt-4 flex flex-wrap items-center gap-4">
- <a
- href="https://app.openseo.so/sign-up"
- className="inline-flex h-10 items-center justify-center rounded-lg bg-neutral-950 px-4 text-sm font-medium text-white transition-colors hover:bg-neutral-800"
- >
- Try OpenSEO
- <span aria-hidden="true" className="ml-2">
- &rarr;
- </span>
- </a>
- <a
- href="/features/backlink-checker"
- className="text-sm font-medium text-neutral-950 underline decoration-[var(--color-brand-accent)] underline-offset-4"
- >
- Learn about the Backlinks feature
- <span aria-hidden="true" className="ml-1">
- &rarr;
- </span>
- </a>
- </div>
- </section>
- </article>
+ return (
+ <ToolFrame
+ tool={TOOL}
+ heading="Free Backlink Checker"
+ subhead="Check the backlinks of any website. Enter a domain and get its domain rank, referring domains, and top backlinks with anchor text and follow status."
+ highlights={HIGHLIGHTS}
+ faqs={FAQS}
+ cta={{
+ heading: "Explore more backlinks",
+ body: "Browse referring domains, review anchor text, and filter backlinks in OpenSEO. Start with free trial credits.",
+ featureLabel: "Learn about the Backlinks feature",
+ }}
+ >
+ <BacklinkCheckerTool initialTarget={target} />
+ </ToolFrame>
);
}
diff --git a/web/src/routes/_marketing/competitor-analysis.tsx b/web/src/routes/_marketing/competitor-analysis.tsx
new file mode 100644
index 00000000..56f65354
--- /dev/null
+++ b/web/src/routes/_marketing/competitor-analysis.tsx
@@ -0,0 +1,91 @@
+import { createFileRoute } from "@tanstack/react-router";
+import { CompetitorAnalysisTool } from "@/components/competitor-analysis-tool";
+import { ToolFrame } from "@/lib/free-tools/tool-frame";
+import { freeTools } from "@/lib/free-tools/tool-pages";
+import { buildPageSeo } from "@/lib/seo";
+
+const TOOL = freeTools["competitor-analysis"];
+
+export const Route = createFileRoute("/_marketing/competitor-analysis")({
+ head: () =>
+ buildPageSeo({
+ title: "Free SEO Competitor Analysis Tool",
+ description:
+ "See a competitor's top organic keywords and pages, compare their traffic to yours, and find the keywords they rank for that you don't. No signup, no email.",
+ path: TOOL.path,
+ titleSuffix: "OpenSEO",
+ imageAlt: "OpenSEO free SEO competitor analysis tool",
+ }),
+ component: CompetitorAnalysisPage,
+});
+
+const FAQS = [
+ {
+ question: "How many keywords does the free tool show?",
+ answer:
+ "The competitor's top 20 organic keywords by estimated traffic, their top 10 pages, and up to 20 keywords they rank for that you don't. The report tells you how many keywords are in the index in total.",
+ },
+ {
+ question: "Do I have to enter my own domain?",
+ answer:
+ "No. Without it you get the competitor's keywords and pages. Add your domain and you also get a side-by-side traffic comparison and the keyword gap between you.",
+ },
+ {
+ question: "Where does the data come from?",
+ answer:
+ "DataForSEO's Labs index, the same source behind OpenSEO's competitor research. Traffic figures are modelled estimates, not the competitor's analytics.",
+ },
+ {
+ question: "Which competitor should I check?",
+ answer:
+ "Choose a site that ranks for keywords relevant to your business. It may differ from the competitors you encounter in sales.",
+ },
+];
+
+const HIGHLIGHTS = [
+ {
+ title: "Their best keywords",
+ description:
+ "The top 20 keywords a competitor ranks for, with search volume, difficulty, position, and the URL that ranks.",
+ },
+ {
+ title: "Their best pages",
+ description:
+ "The 10 pages with the highest estimated organic traffic, so you can see which content brings visitors.",
+ },
+ {
+ title: "The gap against you",
+ description:
+ "Add your domain to see estimated traffic side by side and the keywords they rank for that you don't show up for at all.",
+ },
+];
+
+function CompetitorAnalysisPage() {
+ return (
+ <ToolFrame
+ tool={TOOL}
+ heading="Free SEO Competitor Analysis Tool"
+ subhead="Look up any competitor's organic keywords and top pages, compare their search traffic to yours, and find keywords they rank for that you don't."
+ highlights={HIGHLIGHTS}
+ faqs={FAQS}
+ cta={{
+ heading: "Turn the gap into a plan",
+ body: "Browse more competitor keywords in OpenSEO, save the relevant ones, and add them to rank tracking. Start with free trial credits.",
+ featureLabel: "Learn about Domain Overview",
+ }}
+ >
+ <CompetitorAnalysisTool />
+ <p className="mt-4 text-sm leading-6 text-[var(--color-brand-muted)]">
+ New to this? The{" "}
+ <a
+ href="/library/competitive-analysis/find-your-real-competitors"
+ className="font-medium text-neutral-950 underline decoration-[var(--color-brand-accent)] underline-offset-4"
+ >
+ competitive analysis library
+ </a>{" "}
+ covers how to pick the right competitors before you start pulling their
+ keywords.
+ </p>
+ </ToolFrame>
+ );
+}
diff --git a/web/src/routes/_marketing/competitor-keyword-finder.tsx b/web/src/routes/_marketing/competitor-keyword-finder.tsx
new file mode 100644
index 00000000..71e17ceb
--- /dev/null
+++ b/web/src/routes/_marketing/competitor-keyword-finder.tsx
@@ -0,0 +1,91 @@
+import { createFileRoute } from "@tanstack/react-router";
+import { KeywordDiscoveryTool } from "@/components/keyword-discovery-tool";
+import { ToolFrame } from "@/lib/free-tools/tool-frame";
+import { freeTools } from "@/lib/free-tools/tool-pages";
+import { buildPageSeo } from "@/lib/seo";
+const TOOL = freeTools["competitor-keyword-finder"];
+export const Route = createFileRoute("/_marketing/competitor-keyword-finder")({
+ head: () =>
+ buildPageSeo({
+ title: "Free Competitor Keyword Finder",
+ description:
+ "Find the keywords a competitor ranks for on Google, with search volumes, ranking positions, and the pages that rank. Enter a domain to get started.",
+ path: TOOL.path,
+ titleSuffix: "OpenSEO",
+ imageAlt: "Free Competitor Keyword Finder",
+ }),
+ component: Page,
+});
+const HIGHLIGHTS = [
+ {
+ title: "Their top keywords",
+ description:
+ "See up to 20 organic keywords, starting with those estimated to bring the most Google traffic.",
+ },
+ {
+ title: "Search demand and difficulty",
+ description:
+ "Compare estimated monthly search volume and difficulty where available before choosing what to target.",
+ },
+ {
+ title: "The pages that rank",
+ description:
+ "Open the ranking URL for each keyword to see the content you would compete with.",
+ },
+];
+const FAQS = [
+ {
+ question: "Can I check my own website?",
+ answer:
+ "Yes. Enter your domain or a competitor’s domain. You don’t need to know any of its keywords beforehand.",
+ },
+ {
+ question: "How is this different from a rank checker?",
+ answer:
+ "A rank checker checks the position of a keyword you already know. This tool discovers keywords a domain ranks for, so you can find ideas you haven’t considered.",
+ },
+ {
+ question: "Where does the data come from?",
+ answer:
+ "Results come from DataForSEO’s Google keyword database for the selected country. They are a sample of known rankings, not a live Google search or a complete list. Results may be cached for 24 hours.",
+ },
+ {
+ question: "Can I see their top pages or compare two sites?",
+ answer:
+ "Use our Competitor Analysis tool for top pages and an optional keyword comparison with your own domain.",
+ },
+ {
+ question: "Is this free?",
+ answer:
+ "Yes. This tool returns up to 20 keywords without signup. Usage limits apply. The full OpenSEO workspace uses paid credits; free trial credits are available to get started.",
+ },
+];
+function Page() {
+ return (
+ <ToolFrame
+ tool={TOOL}
+ heading={"Free Competitor Keyword Finder"}
+ subhead={
+ "Find the keywords a competitor ranks for on Google, with search volumes, ranking positions, and the pages that rank. Enter a domain to get started."
+ }
+ highlights={HIGHLIGHTS}
+ faqs={FAQS}
+ cta={{
+ heading: "Choose your next content topic",
+ body: "Continue your research in OpenSEO and save keywords to your project. Start with free trial credits.",
+ featureLabel: "Explore Domain Overview",
+ }}
+ >
+ <KeywordDiscoveryTool tool={"competitor-keyword-finder"} />
+ <p className="mt-4 text-sm leading-6 text-[var(--color-brand-muted)]">
+ Want their top pages and a comparison with your site?{" "}
+ <a
+ className="font-medium text-neutral-950 underline underline-offset-4"
+ href="/competitor-analysis"
+ >
+ Try Competitor Analysis &rarr;
+ </a>
+ </p>
+ </ToolFrame>
+ );
+}
diff --git a/web/src/routes/_marketing/domain-age-checker.tsx b/web/src/routes/_marketing/domain-age-checker.tsx
new file mode 100644
index 00000000..087fe963
--- /dev/null
+++ b/web/src/routes/_marketing/domain-age-checker.tsx
@@ -0,0 +1,80 @@
+import { createFileRoute } from "@tanstack/react-router";
+import { DomainAgeCheckerTool } from "@/components/domain-age-checker-tool";
+import { ToolFrame } from "@/lib/free-tools/tool-frame";
+import { freeTools } from "@/lib/free-tools/tool-pages";
+import { buildPageSeo } from "@/lib/seo";
+
+const TOOL = freeTools["domain-age-checker"];
+
+export const Route = createFileRoute("/_marketing/domain-age-checker")({
+ head: () =>
+ buildPageSeo({
+ title: "Free Domain Age Checker: Registration Date and Age",
+ description:
+ "Check when a domain was registered, how old it is, when it expires, and who the registrar is — up to 10 domains at once. No signup, no email.",
+ path: TOOL.path,
+ titleSuffix: "OpenSEO",
+ imageAlt: "OpenSEO free domain age checker",
+ }),
+ component: DomainAgeCheckerPage,
+});
+
+const FAQS = [
+ {
+ question: "Does domain age affect rankings?",
+ answer:
+ "Barely, on its own. Google has said age isn't a ranking factor. What correlates with age is everything a site accumulates over years — links, content, brand searches — and those do matter. Old and empty ranks worse than new and useful.",
+ },
+ {
+ question: "Where does this data come from?",
+ answer:
+ "RDAP, the registry protocol that replaced WHOIS. The lookup goes straight to the registry that holds the domain, so there's no third-party data source and nothing to pay for.",
+ },
+ {
+ question: "Why does a domain show no registration data?",
+ answer:
+ "Some country-code TLDs don't publish RDAP records, and some registries hide dates. The tool says so for that row rather than guessing, and the other domains in your list still return.",
+ },
+ {
+ question: "Is the age the same as when the site launched?",
+ answer:
+ "No. It's when the domain was first registered. A domain can sit parked for years, or change hands and start over with new content. Check what it ranks for before drawing conclusions.",
+ },
+];
+
+const HIGHLIGHTS = [
+ {
+ title: "Age in years and months",
+ description:
+ "Registration date, age in years and months, last update, and expiry for every domain you paste in.",
+ },
+ {
+ title: "Registrar on record",
+ description:
+ "Who the domain is registered through, when the registry publishes it.",
+ },
+ {
+ title: "Ten at a time",
+ description:
+ "Useful when you're sizing up a list of link prospects or expired domains and want the dates in one table.",
+ },
+];
+
+function DomainAgeCheckerPage() {
+ return (
+ <ToolFrame
+ tool={TOOL}
+ heading="Free Domain Age Checker"
+ subhead="See when a domain was registered, how old it is, when it expires, and which registrar it uses. Up to 10 domains at once, straight from the registry."
+ highlights={HIGHLIGHTS}
+ faqs={FAQS}
+ cta={{
+ heading: "Check the domain's rankings and links",
+ body: "Look up the domain's ranking keywords and backlinks in OpenSEO. Start with free trial credits.",
+ featureLabel: "Learn about Domain Overview",
+ }}
+ >
+ <DomainAgeCheckerTool />
+ </ToolFrame>
+ );
+}
diff --git a/web/src/routes/_marketing/keyword-generator.tsx b/web/src/routes/_marketing/keyword-generator.tsx
new file mode 100644
index 00000000..303ced89
--- /dev/null
+++ b/web/src/routes/_marketing/keyword-generator.tsx
@@ -0,0 +1,91 @@
+import { createFileRoute } from "@tanstack/react-router";
+import { KeywordDiscoveryTool } from "@/components/keyword-discovery-tool";
+import { ToolFrame } from "@/lib/free-tools/tool-frame";
+import { freeTools } from "@/lib/free-tools/tool-pages";
+import { buildPageSeo } from "@/lib/seo";
+const TOOL = freeTools["keyword-generator"];
+export const Route = createFileRoute("/_marketing/keyword-generator")({
+ head: () =>
+ buildPageSeo({
+ title: "Free Keyword Generator",
+ description:
+ "Start with a topic and find keyword ideas people search for. Compare estimated search volume and difficulty in your target country.",
+ path: TOOL.path,
+ titleSuffix: "OpenSEO",
+ imageAlt: "Free Keyword Generator",
+ }),
+ component: Page,
+});
+const HIGHLIGHTS = [
+ {
+ title: "Ideas from a topic",
+ description:
+ "Get up to 20 keyword suggestions from a short phrase, such as email marketing or running shoes.",
+ },
+ {
+ title: "Monthly search volume",
+ description:
+ "See estimated Google searches in your selected country. Use volume to compare demand, not to predict visits.",
+ },
+ {
+ title: "Difficulty estimates",
+ description:
+ "Use the available 0–100 difficulty scores as an initial check, then review the search results before choosing a keyword.",
+ },
+];
+const FAQS = [
+ {
+ question: "Does this use AI to invent keywords?",
+ answer:
+ "No. Suggestions come from DataForSEO’s Google keyword database, with available volume and difficulty metrics. Some topics or countries may return few or no ideas.",
+ },
+ {
+ question: "How should I choose a starting topic?",
+ answer:
+ "Use a short phrase that describes your product, service, or audience’s problem. If the results are too broad, try a more specific phrase; if there are no results, try a broader one.",
+ },
+ {
+ question: "What do missing metrics mean?",
+ answer:
+ "A dash means the provider has no value for that metric. It does not mean zero searches or zero competition. Volumes are estimates, and close variations can share the same estimate.",
+ },
+ {
+ question: "How current are the results?",
+ answer:
+ "The tool uses DataForSEO’s keyword database, which is updated periodically. Results may be cached for up to 24 hours; they are not a real-time count of searches.",
+ },
+ {
+ question: "Is this free?",
+ answer:
+ "Yes. You can get up to 20 keyword ideas without signup. Usage limits apply. The full OpenSEO workspace uses paid credits. Free trial credits are available to get started.",
+ },
+];
+function Page() {
+ return (
+ <ToolFrame
+ tool={TOOL}
+ heading={"Free Keyword Generator"}
+ subhead={
+ "Start with a topic and find keyword ideas people search for. Compare estimated search volume and difficulty in your target country."
+ }
+ highlights={HIGHLIGHTS}
+ faqs={FAQS}
+ cta={{
+ heading: "Choose your next content topic",
+ body: "Continue your research in OpenSEO and save keywords to your project. Start with free trial credits.",
+ featureLabel: "Explore keyword research",
+ }}
+ >
+ <KeywordDiscoveryTool tool={"keyword-generator"} />
+ <p className="mt-4 text-sm leading-6 text-[var(--color-brand-muted)]">
+ Already know a competitor in your space?{" "}
+ <a
+ className="font-medium text-neutral-950 underline underline-offset-4"
+ href="/competitor-keyword-finder"
+ >
+ Find their ranking keywords &rarr;
+ </a>
+ </p>
+ </ToolFrame>
+ );
+}
diff --git a/web/src/routes/_marketing/serp-simulator.tsx b/web/src/routes/_marketing/serp-simulator.tsx
new file mode 100644
index 00000000..19031c0b
--- /dev/null
+++ b/web/src/routes/_marketing/serp-simulator.tsx
@@ -0,0 +1,81 @@
+import { createFileRoute } from "@tanstack/react-router";
+import { SerpSimulatorTool } from "@/components/serp-simulator-tool";
+import { ToolFrame } from "@/lib/free-tools/tool-frame";
+import { freeTools } from "@/lib/free-tools/tool-pages";
+import { buildPageSeo } from "@/lib/seo";
+
+const TOOL = freeTools["serp-simulator"];
+
+export const Route = createFileRoute("/_marketing/serp-simulator")({
+ head: () =>
+ buildPageSeo({
+ title:
+ "Free SERP Simulator: Preview Your Google Title and Meta Description",
+ description:
+ "Preview your title and meta description in desktop and mobile search results, with pixel measurements and approximate truncation. No signup, no email.",
+ path: TOOL.path,
+ titleSuffix: "OpenSEO",
+ imageAlt: "OpenSEO free SERP snippet simulator",
+ }),
+ component: SerpSimulatorPage,
+});
+
+const FAQS = [
+ {
+ question: "How long should a title tag be?",
+ answer:
+ "Keep the main topic near the start. This preview uses a 600-pixel desktop title and a two-line mobile title as guides. Letter widths vary, so character count alone does not tell you whether a title will fit.",
+ },
+ {
+ question: "How long should a meta description be?",
+ answer:
+ "Put the most useful information first. This preview allows two lines on desktop and three on mobile, including the optional date. Actual snippets vary by query and screen size.",
+ },
+ {
+ question: "Does this guarantee what Google will show?",
+ answer:
+ "No. Google rewrites titles and descriptions regularly, especially when they don't match the query. This is an approximation; Google may choose different text, fonts, or layout.",
+ },
+ {
+ question: "Does this tool send my text anywhere?",
+ answer:
+ "No. Your title, description, and URL stay in your browser. The preview updates as you type.",
+ },
+];
+
+const HIGHLIGHTS = [
+ {
+ title: "Measure title width",
+ description:
+ "See the width of your title in the preview font, alongside its character count.",
+ },
+ {
+ title: "Desktop and mobile",
+ description:
+ "Switch between desktop and mobile previews to check how your text wraps.",
+ },
+ {
+ title: "Nothing leaves the page",
+ description:
+ "Your title and description stay in your browser. No account is needed.",
+ },
+];
+
+function SerpSimulatorPage() {
+ return (
+ <ToolFrame
+ tool={TOOL}
+ heading="Free SERP Simulator"
+ subhead="Preview your Google title and meta description on desktop and mobile. Check the length and wording before you publish."
+ highlights={HIGHLIGHTS}
+ faqs={FAQS}
+ cta={{
+ heading: "Find every page that needs this",
+ body: "Find missing, duplicate, and long titles and descriptions with an OpenSEO site audit. Start with free trial credits.",
+ featureLabel: "Learn about Site Audit",
+ }}
+ >
+ <SerpSimulatorTool />
+ </ToolFrame>
+ );
+}
diff --git a/web/src/routes/_marketing/spam-score-checker.tsx b/web/src/routes/_marketing/spam-score-checker.tsx
new file mode 100644
index 00000000..aed39ce7
--- /dev/null
+++ b/web/src/routes/_marketing/spam-score-checker.tsx
@@ -0,0 +1,80 @@
+import { createFileRoute } from "@tanstack/react-router";
+import { SpamScoreCheckerTool } from "@/components/spam-score-checker-tool";
+import { ToolFrame } from "@/lib/free-tools/tool-frame";
+import { freeTools } from "@/lib/free-tools/tool-pages";
+import { buildPageSeo } from "@/lib/seo";
+
+const TOOL = freeTools["spam-score-checker"];
+
+export const Route = createFileRoute("/_marketing/spam-score-checker")({
+ head: () =>
+ buildPageSeo({
+ title: "Free Backlink Spam Score Checker",
+ description:
+ "Check a domain's backlink spam score and see the spammiest links pointing at it. No signup, no email.",
+ path: TOOL.path,
+ titleSuffix: "OpenSEO",
+ imageAlt: "OpenSEO free backlink spam score checker",
+ }),
+ component: SpamScoreCheckerPage,
+});
+
+const FAQS = [
+ {
+ question: "What does the spam score actually measure?",
+ answer:
+ "DataForSEO scores a link profile from 0 to 100 by looking at signals its index associates with low-quality sites — thin or duplicated content, link networks, unusual outbound link patterns. Higher means more of those signals. It is not a Google penalty score; Google publishes no such number.",
+ },
+ {
+ question: "Should I disavow the links you show?",
+ answer:
+ "Usually not. Google ignores most low-quality links on its own, and disavowing good links does real damage. Treat a high score as a reason to look, not as a to-do list.",
+ },
+ {
+ question: "How many links does the free check show?",
+ answer:
+ "The 10 highest-spam referring domains, one link each. OpenSEO lets you filter the full backlink profile by spam score and see how much of the profile is affected.",
+ },
+ {
+ question: "Where does the data come from?",
+ answer:
+ "DataForSEO's backlink index, cached for 24 hours per domain. It's the same data OpenSEO uses for backlink research.",
+ },
+];
+
+const HIGHLIGHTS = [
+ {
+ title: "Two spam scores",
+ description:
+ "One for the links pointing at the domain, one for the domain itself. They answer different questions and often disagree.",
+ },
+ {
+ title: "The worst offenders",
+ description:
+ "The 10 spammiest referring domains, with the linking page, anchor text, and whether the link is follow or nofollow.",
+ },
+ {
+ title: "Put the score in context",
+ description:
+ "See spam scores alongside referring domains and domain rank. Use a high score as a reason to review the links, not as proof of a penalty.",
+ },
+];
+
+function SpamScoreCheckerPage() {
+ return (
+ <ToolFrame
+ tool={TOOL}
+ heading="Free Backlink Spam Score Checker"
+ subhead="Check how spammy a domain's backlink profile looks, and see which referring domains are dragging the score up."
+ highlights={HIGHLIGHTS}
+ faqs={FAQS}
+ cta={{
+ heading: "Review more of the backlink profile",
+ body: "Filter backlinks by spam score, rank, and follow status in OpenSEO. Start with free trial credits.",
+ featureLabel: "Learn about Backlinks",
+ }}
+ >
+ <SpamScoreCheckerTool />
+ </ToolFrame>
+ );
+}
diff --git a/web/src/routes/_marketing/tools.tsx b/web/src/routes/_marketing/tools.tsx
new file mode 100644
index 00000000..9aa9d9cc
--- /dev/null
+++ b/web/src/routes/_marketing/tools.tsx
@@ -0,0 +1,129 @@
+import { createFileRoute } from "@tanstack/react-router";
+import { freeToolList } from "@/lib/free-tools/tool-pages";
+import { buildBreadcrumbJsonLd, buildPageSeo } from "@/lib/seo";
+
+export const Route = createFileRoute("/_marketing/tools")({
+ head: () =>
+ buildPageSeo({
+ title: "Free SEO Tools",
+ description:
+ "Find competitor keywords, generate keyword ideas, and check backlinks, traffic, spam score, and domain age with OpenSEO’s free SEO tools. No signup.",
+ path: "/tools",
+ titleSuffix: "OpenSEO",
+ imageAlt: "OpenSEO free SEO tools",
+ }),
+ component: ToolsPage,
+});
+
+const breadcrumbLd = buildBreadcrumbJsonLd([
+ { name: "Home", path: "/" },
+ { name: "Free tools", path: "/tools" },
+]);
+
+function ToolsPage() {
+ return (
+ <article className="mx-auto max-w-5xl">
+ <header className="max-w-3xl">
+ <p className="text-sm font-medium text-[var(--color-brand-accent)]">
+ Free tools
+ </p>
+ <h1 className="mt-3 text-4xl font-semibold leading-tight tracking-tight text-neutral-950 md:text-6xl">
+ Free SEO Tools
+ </h1>
+ <p className="mt-5 text-lg leading-8 text-[var(--color-brand-muted)]">
+ Check backlinks, rankings, traffic, and domain details, or preview a
+ search result. Use these tools without an account.
+ </p>
+ </header>
+
+ <div className="mt-10 grid gap-4 md:grid-cols-2">
+ {freeToolList.map((tool) => (
+ <a
+ key={tool.slug}
+ href={tool.path}
+ className="rounded-lg border border-[var(--color-border-subtle)] bg-white p-5 transition-colors hover:border-neutral-900"
+ >
+ <div className="flex items-baseline justify-between gap-3">
+ <h2 className="text-base font-semibold text-neutral-950">
+ {tool.name}
+ <span
+ aria-hidden="true"
+ className="ml-1 text-[var(--color-brand-accent)]"
+ >
+ &rarr;
+ </span>
+ </h2>
+ </div>
+ <p className="mt-2 text-sm leading-6 text-[var(--color-brand-muted)]">
+ {tool.shortDescription}
+ </p>
+ </a>
+ ))}
+ </div>
+
+ <section className="mt-10">
+ <h2 className="text-xl font-semibold text-neutral-950">
+ Connect your Search Console data
+ </h2>
+ <a
+ href="/google-search-console-mcp"
+ className="mt-4 block rounded-lg border border-[var(--color-border-subtle)] bg-white p-5 transition-colors hover:border-neutral-900"
+ >
+ <div className="flex items-baseline justify-between gap-3">
+ <h2 className="text-base font-semibold text-neutral-950">
+ Google Search Console MCP
+ <span
+ aria-hidden="true"
+ className="ml-1 text-[var(--color-brand-accent)]"
+ >
+ &rarr;
+ </span>
+ </h2>
+ </div>
+ <p className="mt-2 text-sm leading-6 text-[var(--color-brand-muted)]">
+ Point Claude, Codex, or any MCP client at your own Search Console
+ data. Connect your Google account to get started; no Google Cloud
+ project is needed.
+ </p>
+ </a>
+ </section>
+
+ <section className="mt-12 rounded-xl border border-[var(--color-border-subtle)] bg-white p-6 md:p-8">
+ <h2 className="text-2xl font-semibold tracking-tight text-neutral-950">
+ Why these are free
+ </h2>
+ <p className="mt-2 max-w-2xl text-sm leading-6 text-[var(--color-brand-muted)]">
+ These tools give you a useful first look at a website without an
+ account. Data lookups have usage limits to keep them free. For more
+ research, OpenSEO brings keyword research, rank tracking, backlinks,
+ and site audits into one workspace, with trial credits to get started.
+ </p>
+ <div className="mt-4 flex flex-wrap items-center gap-4">
+ <a
+ href="https://app.openseo.so/sign-up"
+ className="inline-flex h-10 items-center justify-center rounded-lg bg-neutral-950 px-4 text-sm font-medium text-white transition-colors hover:bg-neutral-800"
+ >
+ Try OpenSEO
+ <span aria-hidden="true" className="ml-2">
+ &rarr;
+ </span>
+ </a>
+ <a
+ href="/features"
+ className="text-sm font-medium text-neutral-950 underline decoration-[var(--color-brand-accent)] underline-offset-4"
+ >
+ See all features
+ <span aria-hidden="true" className="ml-1">
+ &rarr;
+ </span>
+ </a>
+ </div>
+ </section>
+
+ <script
+ type="application/ld+json"
+ dangerouslySetInnerHTML={{ __html: JSON.stringify(breadcrumbLd) }}
+ />
+ </article>
+ );
+}
diff --git a/web/src/routes/_marketing/website-traffic-checker.tsx b/web/src/routes/_marketing/website-traffic-checker.tsx
new file mode 100644
index 00000000..54f6c559
--- /dev/null
+++ b/web/src/routes/_marketing/website-traffic-checker.tsx
@@ -0,0 +1,81 @@
+import { createFileRoute } from "@tanstack/react-router";
+import { WebsiteTrafficCheckerTool } from "@/components/website-traffic-checker-tool";
+import { ToolFrame } from "@/lib/free-tools/tool-frame";
+import { freeTools } from "@/lib/free-tools/tool-pages";
+import { buildPageSeo } from "@/lib/seo";
+
+const TOOL = freeTools["website-traffic-checker"];
+
+export const Route = createFileRoute("/_marketing/website-traffic-checker")({
+ head: () =>
+ buildPageSeo({
+ title:
+ "Free Website Traffic Checker: Estimate Any Site's Organic Traffic",
+ description:
+ "Estimate any website's organic traffic, keyword count, and traffic value, with its top keywords and pages. Compare two domains. No signup, no email.",
+ path: TOOL.path,
+ titleSuffix: "OpenSEO",
+ imageAlt: "OpenSEO free website traffic checker",
+ }),
+ component: WebsiteTrafficCheckerPage,
+});
+
+const FAQS = [
+ {
+ question: "How accurate are these traffic numbers?",
+ answer:
+ "DataForSEO estimates organic traffic from rankings and search volume. Use these estimates to compare domains; they do not measure actual visits.",
+ },
+ {
+ question: "Why does this differ from Google Analytics?",
+ answer:
+ "Analytics counts the visits that actually happened, across every channel. This estimates organic search visits only, for one country, from ranking data. Differences are expected.",
+ },
+ {
+ question: "How much do I get for free?",
+ answer:
+ "The summary metrics plus the top 5 keywords and top 5 pages per domain, for one country at a time. OpenSEO lets you browse more keywords and pages, filter the results, and save keywords for rank tracking.",
+ },
+ {
+ question: "Where does the data come from?",
+ answer:
+ "DataForSEO's Labs index — the same source behind OpenSEO's domain overview. Results are cached for 24 hours per domain and country.",
+ },
+];
+
+const HIGHLIGHTS = [
+ {
+ title: "Organic traffic estimate",
+ description:
+ "Estimated monthly organic visits, how many keywords the domain ranks for, and what that traffic would cost to buy.",
+ },
+ {
+ title: "Top keywords and pages",
+ description:
+ "The five keywords driving the most traffic and the five pages earning it, with volume, position, and ranking URL.",
+ },
+ {
+ title: "Compare two domains",
+ description:
+ "Add a second domain to compare traffic and keyword counts, then explore the top keywords and pages for each site.",
+ },
+];
+
+function WebsiteTrafficCheckerPage() {
+ return (
+ <ToolFrame
+ tool={TOOL}
+ heading="Free Website Traffic Checker"
+ subhead="Estimate how much organic search traffic any website gets, which keywords bring it, and which pages earn it. Add a second domain to compare."
+ highlights={HIGHLIGHTS}
+ faqs={FAQS}
+ cta={{
+ heading: "Explore more keywords and pages",
+ body: "Explore domain reports, save promising keywords, and track their rankings in OpenSEO. Start with free trial credits.",
+ featureLabel: "Learn about Domain Overview",
+ }}
+ >
+ <WebsiteTrafficCheckerTool />
+ </ToolFrame>
+ );
+}
diff --git a/web/src/routes/api/backlink-check.ts b/web/src/routes/api/backlink-check.ts
index 302801ce..3e043ff4 100644
--- a/web/src/routes/api/backlink-check.ts
+++ b/web/src/routes/api/backlink-check.ts
@@ -1,37 +1,30 @@
import { createFileRoute } from "@tanstack/react-router";
-import { env } from "cloudflare:workers";
import { z } from "zod";
-
-const DATAFORSEO_BASE = "https://api.dataforseo.com";
+import {
+ cacheableJson,
+ chargeToolBudget,
+ dataforseoKey,
+ failureResponse,
+ fetchDataforseoResult,
+ guardToolRequest,
+ jsonResponse,
+ readToolBody,
+ normalizeDomain,
+ readCached,
+ serviceUnavailable,
+ writeCached,
+} from "@/lib/free-tools/server";
+import { freeTools } from "@/lib/free-tools/tool-pages";
+
+const TOOL = freeTools["backlink-checker"];
const TOP_BACKLINKS_LIMIT = 15;
const CACHE_TTL_SECONDS = 86_400;
-// Hard ceiling on paid DataForSEO lookups per day (~$0.04 each). Cached
-// checks don't count. Bumping this is a deliberate spend decision.
-const DAILY_CHECK_BUDGET = 500;
const requestSchema = z.object({
target: z.string().trim().min(1, "Enter a domain").max(300),
turnstileToken: z.string().max(4096).optional(),
});
-// DataForSEO task envelope: HTTP 200 with per-task status codes; 20000 = ok.
-const taskEnvelopeSchema = z.object({
- tasks: z
- .array(
- z
- .object({
- status_code: z.number().optional(),
- status_message: z.string().optional(),
- result: z
- .array(z.record(z.string(), z.unknown()))
- .nullable()
- .optional(),
- })
- .passthrough(),
- )
- .optional(),
-});
-
const summaryResultSchema = z
.object({
rank: z.number().nullable().optional(),
@@ -63,89 +56,31 @@ const backlinksResultSchema = z
})
.passthrough();
-type RateLimiter = {
- limit(options: { key: string }): Promise<{ success: boolean }>;
+type BacklinkCheck = {
+ target: string;
+ summary: {
+ rank: number | null;
+ backlinks: number | null;
+ referringDomains: number | null;
+ brokenBacklinks: number | null;
+ };
+ topBacklinks: Array<{
+ domainFrom: string | null;
+ urlFrom: string | null;
+ urlTo: string | null;
+ pageTitle: string | null;
+ anchor: string | null;
+ dofollow: boolean | null;
+ domainRank: number | null;
+ }>;
};
-type KvStore = {
- get(key: string): Promise<string | null>;
- put(
- key: string,
- value: string,
- options?: { expirationTtl?: number },
- ): Promise<void>;
-};
-
-function normalizeDomain(input: string): string | null {
- let hostname: string;
- try {
- hostname = new URL(input.includes("://") ? input : `https://${input}`)
- .hostname;
- } catch {
- return null;
- }
- const domain = hostname.replace(/^www\./, "").toLowerCase();
- const isValid =
- /^(?=.{1,253}$)[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$/.test(
- domain,
- );
- return isValid ? domain : null;
-}
-
-function jsonResponse(data: unknown, status = 200, headers?: HeadersInit) {
- return new Response(JSON.stringify(data), {
- status,
- headers: { "Content-Type": "application/json", ...headers },
- });
-}
-
-async function verifyTurnstile(
- secret: string,
- token: string,
- ip: string | null,
-): Promise<boolean> {
- const body = new URLSearchParams({ secret, response: token });
- if (ip) body.set("remoteip", ip);
- const response = await fetch(
- "https://challenges.cloudflare.com/turnstile/v0/siteverify",
- { method: "POST", body },
- );
- if (!response.ok) return false;
- const data = (await response.json()) as { success?: boolean };
- return data.success === true;
-}
-
-async function fetchDataforseoResult(
- path: string,
- payload: Record<string, unknown>,
- apiKey: string,
-) {
- const response = await fetch(`${DATAFORSEO_BASE}${path}`, {
- method: "POST",
- headers: {
- "Content-Type": "application/json",
- Authorization: `Basic ${apiKey}`,
- },
- body: JSON.stringify([payload]),
- signal: AbortSignal.timeout(30_000),
- });
- if (!response.ok) {
- throw new Error(`DataForSEO HTTP ${response.status} on ${path}`);
- }
- const task = taskEnvelopeSchema.parse(await response.json()).tasks?.[0];
- if (!task || task.status_code !== 20000) {
- throw new Error(
- `DataForSEO task ${task?.status_code ?? "missing"} on ${path}: ${task?.status_message ?? "no task"}`,
- );
- }
- return task.result?.[0] ?? null;
-}
-
export const Route = createFileRoute("/api/backlink-check")({
server: {
handlers: {
POST: async ({ request }) => {
- const body = await request.json().catch(() => null);
+ const body = await readToolBody(request);
+ if (body instanceof Response) return body;
const parsed = requestSchema.safeParse(body);
if (!parsed.success) {
return jsonResponse(
@@ -162,91 +97,30 @@ export const Route = createFileRoute("/api/backlink-check")({
);
}
- const apiKey = (env as any).DATAFORSEO_API_KEY as string | undefined;
- if (!apiKey) {
- console.error("Missing DATAFORSEO_API_KEY");
- return jsonResponse(
- { error: "Service temporarily unavailable" },
- 503,
- );
+ const apiKey = dataforseoKey();
+ if (!apiKey) return serviceUnavailable(TOOL.slug);
+
+ const blocked = await guardToolRequest({
+ tool: TOOL.slug,
+ request,
+ turnstileToken: parsed.data.turnstileToken,
+ });
+ if (blocked) return blocked;
+
+ const cached = await readCached<BacklinkCheck>(TOOL.slug, domain);
+ if (cached) {
+ return cached.ok
+ ? cacheableJson(cached.data, CACHE_TTL_SECONDS)
+ : failureResponse(cached.error);
}
- const ip = request.headers.get("cf-connecting-ip");
-
- // Bot check. Enforced only when the secret is configured, so local
- // dev and fresh deploys keep working without a Turnstile widget.
- const turnstileSecret = (env as any).TURNSTILE_SECRET_KEY as
- | string
- | undefined;
- if (turnstileSecret) {
- const token = parsed.data.turnstileToken;
- const verified = token
- ? await verifyTurnstile(turnstileSecret, token, ip)
- : false;
- if (!verified) {
- console.error(
- token
- ? "Turnstile siteverify rejected the token — VITE_TURNSTILE_SITE_KEY and TURNSTILE_SECRET_KEY may be from different widgets"
- : "TURNSTILE_SECRET_KEY is set but the request sent no token — VITE_TURNSTILE_SITE_KEY may be missing from the deployed build",
- );
- return jsonResponse(
- {
- error:
- "Human verification failed. Refresh the page and try again.",
- },
- 403,
- );
- }
- }
-
- const limiter = (env as any).BACKLINK_CHECK_RATE_LIMIT as
- | RateLimiter
- | undefined;
- if (limiter) {
- const { success } = await limiter.limit({ key: ip ?? "unknown" });
- if (!success) {
- return jsonResponse(
- { error: "Too many checks. Try again in a minute." },
- 429,
- );
- }
- }
-
- // Per-colo cache so repeat checks of the same domain don't re-bill.
- const cache = (caches as unknown as { default: Cache }).default;
- const cacheKey = new Request(
- `https://openseo.so/api/backlink-check/${domain}`,
- );
- const cached = await cache.match(cacheKey);
- if (cached) return cached;
-
- // Global daily budget. Best-effort: KV reads are edge-cached and the
- // increment is non-atomic, so the ceiling is approximate — the hard
- // spend bound is the DataForSEO account balance. Counts attempts, not
- // successes, so charged-but-failed calls still consume budget, and a
- // KV error can never fail a request the user already paid latency for.
- const kv = (env as any).BACKLINK_CHECK_KV as KvStore | undefined;
- if (kv) {
- const budgetKey = `daily-checks:${new Date().toISOString().slice(0, 10)}`;
- try {
- const stored = Number(await kv.get(budgetKey));
- const used = Number.isFinite(stored) ? stored : 0;
- if (used >= DAILY_CHECK_BUDGET) {
- return jsonResponse(
- {
- error:
- "The free checker has reached today's limit. Try again tomorrow, or sign up for OpenSEO for full backlink research.",
- },
- 429,
- );
- }
- await kv.put(budgetKey, String(used + 1), {
- expirationTtl: 2 * 86_400,
- });
- } catch (err) {
- console.error("Backlink check budget counter error:", err);
- }
- }
+ // summary/live + backlinks/live
+ const overBudget = await chargeToolBudget({
+ tool: TOOL.slug,
+ request,
+ calls: 2,
+ });
+ if (overBudget) return overBudget;
// Mirrors the app's backlinks defaults (src/server/lib/dataforseo/backlinks.ts).
const commonPayload = {
@@ -281,48 +155,48 @@ export const Route = createFileRoute("/api/backlink-check")({
const summary = summaryResultSchema.parse(summaryRaw ?? {});
const backlinks = backlinksResultSchema.parse(backlinksRaw ?? {});
- const topBacklinks = (backlinks.items ?? [])
- .filter((item) => item.type === "backlink" && item.url_from)
- .map((item) => ({
- domainFrom: item.domain_from ?? null,
- urlFrom: item.url_from ?? null,
- urlTo: item.url_to ?? null,
- pageTitle: item.page_from_title?.trim()
- ? item.page_from_title
- : null,
- anchor: item.anchor?.trim() ? item.anchor : null,
- dofollow: item.dofollow ?? null,
- domainRank: item.domain_from_rank ?? null,
- }));
-
- const response = jsonResponse(
- {
- target: domain,
- summary: {
- rank: summary.rank ?? null,
- backlinks: summary.backlinks ?? null,
- referringDomains: summary.referring_domains ?? null,
- brokenBacklinks: summary.broken_backlinks ?? null,
- },
- topBacklinks,
+ const result: BacklinkCheck = {
+ target: domain,
+ summary: {
+ rank: summary.rank ?? null,
+ backlinks: summary.backlinks ?? null,
+ referringDomains: summary.referring_domains ?? null,
+ brokenBacklinks: summary.broken_backlinks ?? null,
},
- 200,
- { "Cache-Control": `public, max-age=${CACHE_TTL_SECONDS}` },
+ topBacklinks: (backlinks.items ?? [])
+ .filter((item) => item.type === "backlink" && item.url_from)
+ .map((item) => ({
+ domainFrom: item.domain_from ?? null,
+ urlFrom: item.url_from ?? null,
+ urlTo: item.url_to ?? null,
+ pageTitle: item.page_from_title?.trim()
+ ? item.page_from_title
+ : null,
+ anchor: item.anchor?.trim() ? item.anchor : null,
+ dofollow: item.dofollow ?? null,
+ domainRank: item.domain_from_rank ?? null,
+ })),
+ };
+
+ await writeCached(
+ TOOL.slug,
+ domain,
+ { ok: true, data: result },
+ CACHE_TTL_SECONDS,
);
- await cache.put(cacheKey, response.clone());
- return response;
+ return cacheableJson(result, CACHE_TTL_SECONDS);
} catch (err) {
console.error("Backlink check error:", err);
// Negative cache: money was already spent, so stop an immediate
- // retry loop on a reliably-failing domain. 502s are only stored
- // when explicitly marked cacheable.
- const response = jsonResponse(
- { error: "Backlink check failed. Please try again." },
- 502,
- { "Cache-Control": "public, max-age=120" },
+ // retry loop on a reliably-failing domain.
+ const message = "Backlink check failed. Please try again.";
+ await writeCached(
+ TOOL.slug,
+ domain,
+ { ok: false, error: message },
+ 120,
);
- await cache.put(cacheKey, response.clone()).catch(() => {});
- return response;
+ return failureResponse(message);
}
},
},
diff --git a/web/src/routes/api/competitor-analysis.ts b/web/src/routes/api/competitor-analysis.ts
new file mode 100644
index 00000000..019423a9
--- /dev/null
+++ b/web/src/routes/api/competitor-analysis.ts
@@ -0,0 +1,327 @@
+import { createFileRoute } from "@tanstack/react-router";
+import { z } from "zod";
+import { countryLanguage } from "@/lib/free-tools/countries";
+import {
+ RANKED_KEYWORDS_ORDER,
+ readOrganicMetrics,
+ readRankedKeyword,
+ readRelevantPage,
+ RELEVANT_PAGES_ORDER,
+ type OrganicMetrics,
+ type RankedKeywordRow,
+ type RelevantPageRow,
+} from "@/lib/free-tools/labs";
+import {
+ cacheableJson,
+ chargeToolBudget,
+ dataforseoKey,
+ failureResponse,
+ fetchDataforseoResult,
+ guardToolRequest,
+ itemsResultSchema,
+ jsonResponse,
+ readToolBody,
+ normalizeDomain,
+ readCached,
+ serviceUnavailable,
+ writeCached,
+} from "@/lib/free-tools/server";
+import { freeTools } from "@/lib/free-tools/tool-pages";
+
+const TOOL = freeTools["competitor-analysis"];
+const CACHE_TTL_SECONDS = 86_400;
+const KEYWORD_LIMIT = 20;
+const PAGE_LIMIT = 10;
+const GAP_LIMIT = 20;
+
+const requestSchema = z.object({
+ competitor: z.string().trim().min(1, "Enter a competitor domain").max(300),
+ yourDomain: z.string().trim().max(300).optional(),
+ locationCode: z.number().int(),
+ turnstileToken: z.string().max(4096).optional(),
+});
+
+const intersectionItemSchema = z
+ .object({
+ keyword_data: z
+ .object({
+ keyword: z.string().nullable().optional(),
+ keyword_info: z
+ .object({ search_volume: z.number().nullable().optional() })
+ .passthrough()
+ .nullable()
+ .optional(),
+ keyword_properties: z
+ .object({ keyword_difficulty: z.number().nullable().optional() })
+ .passthrough()
+ .nullable()
+ .optional(),
+ })
+ .passthrough()
+ .nullable()
+ .optional(),
+ first_domain_serp_element: z
+ .object({
+ rank_group: z.number().nullable().optional(),
+ rank_absolute: z.number().nullable().optional(),
+ url: z.string().nullable().optional(),
+ etv: z.number().nullable().optional(),
+ })
+ .passthrough()
+ .nullable()
+ .optional(),
+ })
+ .passthrough();
+
+type GapRow = RankedKeywordRow & { traffic: number | null };
+
+type CompetitorAnalysis = {
+ competitor: string;
+ yourDomain: string | null;
+ locationCode: number;
+ keywords: RankedKeywordRow[];
+ totalKeywords: number | null;
+ pages: RelevantPageRow[];
+ totalPages: number | null;
+ comparison: {
+ competitor: OrganicMetrics;
+ you: OrganicMetrics;
+ } | null;
+ /**
+ * null when no domain was given OR when the gap lookup failed (see
+ * `gapFailed`); an empty array means the lookup worked and found nothing.
+ */
+ gap: GapRow[] | null;
+ gapFailed: boolean;
+};
+
+export const Route = createFileRoute("/api/competitor-analysis")({
+ server: {
+ handlers: {
+ POST: async ({ request }) => {
+ const body = await readToolBody(request);
+ if (body instanceof Response) return body;
+ const parsed = requestSchema.safeParse(body);
+ if (!parsed.success) {
+ return jsonResponse(
+ { error: parsed.error.issues[0]?.message ?? "Invalid request" },
+ 400,
+ );
+ }
+
+ const language = countryLanguage(parsed.data.locationCode);
+ if (!language) {
+ return jsonResponse({ error: "Pick a supported country" }, 400);
+ }
+
+ const competitor = normalizeDomain(parsed.data.competitor);
+ if (!competitor) {
+ return jsonResponse(
+ { error: "Enter a valid competitor domain, like example.com" },
+ 400,
+ );
+ }
+
+ const yourInput = parsed.data.yourDomain?.trim();
+ const yourDomain = yourInput ? normalizeDomain(yourInput) : null;
+ if (yourInput && !yourDomain) {
+ return jsonResponse(
+ { error: "Enter a valid domain of your own, like example.com" },
+ 400,
+ );
+ }
+ if (yourDomain && yourDomain === competitor) {
+ return jsonResponse(
+ { error: "Enter two different domains to compare" },
+ 400,
+ );
+ }
+
+ const apiKey = dataforseoKey();
+ if (!apiKey) return serviceUnavailable(TOOL.slug);
+
+ const blocked = await guardToolRequest({
+ tool: TOOL.slug,
+ request,
+ turnstileToken: parsed.data.turnstileToken,
+ });
+ if (blocked) return blocked;
+
+ const cacheKey = `organic-v2|${competitor}|${yourDomain ?? "-"}|${parsed.data.locationCode}`;
+ const cached = await readCached<CompetitorAnalysis>(
+ TOOL.slug,
+ cacheKey,
+ );
+ if (cached) {
+ return cached.ok
+ ? cacheableJson(cached.data, CACHE_TTL_SECONDS)
+ : failureResponse(cached.error);
+ }
+
+ // ranked_keywords + relevant_pages, plus two domain_rank_overview
+ // calls and one domain_intersection when your own domain is given.
+ const overBudget = await chargeToolBudget({
+ tool: TOOL.slug,
+ request,
+ calls: yourDomain ? 5 : 2,
+ });
+ if (overBudget) return overBudget;
+
+ const base = {
+ location_code: parsed.data.locationCode,
+ language_code: language,
+ };
+
+ try {
+ const [keywordsRaw, pagesRaw] = await Promise.all([
+ fetchDataforseoResult(
+ "/v3/dataforseo_labs/google/ranked_keywords/live",
+ {
+ item_types: ["organic"],
+ ...base,
+ target: competitor,
+ limit: KEYWORD_LIMIT,
+ order_by: RANKED_KEYWORDS_ORDER,
+ },
+ apiKey,
+ ),
+ fetchDataforseoResult(
+ "/v3/dataforseo_labs/google/relevant_pages/live",
+ {
+ ...base,
+ target: competitor,
+ limit: PAGE_LIMIT,
+ order_by: RELEVANT_PAGES_ORDER,
+ },
+ apiKey,
+ ),
+ ]);
+
+ const keywords = itemsResultSchema.parse(keywordsRaw ?? {});
+ const pages = itemsResultSchema.parse(pagesRaw ?? {});
+
+ const result: CompetitorAnalysis = {
+ competitor,
+ yourDomain,
+ locationCode: parsed.data.locationCode,
+ keywords: (keywords.items ?? []).map(readRankedKeyword),
+ totalKeywords: keywords.total_count ?? null,
+ pages: (pages.items ?? []).map(readRelevantPage),
+ totalPages: pages.total_count ?? null,
+ comparison: null,
+ gap: null,
+ gapFailed: false,
+ };
+
+ if (yourDomain) {
+ const [theirs, yours] = await Promise.all([
+ fetchDataforseoResult(
+ "/v3/dataforseo_labs/google/domain_rank_overview/live",
+ { ...base, target: competitor, limit: 1 },
+ apiKey,
+ ),
+ fetchDataforseoResult(
+ "/v3/dataforseo_labs/google/domain_rank_overview/live",
+ { ...base, target: yourDomain, limit: 1 },
+ apiKey,
+ ),
+ ]);
+ result.comparison = {
+ competitor: readOrganicMetrics(
+ (itemsResultSchema.parse(theirs ?? {}).items ?? [])[0] ?? {},
+ ),
+ you: readOrganicMetrics(
+ (itemsResultSchema.parse(yours ?? {}).items ?? [])[0] ?? {},
+ ),
+ };
+ result.gap = await fetchKeywordGap(
+ competitor,
+ yourDomain,
+ base,
+ apiKey,
+ );
+ result.gapFailed = result.gap === null;
+ }
+
+ // A failed gap lookup isn't worth a day of caching — keep it short so
+ // a retry can fill it in, without inviting an immediate retry loop.
+ const ttl = result.gapFailed ? 120 : CACHE_TTL_SECONDS;
+ await writeCached(
+ TOOL.slug,
+ cacheKey,
+ { ok: true, data: result },
+ ttl,
+ );
+ return cacheableJson(result, ttl);
+ } catch (err) {
+ console.error("Competitor analysis error:", err);
+ const message = "Competitor analysis failed. Please try again.";
+ await writeCached(
+ TOOL.slug,
+ cacheKey,
+ { ok: false, error: message },
+ 120,
+ );
+ return failureResponse(message);
+ }
+ },
+ },
+ },
+});
+
+/**
+ * Keywords the competitor ranks for and you don't: `intersections: false`
+ * makes domain_intersection return target1-only keywords. Its own try/catch —
+ * the gap table is the one optional part of the report, so a failure here
+ * shouldn't throw away the keyword and page lists we already paid for.
+ *
+ * Returns null when the lookup failed and [] when it genuinely found nothing,
+ * so the page can tell the visitor which happened.
+ */
+async function fetchKeywordGap(
+ competitor: string,
+ yourDomain: string,
+ base: { location_code: number; language_code: string },
+ apiKey: string,
+): Promise<GapRow[] | null> {
+ try {
+ const raw = await fetchDataforseoResult(
+ "/v3/dataforseo_labs/google/domain_intersection/live",
+ {
+ ...base,
+ target1: competitor,
+ target2: yourDomain,
+ intersections: false,
+ item_types: ["organic"],
+ limit: GAP_LIMIT,
+ },
+ apiKey,
+ );
+
+ return (
+ (itemsResultSchema.parse(raw ?? {}).items ?? [])
+ .map((item) => intersectionItemSchema.parse(item))
+ .map((item) => {
+ const serpElement = item.first_domain_serp_element;
+ return {
+ keyword: item.keyword_data?.keyword ?? null,
+ searchVolume:
+ item.keyword_data?.keyword_info?.search_volume ?? null,
+ difficulty:
+ item.keyword_data?.keyword_properties?.keyword_difficulty ?? null,
+ position:
+ serpElement?.rank_group ?? serpElement?.rank_absolute ?? null,
+ url: serpElement?.url ?? null,
+ traffic:
+ serpElement?.etv != null ? Math.round(serpElement.etv) : null,
+ };
+ })
+ // Ordered here rather than through order_by so the sort can't depend on
+ // an undocumented field path.
+ .sort((a, b) => (b.traffic ?? 0) - (a.traffic ?? 0))
+ );
+ } catch (err) {
+ console.error("Competitor keyword gap error:", err);
+ return null;
+ }
+}
diff --git a/web/src/routes/api/competitor-keyword-finder.ts b/web/src/routes/api/competitor-keyword-finder.ts
new file mode 100644
index 00000000..645eb669
--- /dev/null
+++ b/web/src/routes/api/competitor-keyword-finder.ts
@@ -0,0 +1,97 @@
+import { createFileRoute } from "@tanstack/react-router";
+import { z } from "zod";
+import { countryLanguage } from "@/lib/free-tools/countries";
+import {
+ readRankedKeyword,
+ RANKED_KEYWORDS_ORDER,
+} from "@/lib/free-tools/labs";
+import {
+ cacheableJson,
+ chargeToolBudget,
+ dataforseoKey,
+ failureResponse,
+ fetchDataforseoResult,
+ guardToolRequest,
+ itemsResultSchema,
+ jsonResponse,
+ readToolBody,
+ normalizeDomain,
+ readCached,
+ serviceUnavailable,
+ writeCached,
+} from "@/lib/free-tools/server";
+const TOOL = "competitor-keyword-finder";
+const TTL = 86_400;
+const requestSchema = z.object({
+ target: z.string().trim().min(1).max(300),
+ locationCode: z.number().int(),
+ turnstileToken: z.string().max(2048).optional(),
+});
+export const Route = createFileRoute("/api/competitor-keyword-finder")({
+ server: {
+ handlers: {
+ POST: async ({ request }) => {
+ const body = await readToolBody(request);
+ if (body instanceof Response) return body;
+ const parsed = requestSchema.safeParse(body);
+ if (!parsed.success)
+ return jsonResponse(
+ { error: "Enter a valid domain and country" },
+ 400,
+ );
+ const language = countryLanguage(parsed.data.locationCode);
+ if (!language)
+ return jsonResponse({ error: "Pick a supported country" }, 400);
+ const value = normalizeDomain(parsed.data.target);
+ if (!value) return jsonResponse({ error: "Enter a valid domain" }, 400);
+ const blocked = await guardToolRequest({
+ tool: TOOL,
+ request,
+ turnstileToken: parsed.data.turnstileToken,
+ });
+ if (blocked) return blocked;
+ const apiKey = dataforseoKey();
+ if (!apiKey) return serviceUnavailable(TOOL);
+ const key = `${value}|${parsed.data.locationCode}`;
+ const cached = await readCached(TOOL, key);
+ if (cached)
+ return cached.ok
+ ? cacheableJson(cached.data, TTL)
+ : failureResponse(cached.error);
+ const overBudget = await chargeToolBudget({
+ tool: TOOL,
+ request,
+ calls: 1,
+ });
+ if (overBudget) return overBudget;
+ try {
+ const raw = await fetchDataforseoResult(
+ "/v3/dataforseo_labs/google/ranked_keywords/live",
+ {
+ item_types: ["organic"],
+ target: value,
+ order_by: RANKED_KEYWORDS_ORDER,
+ location_code: parsed.data.locationCode,
+ language_code: language,
+ limit: 20,
+ },
+ apiKey,
+ );
+ const items = itemsResultSchema.parse(raw ?? {}).items ?? [];
+ const result = {
+ target: value,
+ locationCode: parsed.data.locationCode,
+ keywords: items.map(readRankedKeyword),
+ };
+ await writeCached(TOOL, key, { ok: true, data: result }, TTL);
+ return cacheableJson(result, TTL);
+ } catch (error) {
+ console.error(`${TOOL} lookup failed:`, error);
+ const message = "We couldn't load keywords. Please try again.";
+ await writeCached(TOOL, key, { ok: false, error: message }, 120);
+ return failureResponse(message);
+ }
+ },
+ },
+ },
+});
diff --git a/web/src/routes/api/domain-age-checker.ts b/web/src/routes/api/domain-age-checker.ts
new file mode 100644
index 00000000..8bb6733f
--- /dev/null
+++ b/web/src/routes/api/domain-age-checker.ts
@@ -0,0 +1,233 @@
+import { createFileRoute } from "@tanstack/react-router";
+import { z } from "zod";
+import {
+ cacheableJson,
+ guardToolRequest,
+ jsonResponse,
+ readToolBody,
+ normalizeDomain,
+ readCached,
+ writeCached,
+} from "@/lib/free-tools/server";
+import { freeTools } from "@/lib/free-tools/tool-pages";
+
+const TOOL = freeTools["domain-age-checker"];
+// Registration data barely moves; a week of caching keeps RDAP registries
+// from seeing repeated lookups for popular domains.
+const CACHE_TTL_SECONDS = 7 * 86_400;
+const MAX_DOMAINS = 10;
+
+const requestSchema = z.object({
+ domains: z
+ .array(z.string().trim().min(1).max(300))
+ .min(1, "Enter at least one domain")
+ .max(MAX_DOMAINS, `Enter up to ${MAX_DOMAINS} domains`),
+ turnstileToken: z.string().max(4096).optional(),
+});
+
+const rdapSchema = z
+ .object({
+ events: z
+ .array(
+ z
+ .object({
+ eventAction: z.string().nullable().optional(),
+ eventDate: z.string().nullable().optional(),
+ })
+ .passthrough(),
+ )
+ .nullable()
+ .optional(),
+ entities: z
+ .array(
+ z
+ .object({
+ roles: z.array(z.string()).nullable().optional(),
+ vcardArray: z.unknown().optional(),
+ })
+ .passthrough(),
+ )
+ .nullable()
+ .optional(),
+ })
+ .passthrough();
+
+type DomainAgeRow = {
+ domain: string;
+ created: string | null;
+ updated: string | null;
+ expires: string | null;
+ registrar: string | null;
+ ageYears: number | null;
+ ageMonths: number | null;
+ error: string | null;
+};
+
+export const Route = createFileRoute("/api/domain-age-checker")({
+ server: {
+ handlers: {
+ POST: async ({ request }) => {
+ const body = await readToolBody(request);
+ if (body instanceof Response) return body;
+ const parsed = requestSchema.safeParse(body);
+ if (!parsed.success) {
+ return jsonResponse(
+ { error: parsed.error.issues[0]?.message ?? "Invalid request" },
+ 400,
+ );
+ }
+
+ const domains = [
+ ...new Set(
+ parsed.data.domains
+ .map(normalizeDomain)
+ .filter((domain): domain is string => domain !== null),
+ ),
+ ];
+ if (domains.length === 0) {
+ return jsonResponse(
+ { error: "Enter at least one valid domain, like example.com" },
+ 400,
+ );
+ }
+
+ // No DataForSEO call and no daily budget: RDAP is free, so the rate
+ // limiter is the only thing standing between this and a scraper.
+ const blocked = await guardToolRequest({
+ tool: TOOL.slug,
+ request,
+ turnstileToken: parsed.data.turnstileToken,
+ });
+ if (blocked) return blocked;
+
+ const cached = await Promise.all(
+ domains.map((domain) => readCached<DomainAgeRow>(TOOL.slug, domain)),
+ );
+
+ const rows = await Promise.all(
+ domains.map(async (domain, index) => {
+ const entry = cached[index];
+ if (entry?.ok) return entry.data;
+ const row = await lookupDomain(domain);
+ // Only successful lookups are cached for a week; a failed row is
+ // cached briefly so a flaky registry isn't hammered.
+ await writeCached(
+ TOOL.slug,
+ domain,
+ { ok: true, data: row },
+ row.error ? 300 : CACHE_TTL_SECONDS,
+ );
+ return row;
+ }),
+ );
+
+ return cacheableJson({ rows }, CACHE_TTL_SECONDS);
+ },
+ },
+ },
+});
+
+function emptyRow(domain: string, error: string | null): DomainAgeRow {
+ return {
+ domain,
+ created: null,
+ updated: null,
+ expires: null,
+ registrar: null,
+ ageYears: null,
+ ageMonths: null,
+ error,
+ };
+}
+
+async function lookupDomain(domain: string): Promise<DomainAgeRow> {
+ const tld = domain.slice(domain.lastIndexOf(".") + 1);
+ let response: Response;
+ try {
+ // rdap.org redirects to the registry that actually holds the record.
+ response = await fetch(`https://rdap.org/domain/${domain}`, {
+ headers: {
+ Accept: "application/rdap+json",
+ // rdap.org answers 403 to requests with no User-Agent, and the
+ // Workers runtime doesn't set one.
+ "User-Agent":
+ "openseo-free-tools (+https://openseo.so/domain-age-checker)",
+ },
+ redirect: "follow",
+ signal: AbortSignal.timeout(10_000),
+ });
+ } catch (err) {
+ console.error(`RDAP lookup failed for ${domain}:`, err);
+ return emptyRow(domain, "Registration lookup timed out");
+ }
+
+ // rdap.org 404s without redirecting when no registry serves that TLD; a
+ // 404 from the registry it redirected to means the domain isn't registered.
+ const answeredByRegistry = !response.url.startsWith("https://rdap.org/");
+ if (!response.ok) {
+ return emptyRow(
+ domain,
+ response.status === 404 && answeredByRegistry
+ ? "No registration record found"
+ : `No public registration data for .${tld}`,
+ );
+ }
+
+ const parsed = rdapSchema.safeParse(await response.json().catch(() => null));
+ if (!parsed.success) {
+ return emptyRow(domain, `No public registration data for .${tld}`);
+ }
+
+ const events = parsed.data.events ?? [];
+ const eventDate = (action: string) =>
+ events.find((event) => event.eventAction?.toLowerCase() === action)
+ ?.eventDate ?? null;
+
+ const created = eventDate("registration");
+ const age = created ? ageSince(created) : null;
+
+ return {
+ domain,
+ created,
+ updated: eventDate("last changed"),
+ expires: eventDate("expiration"),
+ registrar: readRegistrar(parsed.data.entities ?? []),
+ ageYears: age?.years ?? null,
+ ageMonths: age?.months ?? null,
+ error: created ? null : "No registration date published",
+ };
+}
+
+function ageSince(isoDate: string): { years: number; months: number } | null {
+ const created = new Date(isoDate);
+ if (Number.isNaN(created.getTime())) return null;
+ const now = new Date();
+ let months =
+ (now.getFullYear() - created.getFullYear()) * 12 +
+ (now.getMonth() - created.getMonth());
+ if (now.getDate() < created.getDate()) months -= 1;
+ if (months < 0) return { years: 0, months: 0 };
+ return { years: Math.floor(months / 12), months: months % 12 };
+}
+
+/** RDAP entities carry the registrar name in a jCard `fn` entry. */
+function readRegistrar(
+ entities: Array<{ roles?: string[] | null; vcardArray?: unknown }>,
+): string | null {
+ const registrar = entities.find((entity) =>
+ entity.roles?.some((role) => role.toLowerCase() === "registrar"),
+ );
+ if (!registrar || !Array.isArray(registrar.vcardArray)) return null;
+ const fields = registrar.vcardArray[1];
+ if (!Array.isArray(fields)) return null;
+ for (const field of fields) {
+ if (
+ Array.isArray(field) &&
+ field[0] === "fn" &&
+ typeof field[3] === "string"
+ ) {
+ return field[3];
+ }
+ }
+ return null;
+}
diff --git a/web/src/routes/api/keyword-generator.ts b/web/src/routes/api/keyword-generator.ts
new file mode 100644
index 00000000..cee008a8
--- /dev/null
+++ b/web/src/routes/api/keyword-generator.ts
@@ -0,0 +1,95 @@
+import { createFileRoute } from "@tanstack/react-router";
+import { z } from "zod";
+import { countryLanguage } from "@/lib/free-tools/countries";
+import { readKeywordIdea } from "@/lib/free-tools/labs";
+import {
+ cacheableJson,
+ chargeToolBudget,
+ dataforseoKey,
+ failureResponse,
+ fetchDataforseoResult,
+ guardToolRequest,
+ itemsResultSchema,
+ jsonResponse,
+ readToolBody,
+ readCached,
+ serviceUnavailable,
+ writeCached,
+} from "@/lib/free-tools/server";
+const TOOL = "keyword-generator";
+const TTL = 86_400;
+const requestSchema = z.object({
+ keyword: z.string().trim().min(1).max(100),
+ locationCode: z.number().int(),
+ turnstileToken: z.string().max(2048).optional(),
+});
+export const Route = createFileRoute("/api/keyword-generator")({
+ server: {
+ handlers: {
+ POST: async ({ request }) => {
+ const body = await readToolBody(request);
+ if (body instanceof Response) return body;
+ const parsed = requestSchema.safeParse(body);
+ if (!parsed.success)
+ return jsonResponse(
+ { error: "Enter a valid topic and country" },
+ 400,
+ );
+ const language = countryLanguage(parsed.data.locationCode);
+ if (!language)
+ return jsonResponse({ error: "Pick a supported country" }, 400);
+ const value = parsed.data.keyword.toLowerCase().replace(/\s+/g, " ");
+ const blocked = await guardToolRequest({
+ tool: TOOL,
+ request,
+ turnstileToken: parsed.data.turnstileToken,
+ });
+ if (blocked) return blocked;
+ const apiKey = dataforseoKey();
+ if (!apiKey) return serviceUnavailable(TOOL);
+ const key = `core-v2|${value}|${parsed.data.locationCode}`;
+ const cached = await readCached(TOOL, key);
+ if (cached)
+ return cached.ok
+ ? cacheableJson(cached.data, TTL)
+ : failureResponse(cached.error);
+ const overBudget = await chargeToolBudget({
+ tool: TOOL,
+ request,
+ calls: 1,
+ });
+ if (overBudget) return overBudget;
+ try {
+ const raw = await fetchDataforseoResult(
+ "/v3/dataforseo_labs/google/keyword_suggestions/live",
+ {
+ keyword: value,
+ include_seed_keyword: false,
+ include_serp_info: false,
+ include_clickstream_data: false,
+ exact_match: false,
+ ignore_synonyms: true,
+ location_code: parsed.data.locationCode,
+ language_code: language,
+ limit: 20,
+ },
+ apiKey,
+ );
+ const items = itemsResultSchema.parse(raw ?? {}).items ?? [];
+ const result = {
+ keyword: value,
+ locationCode: parsed.data.locationCode,
+ keywords: items.map(readKeywordIdea),
+ };
+ await writeCached(TOOL, key, { ok: true, data: result }, TTL);
+ return cacheableJson(result, TTL);
+ } catch (error) {
+ console.error(`${TOOL} lookup failed:`, error);
+ const message = "We couldn't load keywords. Please try again.";
+ await writeCached(TOOL, key, { ok: false, error: message }, 120);
+ return failureResponse(message);
+ }
+ },
+ },
+ },
+});
diff --git a/web/src/routes/api/spam-score-checker.ts b/web/src/routes/api/spam-score-checker.ts
new file mode 100644
index 00000000..eacad78a
--- /dev/null
+++ b/web/src/routes/api/spam-score-checker.ts
@@ -0,0 +1,198 @@
+import { createFileRoute } from "@tanstack/react-router";
+import { z } from "zod";
+import {
+ cacheableJson,
+ chargeToolBudget,
+ dataforseoKey,
+ failureResponse,
+ fetchDataforseoResult,
+ guardToolRequest,
+ jsonResponse,
+ readToolBody,
+ normalizeDomain,
+ readCached,
+ serviceUnavailable,
+ writeCached,
+} from "@/lib/free-tools/server";
+import { freeTools } from "@/lib/free-tools/tool-pages";
+
+const TOOL = freeTools["spam-score-checker"];
+const CACHE_TTL_SECONDS = 86_400;
+const WORST_BACKLINKS_LIMIT = 10;
+
+const requestSchema = z.object({
+ target: z.string().trim().min(1, "Enter a domain").max(300),
+ turnstileToken: z.string().max(4096).optional(),
+});
+
+const summarySchema = z
+ .object({
+ rank: z.number().nullable().optional(),
+ backlinks: z.number().nullable().optional(),
+ referring_domains: z.number().nullable().optional(),
+ backlinks_spam_score: z.number().nullable().optional(),
+ info: z
+ .object({ target_spam_score: z.number().nullable().optional() })
+ .passthrough()
+ .nullable()
+ .optional(),
+ })
+ .passthrough();
+
+const backlinksSchema = z
+ .object({
+ items: z
+ .array(
+ z
+ .object({
+ type: z.string().nullable().optional(),
+ domain_from: z.string().nullable().optional(),
+ url_from: z.string().nullable().optional(),
+ anchor: z.string().nullable().optional(),
+ dofollow: z.boolean().nullable().optional(),
+ domain_from_rank: z.number().nullable().optional(),
+ backlink_spam_score: z.number().nullable().optional(),
+ })
+ .passthrough(),
+ )
+ .nullable()
+ .optional(),
+ })
+ .passthrough();
+
+type SpamCheck = {
+ target: string;
+ spamScore: number | null;
+ targetSpamScore: number | null;
+ rank: number | null;
+ backlinks: number | null;
+ referringDomains: number | null;
+ worstBacklinks: Array<{
+ domainFrom: string | null;
+ urlFrom: string | null;
+ anchor: string | null;
+ dofollow: boolean | null;
+ domainRank: number | null;
+ spamScore: number | null;
+ }>;
+};
+
+export const Route = createFileRoute("/api/spam-score-checker")({
+ server: {
+ handlers: {
+ POST: async ({ request }) => {
+ const body = await readToolBody(request);
+ if (body instanceof Response) return body;
+ const parsed = requestSchema.safeParse(body);
+ if (!parsed.success) {
+ return jsonResponse(
+ { error: parsed.error.issues[0]?.message ?? "Invalid request" },
+ 400,
+ );
+ }
+
+ const domain = normalizeDomain(parsed.data.target);
+ if (!domain) {
+ return jsonResponse(
+ { error: "Enter a valid domain, like example.com" },
+ 400,
+ );
+ }
+
+ const apiKey = dataforseoKey();
+ if (!apiKey) return serviceUnavailable(TOOL.slug);
+
+ const blocked = await guardToolRequest({
+ tool: TOOL.slug,
+ request,
+ turnstileToken: parsed.data.turnstileToken,
+ });
+ if (blocked) return blocked;
+
+ const cached = await readCached<SpamCheck>(TOOL.slug, domain);
+ if (cached) {
+ return cached.ok
+ ? cacheableJson(cached.data, CACHE_TTL_SECONDS)
+ : failureResponse(cached.error);
+ }
+
+ // summary/live + backlinks/live
+ const overBudget = await chargeToolBudget({
+ tool: TOOL.slug,
+ request,
+ calls: 2,
+ });
+ if (overBudget) return overBudget;
+
+ const commonPayload = {
+ target: domain,
+ include_subdomains: true,
+ include_indirect_links: true,
+ exclude_internal_backlinks: true,
+ backlinks_status_type: "live",
+ rank_scale: "one_hundred",
+ };
+
+ try {
+ const [summaryRaw, backlinksRaw] = await Promise.all([
+ fetchDataforseoResult(
+ "/v3/backlinks/summary/live",
+ commonPayload,
+ apiKey,
+ ),
+ fetchDataforseoResult(
+ "/v3/backlinks/backlinks/live",
+ {
+ ...commonPayload,
+ limit: WORST_BACKLINKS_LIMIT,
+ mode: "one_per_domain",
+ order_by: ["backlink_spam_score,desc"],
+ },
+ apiKey,
+ ),
+ ]);
+
+ const summary = summarySchema.parse(summaryRaw ?? {});
+ const backlinks = backlinksSchema.parse(backlinksRaw ?? {});
+
+ const result: SpamCheck = {
+ target: domain,
+ spamScore: summary.backlinks_spam_score ?? null,
+ targetSpamScore: summary.info?.target_spam_score ?? null,
+ rank: summary.rank ?? null,
+ backlinks: summary.backlinks ?? null,
+ referringDomains: summary.referring_domains ?? null,
+ worstBacklinks: (backlinks.items ?? [])
+ .filter((item) => item.type === "backlink" && item.url_from)
+ .map((item) => ({
+ domainFrom: item.domain_from ?? null,
+ urlFrom: item.url_from ?? null,
+ anchor: item.anchor?.trim() ? item.anchor : null,
+ dofollow: item.dofollow ?? null,
+ domainRank: item.domain_from_rank ?? null,
+ spamScore: item.backlink_spam_score ?? null,
+ })),
+ };
+
+ await writeCached(
+ TOOL.slug,
+ domain,
+ { ok: true, data: result },
+ CACHE_TTL_SECONDS,
+ );
+ return cacheableJson(result, CACHE_TTL_SECONDS);
+ } catch (err) {
+ console.error("Spam score check error:", err);
+ const message = "Spam score check failed. Please try again.";
+ await writeCached(
+ TOOL.slug,
+ domain,
+ { ok: false, error: message },
+ 120,
+ );
+ return failureResponse(message);
+ }
+ },
+ },
+ },
+});
diff --git a/web/src/routes/api/website-traffic-checker.ts b/web/src/routes/api/website-traffic-checker.ts
new file mode 100644
index 00000000..3c717da1
--- /dev/null
+++ b/web/src/routes/api/website-traffic-checker.ts
@@ -0,0 +1,219 @@
+import { createFileRoute } from "@tanstack/react-router";
+import { z } from "zod";
+import { countryLanguage } from "@/lib/free-tools/countries";
+import {
+ RANKED_KEYWORDS_ORDER,
+ readOrganicMetrics,
+ readRankedKeyword,
+ readRelevantPage,
+ RELEVANT_PAGES_ORDER,
+ type RankedKeywordRow,
+ type RelevantPageRow,
+} from "@/lib/free-tools/labs";
+import {
+ cacheableJson,
+ chargeToolBudget,
+ dataforseoKey,
+ failureResponse,
+ fetchDataforseoResult,
+ guardToolRequest,
+ itemsResultSchema,
+ jsonResponse,
+ readToolBody,
+ normalizeDomain,
+ readCached,
+ serviceUnavailable,
+ writeCached,
+} from "@/lib/free-tools/server";
+import { freeTools } from "@/lib/free-tools/tool-pages";
+
+const TOOL = freeTools["website-traffic-checker"];
+const CACHE_TTL_SECONDS = 86_400;
+const ROW_LIMIT = 5;
+
+const requestSchema = z.object({
+ target: z.string().trim().min(1, "Enter a domain").max(300),
+ compare: z.string().trim().max(300).optional(),
+ locationCode: z.number().int(),
+ turnstileToken: z.string().max(4096).optional(),
+});
+
+type DomainTraffic = {
+ domain: string;
+ organicTraffic: number | null;
+ organicKeywords: number | null;
+ trafficValue: number | null;
+ topKeywords: RankedKeywordRow[];
+ topPages: RelevantPageRow[];
+ totalPages: number | null;
+};
+
+export const Route = createFileRoute("/api/website-traffic-checker")({
+ server: {
+ handlers: {
+ POST: async ({ request }) => {
+ const body = await readToolBody(request);
+ if (body instanceof Response) return body;
+ const parsed = requestSchema.safeParse(body);
+ if (!parsed.success) {
+ return jsonResponse(
+ { error: parsed.error.issues[0]?.message ?? "Invalid request" },
+ 400,
+ );
+ }
+
+ const language = countryLanguage(parsed.data.locationCode);
+ if (!language) {
+ return jsonResponse({ error: "Pick a supported country" }, 400);
+ }
+
+ const target = normalizeDomain(parsed.data.target);
+ if (!target) {
+ return jsonResponse(
+ { error: "Enter a valid domain, like example.com" },
+ 400,
+ );
+ }
+
+ const compareInput = parsed.data.compare?.trim();
+ const compare = compareInput ? normalizeDomain(compareInput) : null;
+ if (compareInput && !compare) {
+ return jsonResponse(
+ { error: "Enter a valid domain to compare, like example.com" },
+ 400,
+ );
+ }
+
+ const apiKey = dataforseoKey();
+ if (!apiKey) return serviceUnavailable(TOOL.slug);
+
+ const blocked = await guardToolRequest({
+ tool: TOOL.slug,
+ request,
+ turnstileToken: parsed.data.turnstileToken,
+ });
+ if (blocked) return blocked;
+
+ const domains =
+ compare && compare !== target ? [target, compare] : [target];
+ const cacheKeys = domains.map(
+ (domain) => `organic-v2|${domain}|${parsed.data.locationCode}`,
+ );
+ const cachedEntries = await Promise.all(
+ cacheKeys.map((key) => readCached<DomainTraffic>(TOOL.slug, key)),
+ );
+
+ const failed = cachedEntries.find((entry) => entry && !entry.ok);
+ if (failed && !failed.ok) return failureResponse(failed.error);
+
+ const misses = domains.filter((_, index) => !cachedEntries[index]);
+ // Three calls per domain (overview + keywords + pages); only
+ // uncached domains are charged, so compare mode can cost 3 or 6.
+ const overBudget = await chargeToolBudget({
+ tool: TOOL.slug,
+ request,
+ calls: misses.length * 3,
+ });
+ if (overBudget) return overBudget;
+
+ try {
+ const fetched = new Map<string, DomainTraffic>();
+ await Promise.all(
+ misses.map(async (domain) => {
+ const snapshot = await fetchDomainTraffic(
+ domain,
+ parsed.data.locationCode,
+ language,
+ apiKey,
+ );
+ fetched.set(domain, snapshot);
+ await writeCached(
+ TOOL.slug,
+ `organic-v2|${domain}|${parsed.data.locationCode}`,
+ { ok: true, data: snapshot },
+ CACHE_TTL_SECONDS,
+ );
+ }),
+ );
+
+ const results = domains.map((domain, index) => {
+ const entry = cachedEntries[index];
+ return entry?.ok ? entry.data : fetched.get(domain)!;
+ });
+
+ return cacheableJson(
+ {
+ locationCode: parsed.data.locationCode,
+ primary: results[0],
+ comparison: results[1] ?? null,
+ },
+ CACHE_TTL_SECONDS,
+ );
+ } catch (err) {
+ console.error("Website traffic check error:", err);
+ const message = "Traffic check failed. Please try again.";
+ await Promise.all(
+ misses.map((domain) =>
+ writeCached(
+ TOOL.slug,
+ `organic-v2|${domain}|${parsed.data.locationCode}`,
+ { ok: false, error: message },
+ 120,
+ ),
+ ),
+ );
+ return failureResponse(message);
+ }
+ },
+ },
+ },
+});
+
+async function fetchDomainTraffic(
+ domain: string,
+ locationCode: number,
+ languageCode: string,
+ apiKey: string,
+): Promise<DomainTraffic> {
+ const base = {
+ target: domain,
+ location_code: locationCode,
+ language_code: languageCode,
+ };
+
+ const [overviewRaw, keywordsRaw, pagesRaw] = await Promise.all([
+ fetchDataforseoResult(
+ "/v3/dataforseo_labs/google/domain_rank_overview/live",
+ { ...base, limit: 1 },
+ apiKey,
+ ),
+ fetchDataforseoResult(
+ "/v3/dataforseo_labs/google/ranked_keywords/live",
+ {
+ item_types: ["organic"],
+ ...base,
+ limit: ROW_LIMIT,
+ order_by: RANKED_KEYWORDS_ORDER,
+ },
+ apiKey,
+ ),
+ fetchDataforseoResult(
+ "/v3/dataforseo_labs/google/relevant_pages/live",
+ { ...base, limit: ROW_LIMIT, order_by: RELEVANT_PAGES_ORDER },
+ apiKey,
+ ),
+ ]);
+
+ const overviewItems = itemsResultSchema.parse(overviewRaw ?? {}).items ?? [];
+ const pages = itemsResultSchema.parse(pagesRaw ?? {});
+
+ return {
+ domain,
+ ...readOrganicMetrics(overviewItems[0] ?? {}),
+ topKeywords: (itemsResultSchema.parse(keywordsRaw ?? {}).items ?? []).map(
+ readRankedKeyword,
+ ),
+ topPages: (pages.items ?? []).map(readRelevantPage),
+ totalPages: pages.total_count ?? null,
+ };
+}
diff --git a/web/src/types/cloudflare-workers.d.ts b/web/src/types/cloudflare-workers.d.ts
index 82956362..67314426 100644
--- a/web/src/types/cloudflare-workers.d.ts
+++ b/web/src/types/cloudflare-workers.d.ts
@@ -1,4 +1 @@
-declare module "cloudflare:workers" {
- const env: Env;
- export { env };
-}
+/// <reference types="@cloudflare/workers-types" />
diff --git a/web/src/worker.ts b/web/src/worker.ts
new file mode 100644
index 00000000..860a0877
--- /dev/null
+++ b/web/src/worker.ts
@@ -0,0 +1,2 @@
+export { default } from "@tanstack/react-start/server-entry";
+export { FreeToolBudget } from "./lib/free-tools/budget";
diff --git a/web/tests/free-tool-protection.test.ts b/web/tests/free-tool-protection.test.ts
new file mode 100644
index 00000000..abfa1a60
--- /dev/null
+++ b/web/tests/free-tool-protection.test.ts
@@ -0,0 +1,374 @@
+import { beforeEach, describe, expect, it, vi } from "vitest";
+
+const bindings = vi.hoisted(() => ({ value: {} as Record<string, unknown> }));
+vi.mock("cloudflare:workers", () => ({ env: bindings.value }));
+vi.mock("@tanstack/react-router", () => ({
+ createFileRoute: () => (options: unknown) => options,
+}));
+import {
+ chargeToolBudget,
+ guardToolRequest,
+ readToolBody,
+} from "../src/lib/free-tools/server";
+
+const request = (headers: Record<string, string> = {}) =>
+ new Request("https://openseo.so/api/backlink-check", {
+ method: "POST",
+ headers: { "cf-connecting-ip": "203.0.113.1", ...headers },
+ });
+const guard = (turnstileToken: string | undefined = "token", headers = {}) =>
+ guardToolRequest({
+ tool: "backlink-checker",
+ request: request(headers),
+ turnstileToken,
+ });
+let fetchMock: ReturnType<typeof vi.fn>;
+let limit: ReturnType<typeof vi.fn>;
+beforeEach(() => {
+ vi.stubEnv("DEV", false);
+ for (const key of Object.keys(bindings.value)) delete bindings.value[key];
+ limit = vi.fn().mockResolvedValue({ success: true });
+ bindings.value.TURNSTILE_SECRET_KEY = "production-secret";
+ bindings.value.BACKLINK_CHECK_RATE_LIMIT = { limit };
+ fetchMock = vi.fn().mockResolvedValue(
+ Response.json({
+ success: true,
+ hostname: "openseo.so",
+ action: "free_tool",
+ }),
+ );
+ vi.stubGlobal("fetch", fetchMock);
+});
+
+describe("public tool verification", () => {
+ it("accepts a verified token for this hostname and purpose", async () => {
+ expect(await guard()).toBeNull();
+ expect(fetchMock).toHaveBeenCalledTimes(1);
+ });
+ it.each(["TURNSTILE_SECRET_KEY", "BACKLINK_CHECK_RATE_LIMIT"])(
+ "fails closed without %s",
+ async (key) => {
+ delete bindings.value[key];
+ expect((await guard())?.status).toBe(503);
+ expect(fetchMock).not.toHaveBeenCalled();
+ },
+ );
+ it("rejects a production test secret", async () => {
+ bindings.value.TURNSTILE_SECRET_KEY = "1x0000000000000000000000000000000AA";
+ expect((await guard())?.status).toBe(503);
+ });
+ it("requires Cloudflare's client IP in production", async () => {
+ const req = request();
+ req.headers.delete("cf-connecting-ip");
+ expect(
+ (
+ await guardToolRequest({
+ tool: "backlink-checker",
+ request: req,
+ turnstileToken: "token",
+ })
+ )?.status,
+ ).toBe(503);
+ expect(fetchMock).not.toHaveBeenCalled();
+ });
+ it("rejects cross-site submissions before any verification call", async () => {
+ expect(
+ (await guard("token", { origin: "https://attacker.example" }))?.status,
+ ).toBe(403);
+ expect(fetchMock).not.toHaveBeenCalled();
+ });
+ it("rejects missing tokens", async () => {
+ expect(
+ (await guardToolRequest({ tool: "backlink-checker", request: request() }))
+ ?.status,
+ ).toBe(403);
+ expect(fetchMock).not.toHaveBeenCalled();
+ });
+ it.each([
+ { success: false },
+ { success: true, hostname: "other.example", action: "free_tool" },
+ { success: true, hostname: "openseo.so", action: "login" },
+ { success: true },
+ ])("rejects invalid or mismatched verification %j", async (data) => {
+ fetchMock.mockResolvedValue(Response.json(data));
+ expect((await guard())?.status).toBe(403);
+ });
+ it("rate limits across tools before contacting Turnstile", async () => {
+ limit.mockResolvedValue({ success: false });
+ expect((await guard())?.status).toBe(429);
+ await guardToolRequest({
+ tool: "competitor-analysis",
+ request: request(),
+ turnstileToken: "token",
+ });
+ expect(limit.mock.calls[0][0]).toEqual(limit.mock.calls[1][0]);
+ expect(fetchMock).not.toHaveBeenCalled();
+ });
+ it("fails closed when verification or rate limiting is unavailable", async () => {
+ fetchMock.mockRejectedValue(new Error("timeout"));
+ expect((await guard())?.status).toBe(503);
+ limit.mockRejectedValue(new Error("binding down"));
+ expect((await guard())?.status).toBe(503);
+ });
+});
+
+describe("body and budget protections", () => {
+ it("rejects oversized streamed JSON without relying on Content-Length", async () => {
+ const req = new Request("https://openseo.so/api/backlink-check", {
+ method: "POST",
+ headers: { "content-type": "application/json" },
+ body: JSON.stringify({ target: "a".repeat(17000) }),
+ });
+ expect(((await readToolBody(req)) as Response).status).toBe(413);
+ });
+ it("requires JSON and accepts an ordinary small request", async () => {
+ expect(((await readToolBody(request())) as Response).status).toBe(415);
+ const req = new Request("https://openseo.so/api/backlink-check", {
+ method: "POST",
+ headers: { "content-type": "application/json" },
+ body: '{"target":"openseo.so"}',
+ });
+ expect(await readToolBody(req)).toEqual({ target: "openseo.so" });
+ });
+ it("fails closed if budget coordination is missing or fails", async () => {
+ const input = {
+ tool: "backlink-checker" as const,
+ request: request(),
+ calls: 2,
+ };
+ expect((await chargeToolBudget(input))?.status).toBe(503);
+ bindings.value.FREE_TOOL_BUDGET = {
+ getByName: () => ({
+ reserve: () => Promise.reject(new Error("unavailable")),
+ }),
+ };
+ expect((await chargeToolBudget(input))?.status).toBe(503);
+ });
+ it("reserves the full run and hashes the IP before persistence", async () => {
+ const reserve = vi.fn().mockResolvedValue("allowed");
+ bindings.value.FREE_TOOL_BUDGET = { getByName: () => ({ reserve }) };
+ expect(
+ await chargeToolBudget({
+ tool: "competitor-analysis",
+ request: request(),
+ calls: 5,
+ }),
+ ).toBeNull();
+ expect(reserve.mock.calls[0][0]).toMatchObject({
+ calls: 5,
+ visitor: expect.stringMatching(/^[a-f0-9]{64}$/),
+ });
+ reserve.mockResolvedValue("daily");
+ expect(
+ (
+ await chargeToolBudget({
+ tool: "competitor-analysis",
+ request: request(),
+ calls: 5,
+ })
+ )?.status,
+ ).toBe(429);
+ });
+});
+
+describe("every free API protects cache hits and provider calls", () => {
+ const cases = [
+ ["backlink-check", { target: "openseo.so" }],
+ ["competitor-keyword-finder", { target: "openseo.so", locationCode: 2840 }],
+ ["keyword-generator", { keyword: "email marketing", locationCode: 2840 }],
+ ["website-traffic-checker", { target: "openseo.so", locationCode: 2840 }],
+ ["competitor-analysis", { competitor: "openseo.so", locationCode: 2840 }],
+ ["spam-score-checker", { target: "openseo.so" }],
+ ["domain-age-checker", { domains: ["openseo.so"] }],
+ ] as const;
+ it.each(cases)(
+ "%s rejects missing verification before cache or provider access",
+ async (slug, body) => {
+ bindings.value.DATAFORSEO_API_KEY = "test-key";
+ const match = vi.fn();
+ vi.stubGlobal("caches", { default: { match } });
+ const { Route } = await import(`../src/routes/api/${slug}.ts`);
+ const response = await Route.server.handlers.POST({
+ request: new Request(`https://openseo.so/api/${slug}`, {
+ method: "POST",
+ headers: {
+ "content-type": "application/json",
+ "cf-connecting-ip": "203.0.113.2",
+ },
+ body: JSON.stringify(body),
+ }),
+ });
+ expect(response.status).toBe(403);
+ expect(match).not.toHaveBeenCalled();
+ expect(fetchMock).not.toHaveBeenCalled();
+ },
+ );
+ it.each(cases.filter(([slug]) => slug !== "domain-age-checker"))(
+ "%s never calls DataForSEO when the budget rejects a verified cache miss",
+ async (slug, body) => {
+ bindings.value.DATAFORSEO_API_KEY = "test-key";
+ const reserve = vi.fn().mockResolvedValue("daily");
+ bindings.value.FREE_TOOL_BUDGET = { getByName: () => ({ reserve }) };
+ vi.stubGlobal("caches", {
+ default: { match: vi.fn().mockResolvedValue(undefined) },
+ });
+ const { Route } = await import(`../src/routes/api/${slug}.ts`);
+ const response = await Route.server.handlers.POST({
+ request: new Request(`https://openseo.so/api/${slug}`, {
+ method: "POST",
+ headers: {
+ "content-type": "application/json",
+ "cf-connecting-ip": "203.0.113.2",
+ },
+ body: JSON.stringify({ ...body, turnstileToken: "token" }),
+ }),
+ });
+ expect(response.status).toBe(429);
+ expect(reserve).toHaveBeenCalledTimes(1);
+ expect(fetchMock).toHaveBeenCalledTimes(1);
+ expect(fetchMock.mock.calls[0][0]).toBe(
+ "https://challenges.cloudflare.com/turnstile/v0/siteverify",
+ );
+ },
+ );
+ it("serves a verified cache hit without reserving budget or contacting DataForSEO", async () => {
+ bindings.value.DATAFORSEO_API_KEY = "test-key";
+ const reserve = vi.fn();
+ bindings.value.FREE_TOOL_BUDGET = { getByName: () => ({ reserve }) };
+ vi.stubGlobal("caches", {
+ default: {
+ match: vi
+ .fn()
+ .mockResolvedValue(
+ Response.json({ ok: true, data: { target: "openseo.so" } }),
+ ),
+ },
+ });
+ const module = await import("../src/routes/api/backlink-check");
+ const route = module.Route as unknown as {
+ server: {
+ handlers: { POST: (args: { request: Request }) => Promise<Response> };
+ };
+ };
+ const response = await route.server.handlers.POST({
+ request: new Request("https://openseo.so/api/backlink-check", {
+ method: "POST",
+ headers: {
+ "content-type": "application/json",
+ "cf-connecting-ip": "203.0.113.2",
+ },
+ body: JSON.stringify({ target: "openseo.so", turnstileToken: "token" }),
+ }),
+ });
+ expect(response.status).toBe(200);
+ expect(reserve).not.toHaveBeenCalled();
+ expect(fetchMock).toHaveBeenCalledTimes(1);
+ expect(fetchMock.mock.calls[0][0]).toContain("/siteverify");
+ });
+});
+
+describe("keyword discovery provider contracts", () => {
+ const cases = [
+ {
+ slug: "competitor-keyword-finder",
+ body: { target: "https://www.example.com/path", locationCode: 2840 },
+ input: { target: "example.com", item_types: ["organic"] },
+ item: {
+ keyword_data: {
+ keyword: "sample",
+ keyword_info: { search_volume: 100 },
+ keyword_properties: { keyword_difficulty: 12 },
+ },
+ ranked_serp_element: {
+ serp_item: { rank_group: 3, url: "https://example.com/page" },
+ },
+ },
+ expected: {
+ keyword: "sample",
+ searchVolume: 100,
+ difficulty: 12,
+ position: 3,
+ url: "https://example.com/page",
+ },
+ },
+ {
+ slug: "keyword-generator",
+ body: { keyword: " Email Marketing ", locationCode: 2840 },
+ input: {
+ keyword: "email marketing",
+ include_clickstream_data: false,
+ include_seed_keyword: false,
+ ignore_synonyms: true,
+ },
+ item: {
+ keyword: "email marketing tools",
+ keyword_info: { search_volume: 100 },
+ keyword_properties: { keyword_difficulty: null },
+ },
+ expected: {
+ keyword: "email marketing tools",
+ searchVolume: 100,
+ difficulty: null,
+ },
+ },
+ ];
+ it.each(cases)(
+ "$slug caps provider work and maps actual result fields",
+ async ({ slug, body, input, item, expected }) => {
+ bindings.value.DATAFORSEO_API_KEY = "test-key";
+ const reserve = vi.fn().mockResolvedValue("allowed");
+ bindings.value.FREE_TOOL_BUDGET = { getByName: () => ({ reserve }) };
+ vi.stubGlobal("caches", {
+ default: {
+ match: vi.fn().mockResolvedValue(undefined),
+ put: vi.fn().mockResolvedValue(undefined),
+ },
+ });
+ fetchMock
+ .mockResolvedValueOnce(
+ Response.json({
+ success: true,
+ hostname: "openseo.so",
+ action: "free_tool",
+ }),
+ )
+ .mockResolvedValueOnce(
+ Response.json({
+ tasks: [{ status_code: 20000, result: [{ items: [item] }] }],
+ }),
+ );
+ const { Route } = await import(`../src/routes/api/${slug}.ts`);
+ const response = await Route.server.handlers.POST({
+ request: new Request(`https://openseo.so/api/${slug}`, {
+ method: "POST",
+ headers: {
+ "content-type": "application/json",
+ "cf-connecting-ip": "203.0.113.2",
+ },
+ body: JSON.stringify({
+ ...body,
+ turnstileToken: "token",
+ limit: 100000,
+ }),
+ }),
+ });
+ expect(response.status).toBe(200);
+ expect(await response.json()).toMatchObject({
+ locationCode: 2840,
+ keywords: [expected],
+ });
+ expect(reserve.mock.calls[0][0]).toMatchObject({ tool: slug, calls: 1 });
+ expect(JSON.parse(fetchMock.mock.calls[1][1].body)).toEqual([
+ expect.objectContaining({
+ ...input,
+ limit: 20,
+ location_code: 2840,
+ language_code: "en",
+ }),
+ ]);
+ expect(reserve.mock.invocationCallOrder[0]).toBeLessThan(
+ fetchMock.mock.invocationCallOrder[1],
+ );
+ },
+ );
+});
diff --git a/web/vite.config.ts b/web/vite.config.ts
index 29a80392..593c48f1 100644
--- a/web/vite.config.ts
+++ b/web/vite.config.ts
@@ -1,11 +1,49 @@
import react from "@vitejs/plugin-react";
+import { fileURLToPath } from "node:url";
import { tanstackStart } from "@tanstack/react-start/plugin/vite";
import { cloudflare } from "@cloudflare/vite-plugin";
-import { defineConfig } from "vite";
+import {
+ defineConfig,
+ loadEnv,
+ searchForWorkspaceRoot,
+ type Plugin,
+} from "vite";
import tsConfigPaths from "vite-tsconfig-paths";
import tailwindcss from "@tailwindcss/vite";
import mdx from "fumadocs-mdx/vite";
+/**
+ * The deploy scripts set VITE_REQUIRE_TURNSTILE=1. Without a site key in the
+ * bundle the free tools send no Turnstile token, so a worker with
+ * TURNSTILE_SECRET_KEY set rejects every request with 403 — invisible until a
+ * visitor reports it. Fail the build instead.
+ *
+ * This has to be a build hook: a throw at module scope is swallowed by the
+ * prerenderer, which logs the page and carries on with exit code 0.
+ */
+function requireTurnstileSiteKey(siteKey: string | undefined): Plugin {
+ return {
+ name: "openseo:require-turnstile-site-key",
+ apply: "build",
+ buildStart() {
+ if (process.env.VITE_REQUIRE_TURNSTILE !== "1") return;
+ if (siteKey?.trim() && !/^[123]x0+/.test(siteKey.trim())) return;
+ throw new Error(
+ "VITE_TURNSTILE_SITE_KEY is required for a deployable build: without it the free tools send no Turnstile token and every request is rejected with 403. Set a real production site key in web/.env. Test keys cannot be deployed.",
+ );
+ },
+ };
+}
+
+// Vite checks both the file path and its raw-import ID against the allowlist.
+const publicPromptFiles = [
+ "../.agents/skills/setup-openseo/SKILL.md",
+ "../src/client/features/ai-mcp/agentUpdatePrompt.md",
+].flatMap((relativePath) => {
+ const file = fileURLToPath(new URL(relativePath, import.meta.url));
+ return [file, `${file}?raw`];
+});
+
const mdxPlugin = await mdx(await import("./source.config"));
const transformMdx = mdxPlugin.transform;
if (typeof transformMdx === "function") {
@@ -16,30 +54,47 @@ if (typeof transformMdx === "function") {
};
}
-export default defineConfig({
- server: {
- port: 4322,
- },
- ssr: {
- resolve: {
- conditions: ["worker", "import", "module", "default"],
+export default defineConfig(async ({ mode }) => {
+ // Same resolution order Vite uses for import.meta.env, so a key in web/.env
+ // counts and the guard doesn't fire on a correctly configured deploy.
+ const env = loadEnv(mode, process.cwd(), "");
+ const turnstileSiteKey =
+ env.VITE_TURNSTILE_SITE_KEY ?? process.env.VITE_TURNSTILE_SITE_KEY;
+
+ return {
+ server: {
+ port: 4322,
+ fs: {
+ allow: [
+ searchForWorkspaceRoot(process.cwd()),
+ // Public copyable prompts shared with the application outside web/.
+ ...publicPromptFiles,
+ ],
+ },
},
- },
- plugins: [
- mdxPlugin,
- tailwindcss(),
- tsConfigPaths({
- projects: ["./tsconfig.json"],
- }),
- cloudflare({
- viteEnvironment: { name: "ssr" },
- }),
- tanstackStart({
- prerender: {
- enabled: true,
- filter: ({ path }) => !/\.pdf(?:[?#]|$)/i.test(path),
+ ssr: {
+ resolve: {
+ conditions: ["worker", "import", "module", "default"],
},
- }),
- react(),
- ],
+ },
+ plugins: [
+ requireTurnstileSiteKey(turnstileSiteKey),
+ mdxPlugin,
+ tailwindcss(),
+ tsConfigPaths({
+ projects: ["./tsconfig.json"],
+ }),
+ cloudflare({
+ viteEnvironment: { name: "ssr" },
+ }),
+ tanstackStart({
+ prerender: {
+ enabled: true,
+ filter: ({ path }: { path: string }) =>
+ !/\.pdf(?:[?#]|$)/i.test(path),
+ },
+ }),
+ react(),
+ ],
+ };
});
diff --git a/web/vitest.config.ts b/web/vitest.config.ts
new file mode 100644
index 00000000..d0ab4e0e
--- /dev/null
+++ b/web/vitest.config.ts
@@ -0,0 +1,11 @@
+import { defineConfig } from "vitest/config";
+import { fileURLToPath } from "node:url";
+
+export default defineConfig({
+ resolve: { alias: { "@": fileURLToPath(new URL("./src", import.meta.url)) } },
+ test: {
+ include: ["tests/**/*.test.ts"],
+ environment: "node",
+ restoreMocks: true,
+ },
+});
diff --git a/web/wrangler.jsonc b/web/wrangler.jsonc
index 96073032..f41c12c1 100644
--- a/web/wrangler.jsonc
+++ b/web/wrangler.jsonc
@@ -3,7 +3,16 @@
"name": "open-seo-landing",
"compatibility_date": "2026-02-19",
"compatibility_flags": ["nodejs_compat"],
- "main": "@tanstack/react-start/server-entry",
+ "main": "./src/worker.ts",
+ "vars": { "FREE_TOOLS_DAILY_BUDGET_USD": "100" },
+ "durable_objects": {
+ "bindings": [
+ { "name": "FREE_TOOL_BUDGET", "class_name": "FreeToolBudget" },
+ ],
+ },
+ "migrations": [
+ { "tag": "free-tool-budget-v1", "new_sqlite_classes": ["FreeToolBudget"] },
+ ],
"assets": {
"directory": "./dist/client",
"html_handling": "drop-trailing-slash",
@@ -27,12 +36,6 @@
"custom_domain": true,
},
],
- "kv_namespaces": [
- {
- "binding": "BACKLINK_CHECK_KV",
- "id": "b3a051a75a7b478e93b46cdaf6da3572",
- },
- ],
"ratelimits": [
{
"name": "BACKLINK_CHECK_RATE_LIMIT",
@@ -42,18 +45,18 @@
],
"env": {
// Bindings are not inherited by named envs; keep preview's copies in sync.
- // Shared KV id is deliberate: one global daily budget across both workers.
"preview": {
"name": "open-seo-landing-preview",
"workers_dev": true,
"preview_urls": true,
"routes": [],
- "kv_namespaces": [
- {
- "binding": "BACKLINK_CHECK_KV",
- "id": "b3a051a75a7b478e93b46cdaf6da3572",
- },
- ],
+ // Preview has its own budget; it cannot consume the production allowance.
+ "vars": { "FREE_TOOLS_DAILY_BUDGET_USD": "10" },
+ "durable_objects": {
+ "bindings": [
+ { "name": "FREE_TOOL_BUDGET", "class_name": "FreeToolBudget" },
+ ],
+ },
"ratelimits": [
{
"name": "BACKLINK_CHECK_RATE_LIMIT",