# A React Native cloud IDE with one Metro server for iOS and Android

> Run a shared React Native workspace, Metro, iOS and Android from one Bash script. Use your local editor or open the same project in a browser with code-server.

Canonical: https://run.cloud/react-native-cloud-dev-environment/ · Updated 2026-11-30

## TL;DR

Run this in a Linux terminal with Bash, curl, tar, GNU coreutils and `flock`. The installer adds the `cloud-ide` launcher and installs the run.cloud CLI and jq if needed. If you’re signed out, the CLI offers a choice. Email sign-in can finish in the terminal. Google opens a browser and asks you to match the code shown in the terminal. Editor mode also needs OpenSSH and local port 8082.

```
( installer=$(mktemp) && trap 'rm -f -- "$installer"' EXIT && curl -fsSL https://run.cloud/examples/react-native-cloud-ide.sh -o "$installer" && bash "$installer" install )
```

```
export PATH="$HOME/.local/bin:$PATH"  # if the launcher directory is missing from PATH
cloud-ide up both --editor
```

Open the editor URL printed by `up`, then run **run.cloud: Show Simulators** from the Command Palette. Leave `up` running. Use `cloud-ide down` in a second terminal or press Ctrl-C to release the workspace.

For a local editor, use `cloud-ide up` and save the sample’s `cloud-counter/App.js`. To start just one device, pass `ios` or `android`. Starting both downloads about 240 MiB of native clients. [Read the Bash launcher](https://run.cloud/examples/react-native-cloud-ide.sh)

Published 2026-11-30

[![App.js open in code-server with the Kilo Code sidebar, live iOS and Android previews, and Metro output in the terminal.](https://run.cloud/images/guides/react-native-cloud-dev-environment/cloud-ide-workbench.png)](https://run.cloud/images/guides/react-native-cloud-dev-environment/cloud-ide-workbench.png)

Metro’s terminal output, the shared component and both live native previews in one code-server workspace.

## One workspace, two native clients

The run.cloud CLI provisions a Linux sandbox containing the Expo project, its lockfile and one Metro process. Both devices connect to that process. When iOS requests a bundle, Metro resolves the iOS versions of platform-specific files. Android gets its own bundle from the same working tree. A change to a shared component therefore reaches both apps without a second checkout, install or bundler.

The default project is a small SDK 54 app with a pinned npm lockfile. To use your own public SDK 54 project with Expo Go, set `PROJECT_REPO` and optionally `PROJECT_REF`. The script clones that revision into `/tmp/cloud-counter` in the sandbox and runs `npm ci --no-audit --no-fund` there. Pick a commit SHA when two reviewers need to reproduce the same revision.

```
PROJECT_REPO=https://github.com/OWNER/REPO.git PROJECT_REF='your-commit-sha' \
  cloud-ide up both --editor
```

Bash + run.cloud CLI

Provisions the sandbox and device sessions

Local editor

Copies App.js

Browser editor

code-server over SSH

Linux sandbox

React Native project

Metro

HTTPS · port 8081

iOS simulator

iOS bundle

Android emulator

Android bundle

Each device requests its platform’s bundle from the same working tree.

The script exposes the sandbox’s port 8081 over HTTPS, so neither device needs an inbound connection to your laptop. Each native client opens that host using the `exps://` scheme. Expo returns a manifest with the URL of that platform’s bundle. Setting `EXPO_PACKAGER_PROXY_URL` to the public HTTPS URL before starting Expo keeps the bundle reachable from both devices. [Expo CLI server URLs](https://docs.expo.dev/more/expo-cli/#server-url)

### A healthy Metro process can still serve an unreachable bundle URL

A successful HTTPS request to `/status` confirms your laptop can reach Metro through the exposed port. If a device still fails to load, check whether Expo Go can fetch the manifest from that hostname. Then inspect the manifest’s bundle URL. It should use that same hostname. A `localhost` URL sends the client back to itself.

## The native clients

The two devices need different binaries. Android takes an APK. iOS needs an app compiled for the simulator. An App Store IPA is built for a physical device. The script downloads Expo Go 54.0.8 for Android and 54.0.7 for iOS. The iOS download contains the app’s files at the archive root, so the script wraps them in `ExpoGo.app` before archiving and uploading the simulator build. [Expo Go downloads](https://expo.dev/go)

Expo Go is enough when your dependencies use native code already included in it. For a custom native module, compile a development client for each affected platform. Start Expo in development-client mode and open the server URL through the scheme registered in your app. You can keep the shared Metro workspace and exchange just the binaries when native dependencies change. [Expo development builds](https://docs.expo.dev/develop/development-builds/use-development-builds/)

We saved one edit to `App.js` in code-server. Both headings changed from “First draft” to “Second draft.” The iOS app kept its count of 2 and Android kept its count of 3. The clients shared the source change while retaining their own React state.

![iOS simulator showing Second draft and Count 2](https://run.cloud/images/guides/react-native-cloud-dev-environment/shared-ios-after.png)

iOS

![Android emulator showing Second draft and Count 3](https://run.cloud/images/guides/react-native-cloud-dev-environment/shared-android-after.png)

Android

iOS and Android after the same save in code-server.

### When the first bundle loads but edits stop

First check that the saved file reached Metro’s working directory. Then check whether the sandbox is awake and inspect Metro’s startup log for CI mode. In SDK 54 the initial bundle can load with file watching disabled. [Expo SDK 54 watch mode](https://github.com/expo/expo/blob/12d6ea8d413e5bc80e8808cca52f47b146d44a90/packages/%40expo/cli/src/start/server/metro/instantiateMetro.ts#L495-L503)

## Editing the files Metro sees

With the sample project, the default workflow keeps the editor on your laptop and copies saves of `App.js` into the sandbox. A `PROJECT_REPO` checkout lives entirely in the sandbox. Edit it through code-server or open a shell with `runcloud sandbox shell "$sandbox_id"`. A CI job can seed the workspace from its checkout once and skip the editor entirely. In 2026, if a Git push or CLI agent already handles the change, a second IDE adds little.

Use `--editor` when you want to work directly against the remote files. The script starts code-server in the same sandbox as Metro and opens the project directory. On first use, `runcloud sandbox setup-ssh` creates a dedicated run.cloud SSH key and adds a named host entry to `~/.ssh/config` for the local port forward. Search the source in the editor and use its terminal to inspect the installed packages or Metro’s log in the running sandbox. A browser save goes straight into Metro’s watched tree. The run.cloud extension embeds live views of the selected devices in an editor tab. The simulator and emulator still run the native binaries. Treat their viewer URLs as private session access.

A visual extension can make that extra tab worth opening. Kilo Code puts agent changes in a diff panel and permission requests in its sidebar. It’s published on Open VSX, the extension registry code-server uses. [Kilo Code features](https://kilo.ai/docs/code-with-ai/platforms/vscode) · [Kilo Code on Open VSX](https://open-vsx.org/extension/kilocode/Kilo-Code) · [code-server extensions](https://coder.com/docs/code-server/FAQ)

Editor mode preinstalls Kilo Code and the run.cloud simulator extension before the 12-minute device leases start. On first open, code-server may ask whether you trust the workspace.

### A browser editor can change the running project

The editor has a terminal and write access to the project. It binds to sandbox loopback. The script forwards it over authenticated SSH to `127.0.0.1:8082` on your machine. Leave Metro as the only publicly exposed port.

### Memory for the browser editor

With Kilo Code running and both native bundles active, the Linux out-of-memory killer terminated Metro and code-server in our 4 GiB sandbox. The launcher now reserves 8 GiB with `--editor` and 4 GiB for Metro alone.

## Resource lifetime

The script sets a 20-minute sandbox limit and a 12-minute limit on each device. A device can be released independently. Releasing it stops its session meter. Destroying the sandbox removes Metro’s exposed hostname. [run.cloud metering](https://docs.run.cloud/billing/access-control)

On an orderly exit, the script closes the SSH forward, releases its devices and deletes the Expo Go uploads it created. In browser-editor or repository mode it exports the workspace to a local `cloud-edits-*.tgz` before destroying the sandbox. The archive omits `node_modules`, `.git`, `.expo` and `.env*`. If export fails, the script leaves the sandbox available for recovery until its timeout. You can also copy a file out during the session using the printed sandbox ID.

```
sandbox_id=YOUR_SANDBOX_ID
runcloud sandbox cp "$sandbox_id" :/tmp/cloud-counter/App.js ./App.from-sandbox.js
```

[Compare this setup with a managed Newly project](https://run.cloud/compare/run-cloud-vs-newly/)
