Index of every page on this site: llms.txt
All skills
ral7 avatar

/self-hosted-expo-ota

@084fe7c
Run it yourself

Set up and publish self-hosted Expo Updates on a Cloudflare Worker with expo-worker-ota (R2, laptop signing, Workers Free). Use when the user mentions OTA, expo-updates, EAS Update alternative, Cloudflare Worker updates, publish JS to a phone, runtimeVersion, rollback-to-embedded, or npx expo-worker-ota. Never invent the Expo Updates protocol.

  • 1 file
  • 4.9 KB
  • Updated 3 months ago
  • GitHub
Use this Skill: https://skilld.dev/gh/ral7/expo-worker-ota/self-hosted-expo-ota

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈92 tokens for metadata: the name and description. ≈1.2k when used: this file.

Description uses 4.6% of example budget

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

  • A shorter description leaves more room for other Skills. This entry exceeds our 1% size suggestion.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses ≈368 characters, or 4.6%.

The 1% threshold is a size suggestion. Longer descriptions can still fit.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

Self-hosted Expo OTA

This skill is a babysitter. The protocol lives in this repo's scripts. Copy them. Do not generate Expo Updates v1 from docs, memory, or "a simple Worker that returns JSON."

Install

If the app has no ota-worker/ folder:

npx github:ral7/expo-worker-ota init

If they already have Cursor and want this skill in the project:

npx skills add ral7/expo-worker-ota

Init copies the Worker, scripts/publish-ota.mjs, scripts/verify-ota.mjs, scripts/deploy-ota.mjs, gitignores keys/, and generates the signing cert. It does not upload the private key.

Five steps (the whole UX)

  1. In their Expo app: npx github:ral7/expo-worker-ota init
  2. Init writes ota-worker/, scripts/, gitignores keys/, generates the cert, and prints what goes in app.json. Do not edit wrangler.toml by hand unless they asked for a custom name (--name).
  3. Cloudflare once: npx wrangler login then npm run ota:deploy (creates the R2 bucket and deploys). Deploy writes updates.url.
  4. Ship one Release binary with that URL baked in. TestFlight is enough. Metro / Debug will not download OTA.
  5. Forever: npx expo export --platform ios --platform android then npm run ota:publish

Default runtimeVersion is "1". That is the native shell, not the store version (1.0.4 is unrelated).

Decision tree

Before any publish:

  • Native plugin, permission, Expo SDK, signing cert, or updates.url changed → stop. That needs a new store binary. If the native OTA contract changed, bump runtimeVersion ("1" → "2") so old binaries keep their slot.
  • JS / copy / API client only, and a Release build already points at their Worker → export, publish, verify.
  • They said a TestFlight fence / second slot → publish with --runtime 2 only if they asked. Never publish runtime 2 onto the store slot.

Hard rules

  1. Do not rewrite ota-worker/src/ota.ts, scripts/publish-ota.mjs, scripts/verify-ota.mjs, or scripts/deploy-ota.mjs. If something is wrong, copy again from ral7/expo-worker-ota. If the files are missing, run init, do not invent replacements.
  2. Never upload keys/private-key.pem. Not to the Worker, R2, GitHub, CI, or wrangler secrets. Signing happens on the laptop. The Worker only serves R2 bytes.
  3. Never commit keys/. certs/certificate.pem belongs in git. It is baked into the binary.
  4. Do not publish every commit. Workers Free is 100k requests/day account-wide. Each update makes every device download the bundle plus assets through the Worker. This is a hotfix hose.
  5. Do not expect Metro to show the update. Use a Release install. Force-quit, open, force-quit, open. First process downloads. The next process start runs the new JS.
  6. Verify before telling them it worked. npm run ota:verify (or node scripts/verify-ota.mjs --url <origin>) must be 204 (nothing published yet) or 200 multipart/mixed. Never 404.
  7. Rollback is a HEAD pointer, not a delete: npm run ota:rollback. Old R2 objects stay.

Commands

npx github:ral7/expo-worker-ota init                 # from the folder with app.json
npx github:ral7/expo-worker-ota init --name my-ota   # optional worker / bucket name
npx wrangler login
npm run ota:deploy
npm run ota:verify               # 204 until first publish
npx expo export --platform ios --platform android
npm run ota:publish
npm run ota:rollback

publish and verify read ota.config.json (written by init/deploy). --origin, --runtime, --channel, --private-key override.

app.json (native contract)

After deploy, expo.updates.url must be https://<worker>.<subdomain>.workers.dev/ota/manifest. Changing it requires a new binary.

{
  "expo": {
    "runtimeVersion": "1",
    "updates": {
      "enabled": true,
      "url": "https://YOUR-WORKER.workers.dev/ota/manifest",
      "checkAutomatically": "ON_LOAD",
      "fallbackToCacheTimeout": 0,
      "requestHeaders": { "expo-channel-name": "production" },
      "codeSigningCertificate": "./certs/certificate.pem",
      "codeSigningMetadata": { "keyid": "main", "alg": "rsa-v1_5-sha256" }
    }
  }
}

If app.config.js / app.config.ts is in use, do not smash it. Print the snippet and let the user (or a careful edit) add the fields.

What you must not do

  • Implement "Updates v1" from scratch.
  • Teach EAS Update as a fallback in the same flow. One path.
  • Put the private key in a Worker secret.
  • Point updates.url at r2.dev or a guessed subdomain.
  • Bump runtimeVersion for a JS-only hotfix.
  • Tell them Debug / Expo Go will pick up the publish.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No third-party reports yet.

Signed by skilld at 084fe7c. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 months ago.

Steadyupdated 3 months ago

README badge

README badge for ral7/expo-worker-ota