Skip to content
salemkodePublic

About

Build each native binary once: a local build server for Expo and React Native that shares fingerprinted simulator/emulator builds across worktrees, AI agents and Macs.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

exs

Build each native binary once. exs is an open-source build server for Expo and React Native apps on macOS. It keys every iOS Simulator and Android emulator build by @expo/fingerprint and shares it across git worktrees, AI agents and Macs. A matching build comes back in about 2 seconds; a new one is built once, in a warm shared workspace, and every waiting worktree gets it.

Website · Benchmark · How it compares · Changelog

npm i -g exs-cli
exs doctor               # checks Node, Xcode, CocoaPods, JDK and the Android SDK
exs install-agent        # the build server, as a LaunchAgent
cd your-expo-app && exs build ios
$ exs build ios                                   # cold: first time this native config is seen
exs: key 659f5c72d373fffb6cdf1bd0 (fingerprint d6b3e3aa6b92, xcode-27.1)
exs: built 659f5c72d373fffb6cdf1bd0 in 196.8s
~/.exs/store/659f5c72d373fffb6cdf1bd0/MyApp.app

$ cd ../myapp-feature-branch && exs build ios     # another worktree, or a JS-only change
exs: reused 659f5c72d373fffb6cdf1bd0 in 0.5s (built 16s ago by build-mac-1)
~/.exs/store/659f5c72d373fffb6cdf1bd0/MyApp.app

Benchmark

A production Expo SDK 58 app (bun monorepo, React Native 0.86), iOS Simulator debug build on an Apple-silicon Mac with Xcode 27.1. "Before" is what agents ran until then: expo prebuild --clean, then expo run:ios. Method and caveats

Situation Before exs
Re-run in a worktree that already built 850 s 2 s
Another worktree on the same commit 384–779 s (cold build) 2 s
JS-only edit (the agent re-runs the script) 850 s 2.2 s
Native change (an Info.plist key) 877 s 84–90 s
First build of a new native config 779 s 719 s
Two agents ask for the same new build at once two builds one build, shared
Android, first build not measured 802 s, then a hit
Disk Before exs
Each worktree that builds iOS +6.2 GB (4.7 GB DerivedData, 1.2 GB Pods) 0
Each worktree that builds Android about +2 GB 0
Shared, once per app none about 9 GB iOS and 5 GB Android workspace, about 0.2 GB per stored build
Build output found across 29 checkouts of that app 73.6 GB reclaimable with exs prune --delete

Other agents were using the machine during measurement (load average 15 to 970), so cold pairs were run back to back. A first build is not faster; exs wins by not doing it again.

How it compares

exs Stim EAS build cache expo-build-disk-cache Rock remote cache plain expo run
Reuses the whole binary ✓ ✓ ✓ ✓ ✓ ✗
Works without an account or cloud ✓ ✓ ✗ ✓ local hits only ✓
Joins an identical build already running ✓ across Macs on one machine ✗ ✗ ✗ ✗
A miss rebuilds in one warm shared workspace ✓ partly¹ ✗ ✗ ✗ within one worktree
No ios/, Pods or DerivedData in worktrees ✓ ✗ ✗ ✗ ✗ ✗
Several machines ✓ ✓ ✓ with a backend ✓ ✗
Agent integration MCP, skill, build-command guard skill, worktrees, devices, desktop app Expo MCP (cloud builds) ✗ ✗ ✗

¹ Shares Xcode and Gradle compiler caches; build areas are per checkout. From each tool's public docs and source in November 2026; sources. If you want one tool for worktrees, devices and builds, look at Stim. If you already build in EAS for CI, its cache and Repack may suit you better. exs does only the local build, once.

What it does

  • Fingerprint key. The key combines the fingerprint, platform, variant (debug or release) and toolchain (Xcode or JDK version). Release builds embed the JS, so their key also hashes the source.
  • One copy per key. Artifacts (.app for the iOS Simulator, .apk for Android) live once in ~/.exs/store/<key>/.
  • Single-flight. If a build for a key is already queued or running, later requests wait for it instead of starting another.
  • No build folders in your worktrees. Builds run in ~/.exs/work/<app>/<platform>/, one workspace per app and platform, shared by all of the app's worktrees. Pods, DerivedData and the Gradle caches stay warm there. expo prebuild always regenerates the native dirs from scratch, so a removed plugin or Info.plist key can never leak into a binary, but Pods/, Podfile.lock and Gradle build dirs are moved aside and put back. Your worktrees keep only source code.
  • Never a wrong binary. The worker re-fingerprints the synced source and refuses to publish if the fingerprint doesn't match the requested key.
  • Bounded disk. The store (20 GB) and the workspaces (40 GB) are each evicted least-recently-used first when they go over budget.
  • More Macs. One coordinator and any number of workers. Jobs go to a worker with a matching toolchain, preferring one that already has a warm workspace for the app, then the least busy one, then the one with the most CPUs.

Install (this Mac)

exs requires macOS and Node.js 22.13+ on the 22.x line, or Node.js 24+. Builds need Xcode and CocoaPods (iOS) or JDK 17 and the Android SDK (Android).

npm i -g exs-cli
exs install-agent        # coordinator + local worker, starts at login and restarts on crash
exs doctor

To install from a source checkout, run npm ci && npm run build && npm link. You can also run ./bin/exs from the checkout. Use exs doctor ios or exs doctor android to check a specific build target.

The LaunchAgent is dev.exs.daemon (dev.exs.worker with --worker). A Mac runs one of the two: the daemon already includes a local worker, so installing either replaces the other (and any older exs LaunchAgent). If the new service fails to start, the previous one is restored. Logs and config default to ~/.exs/logs/daemon.log and ~/.exs/config.json. The config contains the token and is created with mode 600. Set EXS_HOME to choose the data directory. With no override, an existing ~/.expo-server is used if ~/.exs is absent.

Use

cd any-expo-app          # node_modules must be installed: the fingerprint reads native modules
exs build ios            # prints the .app path (stdout); progress goes to stderr
exs build android --release
exs install ios --port 8097 # build or reuse, install and open the dev client on Metro
exs run ios -- --port 8097 # build or reuse, then `expo run:ios --binary <app>`, so Metro starts as usual
exs fingerprint ios      # print the fingerprint and key without building
exs artifacts            # what is stored
exs logs <jobId>
exs prune ../worktrees   # list per-worktree ios/build, Pods, android/build… that exs makes redundant
exs prune --delete ../worktrees # remove them (only exact build-output dirs inside app roots)

In scripts: APP=$(exs build ios -q), or --json for {status, key, artifactPath, appId}.

Monorepos and env

Run exs from the app directory or from the monorepo root (with one Expo app below it). exs syncs the whole git checkout, so workspace packages and root patches/ are there, installs at the directory that holds the lockfile, and builds in the app's directory.

The app config often reads env (APP_VARIANT=dev for a dev client). exs carries APP_VARIANT, every EXPO_PUBLIC_* and the names listed in the app's package.json under "exs": {"env": [...]} from your shell to the build. Use --env KEY=VALUE to add one explicitly. The fingerprint runs with that env, so a dev and a production config get different keys. Release keys also hash the env, because the bundle inlines EXPO_PUBLIC_*.

Agents (Claude Code, Codex)

exs integrates with installed Claude Code and Codex environments.

exs setup --dry-run      # show planned changes without writing files or running commands
exs setup
exs setup --uninstall    # remove the integration changes recorded by setup
  • MCP server exs mcp (registered for Claude Code at user scope and in ~/.codex/config.toml, tools auto-approved). Its tools are build, wait, status and logs. build returns within 50 s with {status: "building", jobId} when a build takes longer, and wait picks it up. This keeps every call under Codex's default tool timeout. The server's instructions carry the rules, so every session sees them.
  • Rules: exs instructions, plus a managed block in ~/.claude/CLAUDE.md and ~/.codex/AGENTS.md.
  • Skill exs in ~/.agents/skills, linked into ~/.claude/skills and ~/.codex/skills.
  • Guard: a PreToolUse hook (exs hook) that denies expo run:*, expo prebuild, bun|npm|yarn|pnpm run ios|android[:x], pod install, xcodebuild and gradlew assemble* inside an Expo app and tells the agent what to run instead. Commands outside Expo apps are untouched, and EXS_DIRECT=1 <command> gets past it (for signed device builds). The shell wrapper skips Node unless the command mentions a native build tool.

Use simlock when multiple agents share devices. An agent with a lease can run

simlock lease --platform ios                                # or use the simlock MCP lease_simulator tool
APP_VARIANT=dev exs install ios                                # build or reuse + install + launch on that lease
APP_VARIANT=dev bunx expo start --dev-client --port <its port> # Metro; JS edits never need a native build

For standalone use, exs install ios --device <UDID|booted> uses a booted iOS simulator. exs install android --device <serial> uses adb. With a single available device you can omit --device.

Adding another Mac

On the main Mac, make the coordinator reachable. Use Tailscale (or another private network): the API is plain HTTP and the token gives full build access, which includes running the project's install scripts on every worker.

exs config listen 0.0.0.0      # or this Mac's Tailscale IP
exs install-agent              # restart with the new config
exs config token-print         # copy the token

On each new Mac:

npm i -g exs-cli
exs worker --coordinator http://<main-mac>:7787 --token <token>   # saves the config; Ctrl-C to stop
exs install-agent --worker                                        # or run it as a LaunchAgent

exs status on any Mac shows every worker with its toolchain, free disk and warm workspaces. Clients on other Macs work too: exs build there uploads only the git-visible source files, and the artifact is downloaded once into that Mac's ~/.exs/cache/<key>/. Workers must have the same Xcode (or JDK) version as the key. A job is never sent to a mismatched toolchain.

How a build runs

  1. Client: find the project root, compute the fingerprint, and send POST /v1/builds. The response is a hit, a job it joins, or a new job.
  2. Source: on the coordinator's own Mac the local worker reads the worktree directly (no copy over the network). The source is uploaded instead, as a tarball of git ls-files --cached --others --exclude-standard, when the client is on another Mac, or when the best idle worker is another Mac (this one is busy, or only that Mac has the app's warm workspace).
  3. Worker: mirror those files into the shared workspace (mtime-preserving, APFS clones). Only files exs synced before are ever deleted, so generated ios/ and android/, Pods and node_modules stay. Then install deps if the lockfile, package.json deps or patches/ changed, and verify the fingerprint.
  4. iOS: clean expo prebuild (CNG projects; Pods kept), pod install (fast, Pods are already there; bare projects skip it when nothing changed), then xcodebuild -sdk iphonesimulator -destination 'generic/platform=iOS Simulator' ARCHS=arm64 into the workspace's DerivedData. Android: clean expo prebuild (Gradle build dirs kept), then ./gradlew assembleDebug|assembleRelease -PreactNativeArchitectures=arm64-v8a --build-cache. If xcodebuild fails, it retries once after a fresh pod install. Builds are cancelled after 90 minutes.
  5. Publish: the artifact moves into the store, and every waiting client gets it.

If a worker stops heartbeating for 60 s, or restarts (each worker process has a session id), its job is re-queued once, then marked failed. Each job attempt is fenced, so a worker that lost its lease cannot publish. A restarted worker kills build processes its previous process left running.

Limits (v0.1)

  • iOS Simulator and Android emulator builds only. Simulator builds are ad-hoc signed ("Sign to Run Locally", the same as expo run:ios), so entitlements such as keychain and app groups work. There are no device or store builds.
  • Artifacts are arm64 only (Apple-silicon simulators and arm64 emulators).
  • The fingerprint is computed in your worktree, so node_modules there has to match the lockfile. If it doesn't, the worker reports source changed since it was fingerprinted instead of building something wrong.

Uninstall

exs setup --uninstall
exs uninstall-agent
npm uninstall -g exs-cli

Restart any running agent sessions. Build artifacts, logs and configuration remain in the active data directory.

Develop

npm ci
npm test          # node:test runs TypeScript directly
npm run typecheck
npm run build

Design: docs/design/build-server.md

Contributing and security

See CONTRIBUTING.md and SECURITY.md. The coordinator token grants build access, which runs each project's install scripts on every worker: keep the API on localhost or a private network.

License

MIT


exs is an independent project and is not affiliated with or endorsed by Expo.

About

Build each native binary once: a local build server for Expo and React Native that shares fingerprinted simulator/emulator builds across worktrees, AI agents and Macs.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages