Setup
Peach needs no per-app install. You keep starting your app with the command you already use, and Peach connects to that dev server. A plugin and a config file are both optional; add them when you want what they give you.
If you have not installed Peach yet, follow Installation first.
Expo and bare React Native (Metro)
Start Metro the way you normally do, from your app’s project root:
Then, from the same directory, open the app in Peach:
Use your server’s real port. Without a port, peach open scans for running
React Native dev servers and lets you pick one, and a bare peach opens the
same picker in the simulator.
Run peach open from the project root when you can. Peach reads your app’s
configuration from that directory, including your Expo app config, custom
fonts, splash screen and icon. It can still load the bundle from elsewhere, but
those details may be missing.
The optional Metro plugin
Peach works with a plain Metro server. Wrapping your Metro config with
withPeach() from peachsim/metro adds two things: it embeds Metro’s exact
module map in each bundle, so Peach never has to infer which module is which,
and it serves the simulator from your Metro server at /__peachsim/.
See Metro plugin for what it changes in your bundles and for its bundle URL helpers.
One apps
Start your One app with its usual dev command, then open its port:
To make the simulator available on your One dev server itself, add
peachPlugin() from peachsim/vite. It serves Peach at /__peachsim/ and
leaves your app code and workflow unchanged:
See One plugin for its options, including opening the app in its own desktop window.
Check your project first
Before you open an app for the first time, run:
It reports the React and React Native your app declares, how much of each native library Peach implements, and any native code Peach does not know, with the config that answers it. Diagnosing your project walks through its output.
peach.config.ts
Most apps need no config. Add a peach.config.ts next to your package.json
when you need to answer native code Peach does not know, set environment
variables, or pin simulator settings for the app. Peach also accepts
peach.config.js, peach.config.mjs and peach.config.cjs.
The peach CLI supplies the peachsim/config import when it loads the file,
so it works without installing anything. Add peachsim as a dev dependency if
you want editor types; peach setup offers to do that for you, along with a
peach script in your package.json. Peach reads the file each time it
loads your app, so your next reload picks up an edit.
The fields you are most likely to use:
| field | what it does |
|---|---|
packages | Answers native modules and views Peach does not know, keyed by the package that asks for them. See Custom stubs. |
modules | Replaces a JavaScript module in your bundle with 'noop', an inline value, a project file, or another stub. Use it for packages you do not need in the simulator. |
env | Sets process.env.* inside your app at runtime. Values your bundler inlined at build time, such as EXPO_PUBLIC_*, need a rebuild of the bundle instead. |
settings | Overrides simulator settings such as device, appearance and locale for this app. |
initialState | Seeds starting state such as locale, color scheme and feature flags. |
network.remap | Rewrites a host:port your app fetches to another one, for suites that hardcode a port already in use on your machine. |
runtimeVersion | Pins the Peach runtime this project runs on. Omit it to use the current stable runtime. |
nativeRenderer | 'fabric' (the default) or 'paper', for apps whose native build turns the New Architecture off. |
The Configuration guide shows each slot with worked examples, and the PeachConfig reference lists every type.
Next
- +Run your Expo app takes an existing Expo app all the way to a tested, shared preview.
- +Wrap an existing app covers apps whose libraries need stubs before they run.