◉RORK LABJP
●ARCHIVE — Since 11/22 you can archive a Rork project instead of deleting it, and bring it back from Archived●PLAY FIX — Fixed: Expo apps built for Google Play losing their Rork AI key, which broke AI features●SONNET 4.5 — Sonnet 4.5 retires from the Claude API on 11/30, 7 days left. Check which model your app calls●SPLASH — Expo users report apps stuck on the splash screen after rolling back to an earlier update●NEW — New: Three clues to check before replying to a "stuck on the splash screen" review●2.5 ROUTE — From 12/1, Gemini 2.5 requests reroute to newer models at new rates. 8 days left●ARCHIVE — Since 11/22 you can archive a Rork project instead of deleting it, and bring it back from Archived●PLAY FIX — Fixed: Expo apps built for Google Play losing their Rork AI key, which broke AI features●SONNET 4.5 — Sonnet 4.5 retires from the Claude API on 11/30, 7 days left. Check which model your app calls●SPLASH — Expo users report apps stuck on the splash screen after rolling back to an earlier update●NEW — New: Three clues to check before replying to a "stuck on the splash screen" review●2.5 ROUTE — From 12/1, Gemini 2.5 requests reroute to newer models at new rates. 8 days left
Articles/Dev Tools
⬡ Dev Tools/2026-06-22Advanced

Serving Both Plain Rork and Rork Max From One Backend — Designing an API Response Contract That Never Breaks Old Binaries

When plain Rork (React Native / Expo) and Rork Max (native Swift) both call the same Cloudflare Workers backend, the whole design centers on not breaking old binaries you cannot force-update. Wrap responses in an envelope, evolve them additively, absorb client differences with capability flags, and retire old contracts safely — shown in code.

Rork621Rork Max236Cloudflare Workers26API versioningarchitecture12

✦ Premium Article

One morning I "tidied up" a response by renaming a field from title to displayTitle and shipped it. On my latest local build, nothing broke. A few hours later, reports started coming in from devices still running the previous version: their list screens had gone blank. The cause was mundane — the old app reached for title, and the value was no longer there.

The decisive way a mobile backend differs from a web one is this: you cannot swap the client out from under your users. On the web, the next reload hands everyone fresh JS. An app sits behind store review and each user's decision to update. People who never update keep hitting your backend today on a binary from six months ago.

That asymmetry gets heavier the moment you start using plain Rork (cross-platform generation via React Native / Expo) alongside Rork Max (native Swift generation). The same feature receives its response through JavaScript fetch on one side and Swift URLSession on the other. As an indie developer I run several Expo apps behind a single Cloudflare Workers backend, and I am currently revisiting the contract on the assumption that native clients from Max will join it later. This article shares the implementation that lets you grow such a backend without breaking it.

Why decide the "contract" first

A response shape is a contract, not a casual promise. Once it is baked into some binary out in the world, you are bound to it until that binary disappears. So the first thing to settle is not the individual fields but the rule for how they are allowed to change.

I keep only two rules. First, every response is wrapped in an envelope that separates the payload from metadata. Second, field changes are additive only — no deletions, no renames, no quiet shifts in meaning. Holding to just these two erases most of the incidents where an old binary falls over.

The minimal response envelope

The envelope is the outer structure every endpoint shares. The payload itself lives in data, and around it you place the protocol version and any operational metadata the server wants to attach. On the Cloudflare Workers side, a thin helper does the wrapping.

// envelope.ts — every response comes back in this shape
type Envelope<T> = {
  protocol: number;       // version of the envelope itself (rarely bumped)
  data: T;                // payload; grows additively only
  meta: {
    serverTime: string;   // ISO8601
    minSupported: number; // clients below this are nudged to update
    notice?: string;      // optional announcement (maintenance, etc.)
  };
};
 
export function ok<T>(data: T, minSupported = 1): Response {
  const body: Envelope<T> = {
    protocol: 1,
    data,
    meta: { serverTime: new Date().toISOString(), minSupported },
  };
  return Response.json(body);
}
 
export function fail(code: string, message: string, status = 400): Response {
  // errors are wrapped too; clients branch on error, not on the presence of data
  return Response.json(
    { protocol: 1, error: { code, message },
      meta: { serverTime: new Date().toISOString(), minSupported: 1 } },
    { status },
  );
}

The point is that both success and error come back in the same envelope. Clients branch on "is there an error," not on "is there data." Do this, and when you later add something like retryAfter to errors, existing clients simply look past it and ignore it. That they ignore it is the whole point of the envelope.

✦

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
✦A minimal response envelope that lets one backend serve both a React Native client and a native Swift client without either one breaking the other
✦The additive-only discipline that keeps old binaries alive when you add fields, plus a decision table of the breaking changes you must never make
✦An operational procedure for reading your client-version distribution from logs and deciding the threshold at which it is safe to sunset an old contract
Secure payment via Stripe · Cancel anytime
✦

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Rork Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $10 for lifetime access
View Membership →

Related Articles

⬡ Dev Tools2026-05-09
Building a Rork A/B Testing Platform with GrowthBook and PostHog from Scratch
Drop Firebase and pair GrowthBook with PostHog to ship an A/B testing stack for your Rork apps: SDK wiring, a KV-cached feature endpoint on Cloudflare Workers, sample-size math, SRM checks, and the operational pitfalls.
⬡ Dev Tools2026-04-30
Rork × AI Moderation Production Guide: Reporting, Auto-Review, and Tiered Sanctions for UGC Apps
A complete production-grade guide to layering AI moderation, reporting, and tiered sanctions into your Rork UGC app. Includes a working three-layer pipeline using OpenAI Moderation, Perspective API, and Cloudflare Workers Queues.
⬡ Dev Tools2026-11-19
New Wallpapers Showed Up Everywhere Except the Filters: Ship the Count and the Category Lists Together
I added 67 wallpapers in one batch. They appeared in the full list and in New, but not under a single category filter, because I had raised the ID limit and forgotten to ship the category lists. Here is a pre-bump check, a client-side way to spot silent fallbacks in an Expo app, and a post-release count against the origin.