To run on an instance, a Scraper needs a Release: one deployable build that names the Definition, picks an Implementation and provides its Capabilities.
quotes only needs fetch, so it becomes a Worker release that runs inside the instance's Worker.
Declare the Release
Releases live in your repository's releases package, one module each, apart from the Scraper's package.
First add the Scraper and the deployment SDK to releases/package.json and run pnpm install:
"dependencies": {
"@scwrap/deploy": "0.5.0",
"@scwrap/quotes": "workspace:*",
"effect": "4.2.0"
}Then declare the Release.
Example (releases/src/quotes.ts)
import { Deployment } from "@scwrap/deploy";
import { Quotes, QuotesApiLive } from "@scwrap/quotes";
import { FetchHttpClient } from "effect/http";
export default Deployment.worker({
implementation: QuotesApiLive,
module: import.meta.url,
scraper: Quotes,
services: FetchHttpClient.layer,
});A Release is the default export of its own module.
| Field | Meaning |
|---|---|
scraper | The Definition. Its ID, quotes, becomes the Release's ID on the instance. |
implementation | The Implementation this Release runs. |
services | A Layer that provides every Capability the Implementation needs. |
module | Always import.meta.url: where the bundler finds this Release. |
A Release also has a revision, a label that defaults to v1. The digest of the built code, not the label, identifies a build.
A missing Capability does not compile
An instance supplies no Capabilities. Whatever the Implementation needs, services must provide.
QuotesApiLive needs an HttpClient, and FetchHttpClient.layer provides one. If you pass a Layer that does not, the compiler stops you at the implementation line:
Type 'HttpClient' is not assignable to type 'never'.
Missing 'HttpClient' in the expected Layer context. effect(missingLayerContext)You find out at your desk, not in production.
Add it to the catalog
Your repository's Releases are the entries of one array, the default export of the catalog module.
Example (releases/src/catalog.ts)
import QuotesRelease from "./quotes.ts";
const catalog = [QuotesRelease];
export default catalog;A Scraper that is not in this array is not deployed. pnpm scwrap reads releases/src/catalog.ts unless SCWRAP_CATALOG names another module.
Deploy it
WARNING
Deploying changes a live instance. Know which instance SCWRAP_INSTANCE_URL names before you run it.
The scwrap CLI sends the selected Releases' source to the instance, which typechecks, builds and deploys them. It reads the instance from two environment variables:
| Variable | Value |
|---|---|
SCWRAP_INSTANCE_URL | Your instance's HTTPS origin, such as https://scwrap.example.com. |
SCWRAP_INSTANCE_DEPLOYER_TOKEN | The instance's deployer token. Keep it in the environment, never in a command argument. |
Build the packages the catalog imports, then deploy quotes:
pnpm --filter '{./releases}^...' build
pnpm scwrap deploy quotesThe CLI prints where it keeps this deploy's journal, then one JSON line per Release:
Journal: /home/you/.local/state/scwrap/journals/2026-11-22T16-21-07-512Z-3f9a1c2e{"buildId":"…","status":"passed","scraper":{"id":"quotes","revision":"v1"},"deployment":{"deploymentId":"build-…","generation":"…","status":"active"}}active means the instance now runs this Release. A build that fails prints the TypeScript diagnostics instead, and nothing changes.
If the status is pending
pending means the upload happened but the instance has not confirmed the new version yet. It is not a failure, and it is not a success.
Run retry with the journal the deploy printed until the Release is active:
pnpm scwrap retry --journal "$HOME/.local/state/scwrap/journals/2026-11-22T16-21-07-512Z-3f9a1c2e"The journal is a directory the CLI creates outside the repository. It holds the exact build requests it sent, so a retry repeats the same build and deployment even after you changed the source.
Check what is installed
pnpm scwrap deploymentsThis prints the instance's generation and every installed Release with its id, revision and digest.
Deploying from CI
Your repository's CI can deploy the same way after its tests pass, with the instance URL and the deployer token as secrets:
pnpm scwrap deploy --changed --journal "$journal"--changed sends the whole catalog; the instance deploys only the Releases whose build differs from what it runs, and never removes one. Releases that other repositories deployed to the same instance stay installed.
What the instance now does
For every Run of quotes, the instance's Worker:
- Checks the input against
QuotesQuery. - Runs
QuotesApiLivewithfetch. - Checks each quote against
Quoteand writes it to R2. - Writes the result record:
completedorfailed, the item count and the Release's digest.
Next
Calling your Scraper runs the deployed Scraper and reads its items.
For the details behind this page, see Releases and The scwrap CLI.