SiteSearch self-hosted

docs

Architecture, the web-search upstreams, crawling, the HTTP API, and how to deploy your own copy. The full guides live in the repo’s docs/ folder.

architecture

Three pieces on Cloudflare:

Full guide: docs/architecture.md · console walkthrough: docs/console.md

web search upstreams

UpstreamKey?Notes
DuckDuckGo (HTML)noHTML scrape of html.duckduckgo.com, falls back to lite.duckduckgo.com. Skip if bot-checked.
Wikipedia (MediaWiki API)noAlways available; grounds results with real encyclopedia facts.
Internet ArchivenoFull-text search over books, texts and captures. Always available.
Google BooksnoBook corpus; keyless tier is rate-limited — opt-in only.
Brave Search APIyesOptional BRAVE_API_KEY adds a commercial-grade independent index.

Configure with the UPSTREAMS var. Full guide: docs/upstreams.md

crawling “your sites”

From the console, add a site with a sitemap.xml URL and/or seed links. The crawler discovers sitemap-index files, follows same-domain links, respects robots.txt and per-site include/exclude patterns, re-crawls stale pages, and dedupes by content hash. Text lands in a D1/SQLite FTS5 index; search is BM25-ranked with highlighted snippets.

Full guide: docs/deployment.md

http api

EndpointAuthPurpose
GET /api/web?q=&page=— / keyAggregated web search
GET /api/ai/suggest?q=— / keyAI query suggestions (Groq)
GET /api/ai/answer?q=— / keyAI answer citing web + your crawl index
GET /api/search?q=&site=&page=— / keySearch your crawl index
GET /api/sites— / keyIndexed-site list for the filter
GET /api/healthLiveness
/api/admin/*tokenSites, crawls, runs, pages, stats, settings, keys

By default the API is open; set the api_auth setting to keys to require an API key (create them in the console). Admin auth: Authorization: Bearer <ADMIN_TOKEN>. Full reference: docs/api.md · keys guide: docs/api-keys.md · settings: docs/settings.md

deploy your own

npm install
npx wrangler d1 create sitesearch        # paste database_id into wrangler.toml
npx wrangler secret put ADMIN_TOKEN
npm run db:migrate
npm run deploy                            # worker + cron

npx wrangler pages project create sitesearch --production-branch main
npx wrangler pages deploy pages/static --project-name sitesearch --commit-dirty

Done — yours lives at *.pages.dev. Full guide: docs/deployment.md

← back to search