BakeNative is under active development. APIs may change.
Skip to Content
BakeNative

Installation

Install the bake CLI from npm, or build the BakeNative toolchain from source and connect it to your app.

The scoped packages are staged through the release workflow. Until a matching release is available, use a source checkout.

With that release on Windows (x64), npm brings everything an app needs for web and Windows development: the bake CLI, Hermes' compiler, the snapshot baker and a Windows host to run the app in. You do not need Rust, Visual Studio or a clone of BakeNative. On a Mac with Apple silicon, npm brings the same tools and the prebuilt runtime iOS and macOS apps link, so those build with Xcode alone. Android apps still need the source build below.

Install from npm

Use Node 22.22.2 or later and pnpm 10 (npm install -g pnpm@10).

Install the CLI

npm install -g @bake-native/react

This installs bake and, as an optional dependency, @bake-native/toolchain-win32-x64 with the prebuilt tools. Check it with bake --help. Install one renderer package globally: its bake creates apps for either renderer, and @bake-native/octane installs the same bake command, so npm refuses to install both into one global prefix (EEXIST).

Create an app

bake create my-app
cd my-app
pnpm install

bake create writes a React app by default. Pass --renderer octane for the Octane tabs app (see Create an app). --targets web,ios picks the platforms. The app's bake.config.ts lists them, and only their host folders are written. The scaffold depends on the selected renderer package. Its iOS and macOS projects link the prebuilt runtime that came with it (below). Its Android and standalone Windows projects need a BakeNative checkout (Build from source). Pass it with bake create my-app --bakenative <checkout>, or clone BakeNative to ../bakenative next to the app.

Build and run it

pnpm build:web                              # dist/web
pnpm exec bake dev --target web,windows      # http://localhost:5180 and a Windows window

bake dev builds the app, serves the web build, opens the app in the BakeNative Windows host, and rebuilds and reloads both every time you save a file under src/. Stop it with Ctrl+C. To ship an executable, see desktop standalone packages. To ship a bundle for an existing host, see Embed in a Windows app.

iOS and macOS

On a Mac with Apple silicon and Xcode, npm install -g @bake-native/react also brings @bake-native/toolchain-darwin-arm64. Besides the tools, it carries the prebuilt Apple runtime: BakeNative.xcframework with BakeNativeKit (iOS and the iOS simulator) and BakeNativeAppKit (macOS). You do not need Rust, a Hermes build or a clone of BakeNative. The iOS project is an XcodeGen spec (brew install xcodegen).

bake create my-app --targets web,ios,mac
cd my-app
pnpm install
pnpm build:ios                                   # dist/ios, ios/App/Bundle, .bake/native
(cd ios && xcodegen generate && open MyApp.xcodeproj)
pnpm build:mac                                   # from the app folder
open dist/standalone/MyApp.app

For a generic iOS Simulator build with xcodebuild, pass ARCHS=arm64. The prebuilt simulator runtime contains an arm64 slice.

pnpm build:ios and pnpm build:mac build the bundle and then run bake native link. It unpacks the runtime to .bake/native/bakenative, a local Swift package named BakeNative, and writes the BakeNativeAppModules package of the modules the bundle uses next to it (.bake/native/ios, .bake/native/mac). ios/project.yml and macos/Package.swift depend on both by path. Nothing is downloaded when Xcode resolves packages: there is no remote binary target and no Swift package registry. Run the build script once before you open the project.

bake native link refuses a runtime that was not built for the installed @bake-native/core (another version, host protocol, Hermes bytecode or schema) and says what differs. Reinstall @bake-native/core so both come from one release.

What the prebuilt runtime does not cover yet

It has the iOS and macOS hosts only. A bundle that renders a native view (<video> included), or calls a first-party module the app has no copy of in native/ (add it with bake add), is refused by bake native link with that reason: build it against a checkout (bake native link --bakenative <checkout>, below). The runtime is a release build, also in the app's Debug configuration, so it serves no bake inspect: build against a checkout to inspect the app. Android uses the source build below.

Intel Mac and Linux x64

On Intel Macs with macOS 13 or later and on Linux x64 with glibc 2.35 or later, npm installs the CLI, Hermes compiler, and native CSS checker. Strong Mode is on by default for web builds.

npm install -g @bake-native/react
bake create my-app --targets web
cd my-app
pnpm install
pnpm build:web

For an Octane app, to compile an unbaked Android bundle, declare the Android target and set compiler.strong to false in bake.config.ts. Run pnpm exec bake build --target android. A native build with Strong Mode needs a matching bake-frame from BAKE_FRAME or a toolchain package with the baker. See toolchain packages.

Build and run the iOS and macOS native hosts on Apple silicon.

Build from source

BakeNative is not on a Swift package registry, and the npm packages carry no Android libraries. For Android, to render native views such as <video> on iOS and macOS, or to change BakeNative itself, you clone BakeNative once, build Hermes, and then point your projects at that checkout: the bake CLI for the JS side and a local Swift package for the native side.

These steps use a Mac with Apple silicon. On Windows, see Embed in a Windows app.

Requirements

macOS with XcodeBuilds Hermes and the native libraries
cmakebrew install cmake (used to build Hermes)
Node 22.22.2+ and pnpm 10Runs the bake CLI
Deployment targetsmacOS 14+, iOS 16+

Build the toolchain

Clone and install

git clone https://github.com/gronxb/bake-native.git bakenative
cd bakenative
pnpm install

Build Hermes

pnpm hermes

This builds the Hermes VM for macOS and iOS (hermesvm.xcframework) and the hermesc compiler into native/hermes/artifacts. It takes a while the first time. You only run it again when BakeNative updates its Hermes version.

Check it works

pnpm app

This builds the bundled example app (examples/app) for web, iOS and macOS. If it finishes with a ✓ line per target, the toolchain is ready.

Add the CLI to your project

From a release, add the renderer package and its framework. The app supplies Vite for bake build and bake package. In a React project targeting both web and native, use matching React and React DOM versions:

pnpm add @bake-native/react react@^19.3.0 react-dom@^19.3.0
pnpm add -D vite

For an existing Octane app, install @bake-native/octane with its matching octane peer. Its Vite integration compiles .tsrx files. Both adapters expose the bake CLI.

pnpm exec bake build --target web,ios,mac --bake

In a checkout, bake finds hermesc in the built toolchain. A published install uses the matching toolchain package. To select another compiler from the same release, set BAKE_HERMESC or pass --hermesc.

Add the native library to your app

The native side is the Swift package at the root of the checkout. In Xcode, choose File → Add Package Dependencies… → Add Local…, select the bakenative folder, and add the product for your platform:

PlatformProductImport
iOSBakeNativeKitimport BakeNativeKit
macOSBakeNativeAppKitimport BakeNativeAppKit

In a Package.swift:

dependencies: [
  .package(path: "../bakenative"),
],
targets: [
  .target(name: "MyApp", dependencies: [
    .product(name: "BakeNativeKit", package: "BakeNative"),     // iOS
    // .product(name: "BakeNativeAppKit", package: "BakeNative"), // macOS
  ]),
]

You do not need to turn on Swift/C++ interop. The public modules only depend on a small C interface to Hermes, so they build like any other Swift package.

Next

Follow the Quick start to build a first screen and put it in an app.

On this page