Go 1.26
context, goroutines, bounded channels, singleflight, typed domain errors, and strict dependency injection for deterministic tests.
A provider-aware WebSearch service and a policy-guarded WebFetch pipeline, built as two independently deployable Go applications with explicit failure, cache, and fallback behavior.
Search reliability is more than sending an HTTP request and accepting a 200 response.
Providers differ in supported query syntax, continuation state, browser requirements, capacity, CAPTCHA behavior, and result shape. Content reading adds a separate risk surface: SSRF, redirects, JavaScript shells, extraction quality, and output conversion.
SearchX keeps those concerns behind two atomic services. WebSearch returns ranked links and opaque pagination state; WebFetch applies explicit URL policy and turns one public URL into a canonical document. They can evolve and deploy independently instead of becoming one coupled scraping process.
The external gateway routes one contract to the appropriate service. Each service owns its policy, orchestration, adapters, and degradation path.
A request is normalized once, then executed only by providers that can honor its declared semantics.
Gin validates the request, timeout, region, routing order, filters, advanced query options, and optional opaque cursor.
A capability-aware compiler maps supported operators to Brave or DuckDuckGo and removes incompatible providers before execution.
Fresh memory cache and singleflight collapse identical work; stale cache is an explicit degraded fallback when live search fails.
Public requests execute provider adapters sequentially; each adapter leases one profile. The first valid result wins, while a retryable failure advances to the next provider.
Baidu, Bing, Brave, and DuckDuckGo adapters own transport, browser state, parser behavior, and typed failure classification.
URLs are canonicalized, domain rules are enforced, duplicates are removed, and AES-GCM protects provider continuation inside a request-bound cursor.
Content reading is an explicit pipeline with replaceable seams and quality decisions at every stage.
The URL policy accepts only HTTP(S), rejects credentials and unsafe ports, resolves every address, blocks private and reserved ranges, and pins approved DNS answers.
A longest-domain and path registry selects optional site-specific preparation while the generic strategy preserves default behavior.
A bounded HTTP reader handles redirects and body limits before any browser is allocated.
MIME detection chooses HTML or plain-text extraction. A quality evaluator classifies usable content, JavaScript shells, short pages, login walls, and CAPTCHA pages.
Eligible failures and render-required pages use a slot-limited Chromium adapter, then pass through the same extraction and quality path. This branch rechecks the final URL but does not pin DNS or intercept subresource requests.
Readability-backed content is cached independently of presentation, then converted to Markdown or text and truncated by Unicode code point.
The stack is deliberately small: standard Go concurrency around focused adapters for browser automation, extraction, and delivery.
context, goroutines, bounded channels, singleflight, typed domain errors, and strict dependency injection for deterministic tests.
Gin 1.12 HTTP adapters, strict YAML configuration, CORS, request-scoped timeouts, health/readiness routes, and versioned API schemas.
Chrome DevTools Protocol automation, provider parsers, Readeck Readability, HTML-to-Markdown, MIME detection, and plain-text extraction.
DNS/IP rules and target pinning on the HTTP reader path; encrypted, expiring, request-bound cursor state for search pagination.
Separate images and manifests for WebSearch and WebFetch, shared Runtime helpers, environment/YAML overlays, and API Gateway integration.
Unit and integration fixtures, provider parser suites, cursor and SSRF tests, Go benchmarks, race detection, vet, and reproducible curl, Python, and Go examples.
SearchX is retrieval infrastructure, not an answer engine.