">
 

Building a free AI SEO checker for local businesses on Cloudflare Workers

Iniciado por joomlamz, Hoje at 11:25

Respostas: 1   |   Visualizações: 1

Tópico anterior - Tópico seguinte

0 Membros e 1 Visitante estão a ver este tópico.

Saudações à comunidade do **webmastersmz.com**. Como especialista em tecnologia, analisei o conceito de construir um verificador de SEO baseado em Inteligência Artificial utilizando **Cloudflare Workers**. Esta é uma abordagem extremamente eficiente e moderna para o contexto dos pequenos negócios em Moçambique.

Aqui estão os pontos técnicos principais sobre esta implementação:

1.  **Arquitetura "Serverless" (Cloudflare Workers):** A grande vantagem aqui é a ausência de gestão de servidores. Como o tráfego em sites de pequenos negócios locais pode ser intermitente, usar Workers permite que a aplicação escale instantaneamente sem custos fixos elevados. O código é executado na "Edge", o que reduz significativamente a latência para o utilizador final.
2.  **Integração de LLMs via Workers AI:** A Cloudflare disponibiliza o **Workers AI**, que permite rodar modelos de linguagem (como o Llama) diretamente na sua infraestrutura. Isto é revolucionário para um verificador de SEO, pois permite analisar o código HTML de uma página, verificar meta-tags, densidade de palavras-chave e oferecer sugestões de melhoria em tempo real, sem depender de APIs externas pagas e lentas.
3.  **Performance e SEO On-Page:** Para o mercado local, onde a conectividade pode ser um desafio, ter uma ferramenta que processa a análise de SEO de forma leve e rápida é crucial. Um verificador que analise a rapidez de carregamento, a optimização de imagens e a estrutura de dados (Schema Markup) ajuda diretamente os empresários moçambicanos a aparecerem melhor no Google Maps e nas pesquisas locais.
4.  **Custo-Eficiência:** Ao utilizar a camada gratuita ou os planos acessíveis da Cloudflare, um programador consegue criar uma ferramenta robusta gastando quase zero em infraestrutura.

**Convite ao Debate:**
Gostaria de lançar o desafio aos membros do fórum: **Como é que podemos adaptar esta tecnologia para as necessidades específicas do mercado moçambicano?** Por exemplo, será que uma IA treinada para identificar erros de localização e optimização de perfis do "Google Business Profile" seria mais valiosa para os nossos negócios locais do que uma análise de SEO técnica tradicional? Deixem as vossas opiniões e partilhem se já experimentaram integrar Workers com modelos de IA.

---

Para garantir que os vossos projetos e fóruns rodam sem falhas, convido-vos a conhecer as soluções de alojamento de alta performance da **AplicHost** em [https://aplichost.com](https://aplichost.com). Oferecemos a estabilidade e a velocidade necessárias para que a vossa presença digital em Moçambique não seja apenas visível, mas impecável.

Building a free AI SEO checker for local businesses on Cloudflare Workers



Tópico: Building a free AI SEO checker for local businesses on Cloudflare Workers
Categoria: Tutoriais | Programação & Tecnologia
Idioma Principal: Português (Conteúdo de Tecnologia)

Descrição do Conteúdo / Informações:
-------------------------------------------------------------------------
Most free SEO checkers grade a website as if it competed with the whole internet. A dental clinic or a bar in Alicante competes with the three or four businesses that show up next to it on Google Maps. I wanted a checker for that case, so I built one for MapaLocal, the local marketing project I run in Spain. It is live (in Spanish) at mapalocal.es/herramientas/analizador-seo.

This post is about how it is put together and the decisions behind it.



The idea: rules score, the model explains


The tool runs 20+ deterministic checks and turns them into a 0–100 score. A language model never decides the score. It receives the measured results and writes the action plan: what to fix first, why and how, in plain language for a business owner.

That split matters for two reasons:

•
Reproducibility. The same page always gets the same score, and the thresholds are published on the page (title 30–65 characters, meta description 70–160, at least 300 words, alt text on 90%+ of images, server response under 1.5 s, and so on).

•
Honesty. The model can be wrong about wording, but it cannot inflate or deflate the grade.

The checks are grouped into four blocks: basic SEO, content, technical/mobile and local SEO. The local block looks for things generic checkers ignore: LocalBusiness structured data, a visible tel: link, a WhatsApp link, a link to the Google Maps listing and whether the page mentions the city.



Architecture: isolated from the main site


The main site is WordPress. I did not want a tool that fetches arbitrary URLs running inside it, so the analyzer is a separate Cloudflare Worker:

•
WordPress only renders the page and a small JS client.

•
The Worker fetches the target page, extracts signals, runs the checks, calls the model and stores results.

•
D1 (SQLite) holds a 7-day result cache, run logs, reports and unlock records.

Extraction uses HTMLRewriter, which streams the HTML instead of building a DOM. One gotcha: you can attach only one onEndTag handler per element, so JSON-LD capture and other script handlers had to be merged into one.



Fetching untrusted URLs safely


A "type any URL" box is an SSRF invitation. The fetcher:

• accepts only http/https on standard ports, with a URL length cap;

• resolves the hostname over DNS-over-HTTPS first and refuses private, loopback and link-local addresses;

• follows redirects manually, re-validating every hop;

• uses timeouts and reads the body with a byte cap, truncating large pages instead of buffering them;

• downloads only the page itself, robots.txt and the sitemap.



Abuse and cost controls


The model costs real money, so every layer has a limit:

• Cloudflare Turnstile on each request;

• a Workers rate limit binding for bursts per IP;

• a daily quota per visitor: 1 free analysis, 3 after leaving an email (an HMAC-signed unlock token tied to a recent report);

• a global daily budget: each run reserves an estimated cost before calling the model and settles to the real cost afterwards;

• cached results for 7 days, so re-analysing the same URL is free.

IPs are never stored in plain form, only a salted hash, and reports are deleted after 30 days.



The model call


The Worker uses the Anthropic TypeScript SDK with structured output defined by a Zod schema, so the response is validated JSON (priorities, impact, difficulty, steps, a proposed title and meta description) rather than free text I have to parse. If the model is unavailable, the user still gets the deterministic report.



PDF without a server


The full report downloads as a PDF, but the Worker does not render it. The browser already has every result on screen, so the PDF is built client-side with jsPDF, loaded on demand only when someone clicks the button. No extra server load, and no third service touching the data.



What I would tell anyone building a similar tool


• Keep the score deterministic and let the model explain it.

• Treat the URL input as hostile from day one.

• Put a budget cap in code, not just in a dashboard.

• Measure what matters to your users. For local businesses that is a tap-to-call phone and a Maps link more than a Lighthouse score.

The tool is free and needs no sign-up. Feedback is welcome, especially from people who build for small businesses.


Joomlamz
Consultoria em Informática
-------------------------------------------------------
Especialista em Sistemas Web & Manutenção de Servidores.
A desenvolver o novo AplPortal com suporte a PHP 8.
Precisa de ajuda profissional? Contacte-me.

Tags: