RORK LABJP
PLAY — Google Play's target API level 36 requirement took effect yesterday, August 31. From today, new apps and updates must target Android 16VISIBILITY — Apps still on API 35 stay listed but disappear for users on newer Android versions. No error is raised; new installs simply fade, which makes the change easy to missEXTENSION — If you missed the deadline, an extension through November 1, 2026 can be requested in Play Console — best filed alongside a concrete migration planAPPLE — On the Apple side, the event lands September 9 and iOS 27 is reported to ship September 14. Testing generated apps on iOS 27 hardware before release week is time well spentEXPO — Expo released expo-paste-input on August 28, a native module that brings image, GIF, and sticker paste to React Native TextInputEAS — EAS Observe reached general availability on August 20, putting crash and performance monitoring on the same EAS platform as builds and updatesPLAY — Google Play's target API level 36 requirement took effect yesterday, August 31. From today, new apps and updates must target Android 16VISIBILITY — Apps still on API 35 stay listed but disappear for users on newer Android versions. No error is raised; new installs simply fade, which makes the change easy to missEXTENSION — If you missed the deadline, an extension through November 1, 2026 can be requested in Play Console — best filed alongside a concrete migration planAPPLE — On the Apple side, the event lands September 9 and iOS 27 is reported to ship September 14. Testing generated apps on iOS 27 hardware before release week is time well spentEXPO — Expo released expo-paste-input on August 28, a native module that brings image, GIF, and sticker paste to React Native TextInputEAS — EAS Observe reached general availability on August 20, putting crash and performance monitoring on the same EAS platform as builds and updates
Articles/Dev Tools
Dev Tools/2026-07-14Advanced

Adding a Single Zod Validation Boundary to Rork's Generated Fetch Code

The network code Rork generates implicitly trusts the shape of the response. When the API shifts, the screen quietly goes blank. Here is how to slip a single Zod parse layer between the generated UI and the network to make failures predictable, with numbers from real operation.

Rork547React Native234zod2API7Error Handling8

Premium Article

One morning, on one of the apps I build and run on my own, a single list screen was reported as blank. The crash logs showed nothing. It had not crashed. The data just would not appear.

The cause was on the server. The day before, the price field in the API response had changed from a number to a string. The fetch code Rork had generated treated that field as a number, exactly as it was written. The type mismatch went unnoticed until runtime, and only the rendering quietly stopped.

This "silent way of breaking" in generated network code is unavoidable once you run several apps as an indie developer. I've stepped on this same rake more than once across the apps I ship on the App Store and Google Play. Rather than rewriting all of the generated code, what follows is a minimal approach: slipping a single validation boundary between the network and the UI.

Why generated fetch code breaks silently

When an AI builder like Rork writes fetch code, it infers the response shape from your prompt or a single sample. What it produces usually looks like this:

// A typical fetch Rork tends to generate
async function getProducts() {
  const res = await fetch("https://api.example.com/products");
  const data = await res.json();
  // data.items is "supposed" to be an array — but nothing guarantees it
  return data.items.map((item) => ({
    id: item.id,
    name: item.name,
    price: item.price, // "supposed" to be a number
  }));
}

This code works the moment it is generated. The problem is that the response shape is frozen to "the assumption at that moment."

If the API renames items to results, data.items.map becomes undefined.map and throws. If price becomes a string, it does not throw at all — a price calculation quietly turns into NaN, or a comparison silently goes wrong. The latter is the nastier one. Bugs that crash get noticed; bugs that quietly produce wrong answers survive in production for a long time.

TypeScript's type annotations will not protect you from this mismatch. Types are a compile-time promise; they do not inspect the JSON that arrives from the server at runtime. Data from beyond the boundary can always betray its declared type.

The idea: slip in just one validation boundary

One option is "don't trust the generated code, rewrite all of it by hand." But that dilutes the point of using Rork. After about three months of using it, my honest takeaway is that letting the AI handle the scaffolding (the skeleton and layout of a screen) while I personally handle the critical seams is the realistic division of labor.

One of those critical seams is the boundary between the network and the UI.

The idea is simple. Between the generated fetch and the UI component, you slip in exactly one layer that inspects the response and converts it into a trustworthy shape. Any data that passes through this layer can be handled downstream with confidence. Whatever happens inside the layer (the communication with the server), the UI only ever receives one of two things: validated data, or a handleable error.

Zod, which validates schemas at runtime, fits this boundary well. Many people have used Zod for form input validation; here we point the same idea at the API response side. I cover the input side in rebuilding Rork's generated form screens with react-hook-form and zod. This article is the opposite direction: the data coming from the server.

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
If your screen kept going silently blank whenever the API changed shape, you can add a validation boundary today that makes failures predictable
You will get the concrete implementation and code to slip a Zod parse layer between the network and the UI without rewriting the generated code
You will learn where to place the boundary so regeneration never wipes it out
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 $15 for lifetime access
View Membership →

Related Articles

Dev Tools2026-07-24
Collapsing Duplicate Requests Into One: A Reference-Counted Single-Flight Layer
When several components fire the same API call at launch, you get a burst of identical requests. Here is a single-flight layer that shares one in-flight promise instead: how to build the key that decides the folding, the trap of handing out a failed promise forever, the trap of one caller's abort cancelling everyone, and the test that keeps it all from regressing, with the real network numbers alongside.
Dev Tools2026-06-19
Hardening API Calls in Rork Apps: Token Refresh, Retry, and Idempotency
The fetch Rork generates is left fragile against expired tokens, flaky signal, and double sends. Here is a design that consolidates token refresh, retry with backoff, and idempotency keys into a single client layer, with implementation code and operational numbers.
Dev Tools2026-06-19
Rebuilding Rork's Generated Form Screens for Real Use: react-hook-form and zod
Rork's generated forms look fine on screen but fall apart on a real device: the whole screen re-renders on every keystroke, the keyboard hides the submit button, and slow networks invite double submits. Here is how I rebuild them with react-hook-form and zod, from an indie developer's point of view.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →