Skip to content

A working prototype. Its source and packages aren't public yet.

Effective Cloud

Deploys to Cloudflare that test the new version before it takes any traffic, and undo everything if anything fails. And apps declared in Effect, whose wiring the compiler checks.

2.53s✓deployed 10% on version 5, 90% on the previous version13.52s✓deployed 50% on version 5, 50% on the previous versionCtrl-C14.21s↩rolled back to 100% on the previous versioninterrupted, after undoing what it did
ship's own fixture, rolled out a step at a time, and stopped with Ctrl-C at 50%.

Use them apart or together. infra ships every Worker of an app with ship, so its deploys are ship’s: tested first, and undone on failure.

ship

Deploy any Worker, all or nothing

For a Worker you already have, with a cloudflare.config.ts or a Build Output: plain TypeScript, Hono, a Vite app. No Effect required.

  • A new version, smoke-tested before any user reaches it.
  • Smoke tests that check which version answered, not merely that something did.
  • The traffic all at once, a step at a time, or as a canary judged on error rates.
  • On a failure or Ctrl-C, everything undone, in reverse.
pnpm ship path/to/project --steps 10,50,100

infra

Apps declared in Effect

For an app written in Effect: its Workers, the resources they use, and the calls between them, declared in TypeScript.

  • Resources that are their own typed clients: KV, D1, R2, queues, Durable Objects, Workflows, AI and more.
  • A Worker must bind what its code uses, or it doesn’t compile.
  • Typed calls between Workers, over Cloudflare’s own RPC.
  • plan, ship and destroy for whole apps, with an environment per pull request.
  • An in-memory stand-in for every resource, for tests without mocks.
pnpm infra ship app.ts --env pr-7

To a Worker that’s already live, every time, whichever tool runs it:

  1. ProvisionMakes the KV namespace, D1 database, R2 bucket or queue a binding needs, if it’s missing.
  2. Upload a versionWith no traffic. The deployed version keeps serving everyone.
  3. Test itSmoke tests on the new version alone, which pass only if the new version is the one that answered.
  4. Move the trafficAll at once, a step at a time, or as a canary judged on error rates.

If anything fails, or you press Ctrl-C, it all goes back, in reverse: the traffic to the previous version, and what the ship made, deleted. Resources that existed before are never touched.

A Worker’s first ship goes live at once, as there’s no earlier version to keep the traffic on; if it fails, it’s deleted. How a rollout stays safe has the details, and the real logs.

A D1 database, and a Worker that reads it. That’s a whole app:

guestbook.ts
class Book extends D1.Database<Book>()('book', {
migrations: ['CREATE TABLE entries (id INTEGER PRIMARY KEY, name TEXT, message TEXT, at TEXT)'],
}) {}
const fetch = Effect.gen(function* () {
const book = yield* Book; // a typed D1 client
const entries = yield* book.all('SELECT name, message FROM entries ORDER BY id DESC');
return Response.json(entries);
}).pipe(Effect.orDie);
export default Worker.make('guestbook', { fetch }).bind(Book);

Book is two things at once: the client your code uses, and the declaration of the database it needs. Forget the .bind(Book) and nothing deploys half-wired. You’re stopped before you ship:

$ infra check app.ts
error used-undeclared guestbook.ts:14:16
the Worker uses Book, which it doesn't bind
fix: bind it: .bind(…, Book)

Your editor says the same, as you type: it’s a type error.

And when it’s right, one command makes the database, applies its migrations, uploads the Worker and checks it answers:

$ infra ship app.ts
2.01s ✓ created D1 database guestbook-book
2.47s ✓ applied migration 1 to D1 database guestbook-book
3.68s ✓ created Worker guestbook-guestbook, live
8.16s ✓ smoke test passed: 3 × GET /, answered by the new Worker
8.51s ✓ shipped guestbook-guestbook: https://guestbook-guestbook.you.workers.dev