jevstrudel.git / tools / dev / README.md

tools/dev

The launchers behind the buck targets, in Node.

FileWhat it is
dev.mjsbuck2 run //:dev: the working tree with hot reload.
preview.mjsbuck2 run //:preview: what a deploy would publish.
supervise.mjsRuns the Worker under wrangler dev and restarts it when it exits or stops answering; both launchers use it.
migrate.mjsApplies the Worker's D1 migrations to its local database before it starts; both launchers use it.
worker.mjswrangler dev itself, started inside op-env-run with only the Jev key and what wrangler needs in its environment.

//:dev

Installs the pnpm workspace, regenerates doc.json as upstream's pnpm dev does, then runs two processes:

  • the jevstrudel Worker (worker/) under wrangler dev --env dev, on port 4323: the Jev relay and the MCP hub. It runs with --test-scheduled, since wrangler dev fires no cron triggers: curl localhost:4323/__scheduled runs the Worker's sweep of the screening and scoring Jev owes listeners' content.
  • Astro's dev server for the site, on http://localhost:4322/, which proxies the Worker's paths (/jev/…, /strudel/ws, /strudel/status) to it. The proxy keeps the page's Host, so the Worker's passkey relying party is localhost with the page's own origin.

Before the Worker starts, its local D1 database (worker/.wrangler/state) gets any migration it has not had (migrate.mjs), so a fresh checkout has its tables. The preview does the same to its own (worker/.wrangler/preview).

Stopping it stops both.

//:preview

The last listen before nix run .#deploy, on http://localhost:4324/. It builds the flake's static package, the same derivation the deploy uploads, and serves it as the assets of the Worker in its production environment (--env ""): the Jev relay with your key, and no MCP hub, so /mcp answers 404 as it does on the public site. It installs the Worker's own dependencies first (pnpm install --filter @jevstrudel/worker), from the lockfile the deploy bundles them from. There is no hot reload; run it again after a change. It can run beside //:dev.

Run either inside the devshell, which provides node, pnpm, wrangler, nix and buck2.