@scwrap/domain is the SDK a Scraper package imports. It owns the contract and stays out of everything else: it knows nothing about Cloudflare, deployment or storage, and depends only on effect.
Because of that, a Scraper runs the same in a test, in a script and on an instance.
What it exports
| Export | Job | Page |
|---|---|---|
Scraper | Scraper.make declares a Definition, Scraper.layer implements one, Scraper.run runs one with its input and output checked, Scraper.rpc reads its schemas. | Scraper |
Blocked, RateLimited, UpstreamDown, QuotaExhausted, SchemaDrift, InvalidInput | The Shared errors. | Errors |
Download, retryHttpClient, httpFailure, httpStatusFailure, isTransientHttpFailure, decodeScrapedRecord, cleanText, clockTime, numericDate, localTimeToUtc | Helpers for HTTP sources and for decoding scraped data, text and dates. | HTTP helpers |
ProxiedHttpClient, ProxyRoute, CountryCode | The Capability for proxy routes. | Proxied HTTP client |
Browser, Page, BrowserOptions, NavigationOptions, BrowserError, navigate, clickUntilChanged | The Capability for a real browser, and the page helpers. | The Browser Capability |
TextCaptchaSolver, TextCaptcha, TextCaptchaReading, CaptchaUnreadable, firstConfident | The Capability for text captchas. | Captcha solving |
FakeSite, ScraperTest, from @scwrap/domain/testing | The test kit: a fake site and a typed Run. | Test kit |
Ports, not providers
Three of these exports are ports: ProxiedHttpClient, Browser and TextCaptchaSolver. A port is the interface of a Capability. It says what a Scraper can ask for and nothing about who answers.
Providers live in other packages:
| Port | Providers |
|---|---|
ProxiedHttpClient | apifyProxy in @scwrap/platform-apify, for Workers and for Node |
Browser | browserRun, browserUse, nodeBrowser and playwrightBrowser in @scwrap/browser |
TextCaptchaSolver | The template engine in @scwrap/captcha-templates; any DecisionModel through TextCaptchaSolver.fromDecisionModel |
One Capability is not in this package at all: HttpClient is Effect's own, from effect/http. The Browser port names no Playwright type, so a Scraper that opens a browser still depends only on @scwrap/domain; Playwright stays in its providers.
Boundaries
Lint enforces what this package may import:
packages/domainimports onlyeffect. Its ports may nameeffect/httptypes such asHttpClient, but nevereffect/http-api, a vendor SDK or Alchemy.- A Scraper package imports
@scwrap/domain, browser Scrapers included; its tests may use a provider such asnodeBrowser. It never imports@scwrap/deployor an app.
The rule is scwrap-boundaries/no-core-adapters in boundaries.ts.
Source
packages/domain/src has one file per export. Its tests in packages/domain/test are properties over generated Definitions, inputs and failures.