BakeNative is under active development. APIs may change.
First-screen snapshots on every native target

React and Octane apps with abaked first frame.

Build for the web, iOS, macOS, Android and Windows. The native host draws the first screen while Hermes starts, then adopts the matching views when your app is ready to handle input.

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

Octane shop demo, SwiftUI and Expo · iOS Simulator, median of 7 runs · How it was measured

Launch, replayed

The first screen is already there

Two real launches of the same app, slowed down 20×. Without a snapshot the screen stays blank until Hermes has built the whole tree. With one, the frame is up in under 3 ms and Hermes adopts the views that are already on screen.

0.0ms after launch

Without a snapshot

Blank until Hermes has run the app and created every view.

  • 251 ms interactive

Not launched yet

With the first-screen snapshot

The snapshot (.baked) is drawn before any JS. Hermes then adopts those views.

  • 2.9 ms on screen
  • 57 ms interactive

Not launched yet

Timings from the example app's LaunchMetrics log in the iOS brownfield host (iOS Simulator). The snapshot launch is a frame-cache hit: read 0.09 ms, draw 2.8 ms, adopt 4.8 ms.

Every platform

One codebase. Every platform.

One app, native on iOS, Android, macOS and Windows, and the DOM on the web.

Live demo

Click it. It's the real app.

The frame below is examples/app built with bake build --target web: a small gallery of demos. Its Starter tab is the official Octane starter, the screen in the native captures above.

Loading the example app…

Counter.tsrx (simplified)
import { useState } from 'octane';

export function Counter() @{
  const [count, setCount] = useState(0);

  <button onClick={() => setCount(count + 1)}>
    {'Count: ' + count}
  </button>
}
Same file, every target:
  • web → DOM
  • ios → UIKit
  • mac → AppKit
  • android → Android views
  • windows → Win32

Pipeline

One source, one build

Web ships as DOM. Native ships as Hermes bytecode plus a first-screen snapshot. At launch the snapshot shows first and Hermes hydrates it.

Features

Same screen everywhere, no JS on the first screen

Same look on every platform

One Rust core computes the CSS cascade, block, flex and grid layout, line breaking and paint, with Chrome as the reference. Each platform only hosts the views.

A first screen without JS

A first-screen snapshot (.baked) baked at build time is drawn in one forward pass, O(1) per row. Hermes comes after.

Brownfield-first iOS

Drop BakeNativeView into an existing UIKit or SwiftUI app. The public modules expose C headers only, so C++ interop stays off.

One CLI for every target

bake build builds web, ios, android, mac and windows with Vite and the selected React or Octane adapter. Branch per target with import.meta.env.BAKE_TARGET.

Usage

Build it, drop in one view

Terminal
$ pnpm install && pnpm hermes
$ pnpm app
# = bake build --target web,ios,mac --bake

# or run it directly
$ bake build --target web,ios,mac --bake \
    --viewport 640x480
ContentView.swift
import BakeNativeAppKit
import SwiftUI

struct ContentView: View {
  var body: some View {
    // dist/mac: app.hbc + app.baked + app.css
    BakeNativeView(bundle: BakeNativeBundle(directory: url))
  }
}

Measured on macOS

Numbers from the official Octane starter

Native layout within 2 px of the web layout
22/22 nodes
To draw the 22 first-screen views without JS
~1.1 ms
Created during adoption (35 rows matched)
0 views
First screen to interactive (dev tool, debug build)
~150 ms

Measured on macOS with the official Octane starter app (examples/app). Time to interactive is from a debug build in the dev tool.