Two repositories work together:
| Repository | Holds | You use it to |
|---|---|---|
| The Scwrap repository | The instance's Stack, the SDKs, the scwrap CLI and two example Scrapers | Install and upgrade your instance (Setting up a new instance) and release the SDKs to npm. |
| Your Scraper repository | Your Scraper packages and their Releases | Write, test and deploy your Scrapers to the instance. |
This guide sets up the second one. The rest of Getting Started builds the quotes Scraper inside it.
Requirements
| Tool | Version |
|---|---|
| Node.js | >=24.18.0 |
| pnpm | 11.3.0 |
Do not install with npm or Bun. The workspace relies on pnpm's settings and exact pins.
Get the SDKs
The SDKs are published on npm under the @scwrap scope, each with a provenance statement that ties it to the Scwrap repository's Publish SDKs workflow.
| Package | Job |
|---|---|
@scwrap/domain | Definitions, Scraper.layer, Scraper.run, Shared errors, HTTP helpers, the Capability ports, and the test kit at @scwrap/domain/testing. |
@scwrap/browser | The Browser providers: Cloudflare Browser Run, Browser Use and a local Chromium. |
@scwrap/deploy | Deployment.worker and the scwrap CLI. |
@scwrap/client | The typed instance client. |
@scwrap/platform-apify | Apify Proxy, for Workers and for Node. |
@scwrap/captcha-templates | The local template captcha solver. |
@scwrap/ai-cloudflare | Workers AI through AI Gateway. |
All are MIT-licensed. Depend on each with an exact version, the one your instance runs; pnpm view @scwrap/domain version shows the newest on npm. The examples in this guide use 0.5.0.
IMPORTANT
The SDKs and the instance share exactly one effect, 4.2.0. Every artifact records the SDK version and the Effect version it was built with; the instance accepts only its own Effect version, and its own SDK version or the one before it (How Releases are built). When an upgrade of your instance changes either, move your SDK dependencies to the versions it runs.
The workspace file
The workspace file lists the packages and pins two dependencies the SDKs do not pin for you.
Example (pnpm-workspace.yaml)
packages:
- "packages/*"
- "releases"
allowBuilds:
esbuild: true
overrides:
"@effect/platform-node-shared": "4.2.0"
"playwright-core": "1.65.2"
minimumReleaseAgeExclude:
- "@scwrap/*"Why the less obvious lines are there:
| Setting | Reason |
|---|---|
allowBuilds: esbuild | The scwrap CLI bundles Releases with esbuild, which installs its binary in a build script. |
minimumReleaseAgeExclude | pnpm installs a version only once it is a day old. Excluding the @scwrap scope lets you move to an SDK release on the day it is published, whatever its version. |
@effect/platform-node-shared, playwright-core | @effect/platform-node asks for @effect/platform-node-shared ^4.2.0, which would otherwise resolve to a version newer than the instance's effect. @cloudflare/playwright accepts any playwright-core; the override keeps the 1.65.2 that @scwrap/browser pins. |
The root package.json
The root package holds the tools every package shares and the scwrap script.
Example (the relevant parts of package.json)
{
"private": true,
"type": "module",
"scripts": {
"prepare": "effect-tsgo patch",
"scwrap": "SCWRAP_CATALOG=\"${SCWRAP_CATALOG:-releases/src/catalog.ts}\" scwrap"
},
"devDependencies": {
"@effect/tsgo": "0.74.1",
"@scwrap/deploy": "0.5.0",
"effect": "4.2.0",
"typescript": "7.0.2"
}
}preparepatches TypeScript with the Effect language service, so Effect mistakes such as a missing Capability failtsc.pnpm scwrapruns thescwrapCLI with your catalog as the default.effectis exactly4.2.0. In the SDK packageseffectis an exact peer dependency, andscwrap deployrefuses to build against any other version:
Releases build against effect 4.2.1, but the instance shares effect 4.2.0. Install effect 4.2.0 exactly.Copy tsconfig.base.json from the Scwrap repository to your repository's root. It turns the Effect language service diagnostics into errors.
Then install:
pnpm installThe layout
your-scrapers/
package.json the tools and the scwrap script
pnpm-workspace.yaml the workspace packages and pins
tsconfig.base.json copied from the Scwrap repository
packages/
quotes/ one package per Scraper
package.json exports "." and "./schema"
tsconfig.json
tsconfig.build.json
vitest.config.ts
src/
quote.ts input and output schemas
definition.ts the Definition
api.ts an Implementation
index.ts public exports
test/
acceptance.test.ts
releases/
package.json name releases, depends on @scwrap/deploy and every Scraper it releases
tsconfig.json
src/
quotes.ts one module per Release
catalog.ts the array of ReleasesEach Scraper owns one package. Its package depends on the SDKs by exact version and on "effect": "4.2.0". A Scraper package never imports the deployment SDK, so the same Scraper runs in a test, a script or an instance.
The releases package holds one module per Release and the catalog, whose default export is the array of Releases that scwrap deploy reads. Release modules are .ts files that Node loads with type stripping, so releases/tsconfig.json allows .ts imports. Copy it from the Scwrap repository's apps/infra/tsconfig.json:
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"allowImportingTsExtensions": true,
"lib": ["ES2023", "DOM"],
"module": "Preserve",
"moduleResolution": "Bundler",
"target": "ESNext"
},
"include": ["src/**/*.ts"]
}Commands you will use
| Command | Purpose |
|---|---|
pnpm --filter <package> test | Run one package's tests. |
pnpm --filter <package> build | Build one package into dist/. |
pnpm --filter '{./releases}^...' build | Build every Scraper package the Releases import. |
pnpm scwrap | The deployment CLI for your instance. |
Tests use fake HTTP clients and a local Chromium. They need no cloud credentials.
Next
Your first Scraper creates the quotes package.