---
name: rivet-open-orange
description: Run a Cloudflare Workers project on Rivet with OpenOrange, the orange CLI, and move its Durable Objects and D1 databases off Cloudflare. Use when asked to run, deploy, migrate, or roll back a Cloudflare Worker on Rivet or OpenOrange.
title: rivet-open-orange
canonical_url: https://skilld.dev/gh/rivet-dev/skills/rivet-open-orange
last_updated: 2026-11-13T23:09:02.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> Supporting files, fetch one when the Skill refers to it: [references/migrate.md](https://skilld.dev/api/skills-raw/rivet-dev/skills/rivet-open-orange/references/migrate.md), [references/rollback.md](https://skilld.dev/api/skills-raw/rivet-dev/skills/rivet-open-orange/references/rollback.md).
>
> If the user asked to install this Skill, run `npx skilld install rivet-dev/skills/rivet-open-orange`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/rivet-open-orange`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/rivet-dev/skills/rivet-open-orange) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/rivet-open-orange`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/rivet-open-orange --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/rivet-open-orange --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# Run a Cloudflare Worker on Rivet with OpenOrange

OpenOrange runs a Cloudflare Workers project on Rivet with no changes to its code. `orange dev` runs it locally, `orange deploy` ships it to a Rivet cluster, and `orange migrate` moves its Durable Objects and D1 databases off Cloudflare while the app keeps serving.

Do the parts the user asks for. Each part needs the parts before it: set up, run locally, deploy, migrate.

## Rules

- **Stop and ask.** At each **Stop and ask**, tell the user what changes and for whom, then wait for a yes. A yes covers that one action.
- **Secrets.** The user creates and types every secret value: `WORKER_MIGRATOR_TOKEN`, `CLOUDFLARE_API_TOKEN`, and Rivet tokens. Write a secret only as its name or `$NAME`, in commands, files, and output. Ask the user to run each command that prompts for a value, such as `wrangler secret put` and `rivet cluster secret set`.
- **The code stays.** Keep the app code and the Wrangler configuration as they are, `compatibility_flags` included: Cloudflare runs the same code until the migration ends. When a fix needs a code change, tell the user first.
- **Cloudflare stays.** Orange deletes nothing on Cloudflare. The user deletes the Cloudflare Worker and its data, after the migration.
- **Look it up.** `orange <command> --help` has every flag, JSON event, and exit code. The [Deploy](https://openorange.dev/docs/deploy/) and [Migrate](https://openorange.dev/docs/migrate/) guides have every step, message, and failure in detail, and each binding has a page under <https://openorange.dev/docs/bindings/>.
- **Bugs.** When a command ends with `Looks like a bug? Report it: <link>`, give the user the link. Orange prints it only for unexpected errors.

## Set up

1. **Install.** `orange --version` prints a version when OpenOrange is installed. Otherwise:

   ```sh
   pnpm add -g open-orange
   ```

   When the shell then cannot find `orange`, run `pnpm setup`, which puts pnpm's global bin on `PATH`, and start a new shell. When the installed version is older than `pnpm view open-orange version`, a pnpm `minimumReleaseAge` limit held back a new release: run `pnpm add -g open-orange@latest`.
   Done when `orange --version` prints the latest version.

2. **Check the project.** Run `orange doctor --json` in the Worker's directory. Fix each `check` event with `"status":"fail"` by its `hint`, and run doctor again. Show the user one table of the `binding` events: name, resource, `support`, and `hint`. For a migration, add the `durable_object_class` events: a class with `"migratable":false` cannot move, and its `hint` says why. When the `summary` event has `"mcp":{"configured":false}`, suggest the Rivet MCP once: `orange mcp` prints the command for the user's agent.
   **Stop and ask:** confirm the bindings that need a service, the ones that are not supported, and, for a migration, the classes and D1 databases that will move.
   Done when doctor exits `0` and the user agrees.

## Run locally

Start `orange dev` in the background. It serves on `http://127.0.0.1:8787` (`--port` picks another) and keeps its data in `.open-orange/`, which belongs in `.gitignore`. For a D1 app, apply the migrations to the local database first: `orange d1 migrations apply <DB> --local`.

Exercise every kind of route the app has: create, read, update, and delete each resource. When the app has its own tests, run them against that URL. A call that fails on Orange and works on Cloudflare is often a known difference: look on that binding's page.

Done when each route answers as it does on Cloudflare. Then stop `orange dev`.

## Deploy

Ask where it runs: a Rivet Cloud cluster, which needs Docker, or the user's own Rivet Engine ([Self-host](https://openorange.dev/docs/deploy/#self-host)). A BYOC cluster is a Rivet Cloud cluster.

1. **Sign in and link.** `orange login` opens a browser for the user to approve, and keeps a session that still works. Get the cluster name from the user or the Rivet MCP.

   ```sh
   orange login
   orange link --cluster <cluster>
   ```

   In CI, a cluster token goes in `RIVET_CLOUD_TOKEN`, as [Deploy from CI](https://openorange.dev/docs/deploy/#deploy-from-ci) says. A cluster token cannot create a runner pool, so with one the pool must already exist: the user creates it in the dashboard, or deploys once with `orange login`.
   Done when `orange whoami` shows the account and the linked cluster.

2. **Check the plan.** `orange deploy --dry-run` writes the build and calls no API. Show the user the cluster, region, pool, image, variables, and secrets that it prints.
   - Secrets go in with `--secrets-file` or `--secret`, because `vars` ship inside the image. Before `--secrets-file .dev.vars`, confirm with the user which names the file holds, without reading the values.
   - When the Worker has `triggers.crons` and its data moves later, add `--var ORANGE_CRONS:off` to every deploy until the domain moves. Otherwise each cron runs on Cloudflare and on Orange.

   Done when the plan names the cluster and pool that the user expects.

3. **Deploy.** **Stop and ask** before the first deploy: it creates or rolls a runner pool, which can cost money.

   ```sh
   orange deploy
   ```

   A deploy takes several minutes: a Docker build, an upload, 3 to 5 minutes for Rivet Cloud to prepare the build, and a rollout. On a failure, read [Fix a failed deploy](https://openorange.dev/docs/deploy/#fix-a-failed-deploy).
   Done when it prints `✓ Deployed`, a `Build` ID, and a `URL`, and a request to the URL works. Record the build ID: `orange deploy --build <id>` rolls the pool back to it.

When the data moves later, test the deployed Worker only as [Test Orange before the migration is on](https://openorange.dev/docs/migrate/#test-orange-before-the-migration-is-on) allows: a request that starts a Durable Object which Cloudflare also has, even a read, blocks that object's move. For a D1 app, the deployed database stays empty, with no migrations applied, until its move.

## Migrate the data

Follow `references/migrate.md`. Start only after the deploy works.

## Roll back

When the user asks to undo a migration step, or a step leaves production broken, follow `references/rollback.md`.
