RORK LABJP
IOS27 — iOS 27 and iPadOS 27 ship on September 14, three days out. The ground always shifts under app builders in the days right after a releaseWAIT — Standard Rork waits on Expo and React Native to catch up. Rork Max can follow as soon as Xcode and the SDK are ready. Different kinds of waitingFOLD — The folding iPhone Duo starts at $1,999. A new screen shape is the first place a generated layout tends to come apartSTACK — Standard Rork emits React Native through Expo; Rork Max emits native Swift. A great many write-ups still conflate the twoPRICE — Standard tiers run Free, Junior at $25, Middle at $50 and Senior at $100. Rork Max spans $200 to $1,800 a month depending on tierSOURCE — Funding figures differ across secondary coverage right now. If you cannot verify a number at the source, leave it outIOS27 — iOS 27 and iPadOS 27 ship on September 14, three days out. The ground always shifts under app builders in the days right after a releaseWAIT — Standard Rork waits on Expo and React Native to catch up. Rork Max can follow as soon as Xcode and the SDK are ready. Different kinds of waitingFOLD — The folding iPhone Duo starts at $1,999. A new screen shape is the first place a generated layout tends to come apartSTACK — Standard Rork emits React Native through Expo; Rork Max emits native Swift. A great many write-ups still conflate the twoPRICE — Standard tiers run Free, Junior at $25, Middle at $50 and Senior at $100. Rork Max spans $200 to $1,800 a month depending on tierSOURCE — Funding figures differ across secondary coverage right now. If you cannot verify a number at the source, leave it out
Articles/Dev Tools
Dev Tools/2026-06-22Advanced

Hardcoding Your OpenAI Key in a Rork (Expo) App Means It Gets Stolen — Slip a Thin Worker Proxy In Between

Embed an OpenAI or Gemini API key directly in the Expo app Rork generates and it can be extracted from the shipped binary. Here is why a key inside an app is never secret, plus a minimal Cloudflare Workers proxy that hides it (streaming passthrough included), simple abuse controls, and key rotation that needs no app review.

Rork560Expo205Cloudflare Workers24API keyssecurity5

Premium Article

The first thing you want to do when adding AI to a Rork-generated app is set EXPO_PUBLIC_OPENAI_KEY and call OpenAI straight from the app. It works. The demo is done in seconds. But that key can be pulled out by anyone who downloads your app from the App Store, in minutes.

You might assume the source is hidden because it's "compiled into the build." I assumed the same at first. In reality, a shipped app is not an encrypted treasure chest—it's a bundle of files with strings sitting in plain view. When the key leaks, the bill lands on you. Below I'll make it concrete why hardcoding is dangerous, then build—in real code—a minimal setup that slips one thin Cloudflare Workers relay in between to isolate the key on the server.

Why a key embedded in the app is never secret

The logic is simple. An app binary (an iOS .ipa, an Android .apk/.aab) is copied whole onto the user's device. The owner of that device can unpack it freely. Expo / React Native JavaScript bundles are especially readable: run them through strings or an unpacking tool and the embedded literals line up for you.

Environment variables with the EXPO_PUBLIC_ prefix are statically baked into the JavaScript bundle at build time. As the "public" in the name says, they're meant to be readable from the client. So does dropping the prefix hide it? No. Placing it in a native config file or code only raises the extraction effort slightly; the essence is unchanged.

Worse, HTTPS doesn't save you here. An attacker fully controls their own device, so they can put a man-in-the-middle proxy (such as mitmproxy) between the app and OpenAI and read their own traffic in the clear. If the request carries Authorization: Bearer sk-..., it's over.

In short, the moment it's on the client, it stops being secret. The only reliable defense for a key worth protecting is to never deliver it to the device at all.

Keys you can ship in the client vs. keys you can't

You don't need to hide every key. First, tell apart "keys designed to be used on the client" from "server-only keys." The single deciding question: if this key leaks, can a third party spend money or write data?

Key / valueClient?Reason
Firebase apiKey (config)OK to shipAn identifier, not a secret. Access control lives in Security Rules
RevenueCat public SDK keyOK to shipA public key issued for the client. Purchases are verified by server signatures
Stripe publishable key (pk_)OK to shipPublic by design. Charges are finalized by the server holding the secret key
OpenAI / Gemini / Anthropic API keyNever shipLeak it and a third party bills against your balance. Usage costs run uncapped
Stripe secret key (sk_)Never shipCan even issue refunds and transfers. Top-tier secret
Cloud admin tokensNever shipCan operate your whole infrastructure

When in doubt, ask: "if this leaks, can someone spend money or alter data?" If yes, that key cannot live on the device. This article targets that bottom-right "never ship" group—especially metered AI API keys.

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 decision table that sorts keys you can ship in the client from keys you must never ship, based on design intent
A minimal Cloudflare Workers proxy that hides an OpenAI / Gemini key (with streaming passthrough) plus the Expo client code that calls it
Lightweight abuse controls so the proxy isn't open to everyone, and a rotation procedure that swaps the key without waiting on app review
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-04-13
LLM Streaming in Rork Apps: Building ChatGPT-Style Real-Time AI Responses with Expo and SSE
Field notes on shipping LLM streaming (SSE) in React Native and Expo. Anthropic, OpenAI and Gemini behind one interface, AbortController cancellation and retries, a Cloudflare Workers proxy, context compaction, and a mock SSE server for testing at zero API cost.
Dev Tools2026-09-07
Adding .easignore stops EAS from reading .gitignore — count what actually ships to the build
EAS Build decides what to upload from .gitignore, and the moment you add .easignore the two swap places. Here is how I count the bundled files before sending, plus a measured result: once a parent directory is excluded, an exclamation mark cannot bring a file back.
Dev Tools2026-09-05
Your Widget Extension Can Submit a BGTaskScheduler Request. It Just Cannot Register the Handler
Calling BGTaskScheduler from a widget extension compiles, submits, and returns true — and then nothing runs. Here is why registration belongs to the host app only, and how I moved refresh ownership back where it belongs across my wallpaper apps.
📚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