Getting Started
This guide takes you from zero to a running zero-native app on Android and iOS.
Pre-1.0: zero-native is at
0.1.x. Core screens, navigation, OTA (bsdiff patches included),zn dev, UI-thread gestures and motion,<Canvas>,WebSocket, and most plugins work on both Android and iOS; Platform Differences & Parity lists what still differs.
1. Prerequisites
Section titled “1. Prerequisites”| Tool | Required for | Notes |
|---|---|---|
| Bun 1.3+ | Everyone | Runs the compiler, CLI (zn), tests, and update server |
| Android Studio (JDK 21 + Android SDK) | Android | A phone with USB debugging, or an emulator (minSdk 24) |
| macOS + Xcode 26 | iOS | Targets iOS 17+ |
2. Create your app
Section titled “2. Create your app”bunx @zeronative/cli new my-appcd my-appbun installThe app is built on one zero-native version, written in three places:
package.json:@zeronative/core,@zeronative/uiand@zeronative/cli(thezncommand) from npm;ios/<AppClass>.xcodeproj: the Swift packagehttps://github.com/zero-native/zero-native.gitat that exact version;android/app/build.gradle.kts:io.github.zero-native:runtimefrom Maven Central.
Keep them all at the same exact version (no ^): zn build stops with a message when one differs.
The Android runtime and plugins come from Maven Central with a debug and a release build: your app’s debug build
gets the debug one (where zn dev runs) and its release build the release one. If you add a build type of your own
(a staging, say), tell Gradle which one it takes in app/build.gradle.kts, or it finds no match:
buildTypes { create("staging") { matchingFallbacks += listOf("debug") // or "release" }}Project structure
Section titled “Project structure”my-app/├── app/│ ├── src/│ │ ├── main.ts # Entry point: installRuntime() + startApp(routes)│ │ ├── routes.ts # Typed screen registry ("/" is the start screen)│ │ ├── HomeScreen.tsx # Example screen│ │ └── AboutScreen.tsx # Second screen (with deepLink: true)│ └── assets/ # App images & fonts (create as needed)├── android/ # Android host (the runtime from Maven Central)├── ios/ # iOS host: an Xcode project on zero-native's Swift package├── tools/ios.ts # Helper to build & launch on the iOS Simulator└── package.json3. Run it
Section titled “3. Run it”Connect an Android phone (USB debugging on) or start an Android emulator, then run:
bun run androidThis compiles your TSX into main.zn.ui + main.hbc, copies the bundle into android/app/src/main/assets/, and installs the debug APK. You can also open android/ directly in Android Studio after running bun run app:js.
Release builds for performance testing: Always measure cold start and scrolling on a release build (
./gradlew :app:installRelease), never debug.
On macOS, boot a simulator and run:
open -a Simulatorbun run iosThis builds the JS, builds the app, installs it on the booted simulator and starts it with its console attached. The first build takes about a minute: Xcode downloads zero-native’s Swift package from GitHub, and Hermes from zero-native’s GitHub Release.
Useful flags for bun run ios:
--link my-app://app/about?from=link— cold-start directly into a deep link--device "iPhone 16"— choose a simulator (booted first when it isn’t running)--build-only— compile without launching
You can also open ios/<AppClass>.xcodeproj in Xcode after bun run app:js:ios and press Run; that is also how you run it on a physical iPhone (pick your team under Signing).
Live reload (zn dev)
Section titled “Live reload (zn dev)”bun run dev builds the JS on every save and sends it to the app’s debug build, without a native rebuild. The iOS simulator finds it by itself; a real iPhone on the same Wi-Fi uses bun run dev --lan (about 550 ms on an iPhone 11). (On an app made by zn new, zn dev is checked on the iOS simulator; not on Android yet.)
4. Your first screen
Section titled “4. Your first screen”Here’s what a real zero-native screen looks like:
import { signal, computed, nav } from "@zeronative/core"import { Column, Text, Pressable, StyleSheet } from "@zeronative/ui"
export function HomeScreen() { const count = signal(0) const label = computed(() => count() === 0 ? "Tap to start" : `Tapped ${count()} times` )
return ( <Column style={s.page}> <Text style={s.title}>{label()}</Text> <Pressable style={s.button} onPress={() => count.set(count() + 1)}> <Text style={s.buttonText}>Increment</Text> </Pressable> <Pressable onPress={() => nav.push("about", { from: "home" })}> <Text style={s.link}>Go to About →</Text> </Pressable> </Column> )}
const s = StyleSheet.create({ page: { flex: 1, justifyContent: "center", alignItems: "center", gap: 16, padding: 24 }, title: { fontSize: 22, fontWeight: 700, color: "#111827" }, button: { backgroundColor: "#111827", paddingHorizontal: 20, paddingVertical: 12, borderRadius: 10 }, buttonText: { color: "#FFFFFF", fontWeight: 600 }, link: { color: "#2563EB", fontSize: 15 },})Notice there’s no useState, no dependency arrays, and no re-rendering. HomeScreen runs once; when count.set(...) is called, only the <Text> slot updates on the native UI thread.
5. CLI cheat sheet (zn)
Section titled “5. CLI cheat sheet (zn)”| Command | What it does |
|---|---|
zn new <dir> [--name N] [--id ID] [--ios cmake|packages] [--from npm|checkout] |
Scaffold a new Android + iOS app (on this checkout, or on the published packages) |
zn dev [appDir] |
Watch & live-reload JS/templates to Android debug builds |
zn build <appDir> --assets <dir> --name <app> |
Compile TSX + bytecode into a bundle |
zn release / zn publish / zn rollout |
Release & manage OTA updates via zn-updates |
zn store-build --os android|ios --channel production --version-code <n> --version-name <x.y.z> |
Build the JS for a Play / App Store build, before the AAB / IPA (Releasing your app) |
zn server [--demo] |
Run a local zn-updates server |
zn where |
Print the zero-native checkout path |
zn <command> --help |
Every flag of one command (also zn help <command>) |
6. Building on a zero-native checkout
Section titled “6. Building on a zero-native checkout”To work on zero-native itself, or to try an app against unreleased changes, make the app from a clone. You also need
CMake (brew install cmake) for the CMake iOS host.
git clone https://github.com/zero-native/zero-native.gitcd zero-nativebun installbun run sample:js # optional: build the sample appbun run test # optional: run the test suiteFrom inside the zero-native folder, scaffold a new app outside the repo (--name must be lowercase letters, digits, or hyphens, starting with a letter):
bun run tools/zn.ts new ../my-app --name my-app --id com.example.myappcd ../my-appbun install(Tip: you can run bun link && bun link zero-native -g once in the zero-native root so zn is available globally from any folder.)
The app references your local zero-native checkout by relative path in package.json, android/gradle.properties, ios/CMakeLists.txt, and tools/ios.ts; update those four if you move either folder. A checkout of a release tag can also make an app on the published packages with zn new --from npm (on main the version is 0.0.0, which it refuses).
Running a checkout app on a physical iPhone
Section titled “Running a checkout app on a physical iPhone”First download release Hermes once inside zero-native:
bun run tools/fetch-hermes-apple.ts releaseThen from your zn new app folder (replace <AppClass> with the Swift target name in ios/CMakeLists.txt, e.g., MyApp):
bun run app:js:ioscmake -G Xcode -S ios -B ios/build/device \ -DCMAKE_SYSTEM_NAME=iOS \ -DCMAKE_OSX_SYSROOT=iphoneos \ -DAPP_TEAM=<YOUR_APPLE_TEAM_ID> \ -DZN_HERMES_FLAVOR=release
xcodebuild -project ios/build/device/<AppClass>.xcodeproj \ -target <AppClass> -sdk iphoneos -configuration Release \ -allowProvisioningUpdates build
xcrun devicectl device install app --device <DEVICE_ID> \ ios/build/device/Release-iphoneos/<AppClass>.app(For building the zero-native sample app itself on a physical iPhone, pass -DZN_TEAM=<TEAM_ID> and -DZN_HERMES_DIR=$PWD/ios/third_party/hermes/release/destroot against ios/CMakeLists.txt.)
Next steps
Section titled “Next steps”- Read Core Concepts to master signals, JSX rules, and the gotchas that trip up React developers.
- Check Styling & Layout and Components to build real screens.
- Coming from another framework? Jump to Coming from React Native or Coming from Flutter.