mobilecode README

The project's README from github.com/hsandhu/mobilecode. As one markdown file: README.md.

mobilecode

The open source AI coding agent for mobile apps.

MobileCode is a fork of opencode that knows about mobile projects. When it detects an iOS or Android project it can run the simulator or emulator preview server and render the live device inside the app, next to your session.

React Native

Run a React Native app on iOS, Android, or both using independent controls. The React Native button starts Metro only. Each platform's Play button starts its virtual device and embedded stream, then builds, installs, and launches the current tab's project. Metro is started automatically when needed and shared by both platforms.

MobileCode building and running a React Native app on iOS and Android

MobileCode building and running an iOS app in the embedded simulator

How the device pane works

Open a session in a mobile project and the device pane opens by itself, alongside your conversation, without starting anything. Its Start and Stop controls perform the same full lifecycle as the toolbar controls. Running a platform starts npx serve-sim or npx serve-avd on the machine running the MobileCode server, pinned to the device used by the build. Reload refreshes only the stream. Projects are detected up to two directories below the session root, so an app in a subfolder is still found. Each platform has a build-log toggle, and the shared Metro status bar has its own log toggle.

Build and run

The session titlebar carries an Xcode-style run control for every detected platform, showing the current build status next to it.

The same operations are available over HTTP:

GET  /api/device-preview?location[directory]=<project>
POST /api/device-preview/start      { "platform": "ios" | "android" }
POST /api/device-preview/stop       { "platform": "ios" | "android" }
POST /api/device-preview/run        { "platform": "ios" | "android" }
POST /api/device-preview/run/stop   { "platform": "ios" | "android" }

Requirements: macOS with Xcode for iOS (serve-sim needs Node 20 or newer), and the Android SDK platform-tools with at least one AVD for Android. Android builds need a JDK your project's Gradle version supports, and the package name is read from the built APK with aapt2 when the SDK build-tools are installed.

Installation

# Install script (downloads a release binary from GitHub)
curl -fsSL https://raw.githubusercontent.com/hsandhu/mobilecode/main/install | bash

# From source
git clone https://github.com/hsandhu/mobilecode.git
cd mobilecode
bun install
bun run --cwd packages/cli src/index.ts

The install script places the binary in ~/.mobilecode/bin and adds it to your shell PATH.

Configuration and data

MobileCode keeps opencode's configuration format and locations, so an existing opencode.json, provider credentials, plugins, and skills work unchanged. Configuration lives in ~/.config/opencode, data in ~/.local/share/opencode, and environment variables keep the OPENCODE_ prefix. See the opencode docs for the full reference.

Development

bun install
bun run --cwd packages/cli src/index.ts serve --port 4096   # backend
bun --cwd packages/app dev -- --port 4444                        # web UI at http://localhost:4444
bun --cwd packages/desktop dev                                   # desktop app

Run bun typecheck inside a package directory before sending changes. Tests run from package directories, for example bun test in packages/core.

Building the macOS app

bun run build:macos

One command: it installs dependencies, builds the bundled CLI, builds the Electron app and writes MobileCode.app plus a .dmg and .zip to packages/desktop/dist. It needs Node 20 or newer and picks a suitable version from nvm when the one on your PATH is older.

The build is unsigned by default, so right-click the app and choose Open the first time. To ship a signed and notarized build, pass --sign with a Developer ID certificate in your keychain and APPLE_API_KEY, APPLE_API_KEY_ID and APPLE_API_ISSUER set. Other options are --arch arm64|x64, --channel dev|beta|prod and --skip-install; --help lists them.

License

MIT. MobileCode is built on opencode, copyright (c) 2025 opencode, and keeps its MIT license.

mobilecode (hsandhu/mobilecode)

Searching Database…

What is this?MobileCode is an open source AI coding agent for building mobile apps, forked from opencode. When it detects an iOS or Android project it can launch the simulator or emulator and show a live preview right next to your chat session.
Is this a CLI tool or does it have a desktop app?It inherits all of opencode's interfaces: a terminal UI, an Electron desktop app, and a web UI, plus support for any model provider, MCP, plugins and skills.
What do I need installed to preview iOS or Android apps?iOS previews need macOS with Xcode (and Node 20+ for serve-sim); Android previews need the Android SDK platform-tools with at least one AVD, plus a JDK matching your project's Gradle version.
Can I preview multiple mobile projects at the same time?No, the simulator, emulator and Metro port are shared, so starting a new project automatically stops any other project's running apps first.
Does it work with an existing opencode setup?Yes, MobileCode keeps opencode's configuration format and file locations, so an existing opencode.json, provider credentials, plugins and skills work unchanged.
How does it run React Native or Expo apps?Pressing Play starts one Metro server, runs expo prebuild if needed, installs pods, builds both native projects, and connects the Android emulator to Metro through adb reverse, launching the app on both iOS and Android at once.
What does the devicerun tool let the agent do?It lets the AI agent build and launch the app itself, wait for the result, and read the build error and log tail directly, so it can fix a failing build without you pasting logs.
Can I get a signed macOS app build?By default the macOS app build is unsigned, but passing --sign with a Developer ID certificate and Apple API key credentials produces a signed and notarized MobileCode.app, .dmg and .zip.
What are similar projects?Baize, skills, skills, thinkrail, zuse, lody-ios, kimi-code, acryl
Creator
hsandhu
Size
376.8 MB
Stars
243
Age
2mo
Commits · 90 Days