Where a feature lives
The three tiers of native features - built into the framework, added to the app from a source registry, or written by the app itself - and how to pick one.
Every native feature an Octane app uses belongs to exactly one tier. The tier decides who owns the code, how it reaches the app, and how the app registers it. Decide the tier before you write any code.
| Tier | Examples | Who owns the code | How the app gets it |
|---|---|---|---|
| Built-in | fetch, <img>, <video> | The framework | Always there, like on the web |
| First-party and third-party | Clipboard, Linking, Share | The app, after it adds them | Copied into the app from a source registry |
| App modules | OrderScreen, Analytics | The app | Written in the app, registered by generated code |
Built-in
Built-in features are part of the framework, the same way they are part of a browser:
fetch, <img> and <video>. They are not native modules. They are not entries in the
module registry, and an app cannot replace them.
- One implementation. Their logic sits next to the core, in Rust or JSI / C++, and is
shared by every platform. For
fetchthis covers the JS API, mocks, abort and the cache. - A thin platform layer. The platform code does only what the OS should own. Network requests go through the OS stack (URLSession, WinHTTP, HttpURLConnection), so the system proxy, VPN, certificate trust and the app's network security config apply. Video plays on the platform player with hardware decoding.
- One API per feature.
<video>is the only video API. There is no separate video native view; extras such as picture in picture are add-ons on top of<video>.
What each target supports is listed in the support list. Anything not listed there is a build error on native targets.
First-party and third-party
These are native modules and native views the app adds to itself, in the style of shadcn/ui: the code is copied into the app, not installed as a package.
- First-party ones come from the official source registry (clipboard, linking, share, ...). Third-party ones come from any other source registry. Both are added the same way.
- The app owns the copied files: the spec and the implementation. You can read them, change them and review them like your own code.
- The glue is never copied. Registration, type conversion, thread hops and events are generated from the spec on every build, so they always match the framework version the app builds with.
- Updates are explicit. Changes from the source registry are shown and merged by the app; they never overwrite the app's files silently.
What works today
bake add copies a module's spec and implementations from a registry into the app
(native/<name>/, recorded in bake-modules.json); bake diff and bake upgrade show and merge
the registry's changes (bake add). bake create starts an app with
clipboard, haptics, linking and share already added. The app then calls the module through
native:
bake add shareimport { native } from '@bake-native/octane';
await native.Share.share({ text: 'Hello' });The build generates the glue from the spec and registers exactly the modules the bundle calls:
bake build writes their contracts and BakeNativeBundleModules to <app>/.bake/native/<target>/,
and the app registers the generated entries once in its app-layer
module registry.
A module the app never calls is neither in the bundle nor in the binary. The modules, their targets and their host contract are on System modules.
App modules
App modules are the app's own native code: a module that talks to the screen around an embedded
Octane view (OrderScreen), or one that wraps an app service (Analytics). In a brownfield app
these modules are how an Octane screen talks back to its native host.
- Generated registration.
bake buildwrites the registration of every module the bundle calls. Nobody writes a registration table by hand. - Dependencies as constructor arguments. A module that needs a view controller, an Activity or an app service takes it in its constructor. The generated factory takes such modules as required parameters, so a host that leaves one out does not compile. The framework has no special API for view controllers or Activities.
- Ready before the first line of JS. A root's module registry is final before that root's bundle runs.
How to write one: Native modules. How they are registered: Module registry.
Picking a tier
- Is it a web platform API or element that every app expects (
fetch,<img>,<video>)? It is built-in. Ask for it in the framework; do not write a module. - Is it a general device feature that many apps need (clipboard, share sheet, opening links)? It is first-party (or third-party, from another source registry).
- Is it specific to this app or to the native screen around it? It is an app module.
For a feature that needs new native code on several platforms, agree on one spec first and build every platform from it: Native features: spec first.
Embedding cost
What one BakeNative screen adds to an existing iOS or macOS app: time to the first frame, time to interactive, binary size and memory, next to the same screen written in UIKit, AppKit and SwiftUI.
Module registry
How native modules reach a root - generated registration, dependencies passed as constructor arguments, three layers, and the boot check that refuses to start a root with a missing module.