tosijs-native
Build iOS, iPadOS, macOS and Android apps from one web app, one package and one config. The aim is the App Store, Google Play, Steam and direct download (PLAN.md); what 0.5.0 builds, and what it does not yet, is under Status below.
- One codebase. Your web app is the app: the same HTML, CSS and JavaScript on iOS, iPadOS, macOS, Android and the web.
- Native look and feel. Liquid Glass on Apple platforms, Material on Android, and the platform's own conventions: the status-bar tap, Back, the lock screen, the Settings app.
- Native features. Purchases, notifications, location, background audio and the rest, through one API that behaves the same in every shell and falls back to the browser on the web.
- Lightweight. No browser engine is bundled: each app uses the platform's own web view. The examples are about 1.3 MB on iOS and macOS, and 0.23 MB as an Android release build.
How it fits together
┌──────────────────────────────────────────────────────────────────┐
│ Your web app: one codebase │
│ HTML, CSS and JavaScript in any framework. Ours: tjs-lang, │
│ tosijs and tosijs-ui web components (native controls in Glass │
│ and Material) │
│ │
│ const native = await createNative(config, nativeBridge()) │
│ native.products · saves · files · location · media · settings │
└────────────────────────────────┬─────────────────────────────────┘
│ one bridge: call(method, args) and events,
│ the same in every shell (a contract suite
│ checks each one against it)
┌────────────────────────────────┴─────────────────────────────────┐
│ The platform's own web view │
│ WKWebView (iOS, iPadOS, macOS) · Android WebView · WebKitGTK │
│ (Linux) · on the web, the browser itself (the web fallback) │
└────────────────────────────────┬─────────────────────────────────┘
┌────────────────────────────────┴─────────────────────────────────┐
│ A thin native shell, built from your config │
│ Swift (Apple) · Kotlin (Android) · Tauri / Rust (Linux) │
│ Closed by default: only what the config declares exists │
└────────────────────────────────┬─────────────────────────────────┘
│
purchases · cloud saves · files · sharing · notifications · location (and a route
in the background) · background audio and the lock screen · background tasks ·
downloads · settings in the system's own place · reviews · permissions
Any framework works: the API and the bridge are plain JavaScript, and the page is an ordinary web app. The examples here use the toolchain we prefer, tjs-lang, tosijs and tosijs-ui's web components, with native controls (page and top bar, navigation stack, tab bar, list rows) in each platform's look.
The catalog example (examples/catalog), the same page in Liquid Glass on an iPhone and Material on Android.
Status (0.5.0): tosijs-native build makes iOS and iPadOS apps (the Simulator, or a phone
with your development profile), Mac apps (ad hoc signed, so they run on your own Mac), and
Android apps (debug-signed, or with your keystore). It does not yet make anything a store
takes, nor Steam, Windows or Linux builds of your app, nor Mac builds signed for other people.
The contract passes in the Swift shell on the Mac and in the iOS Simulator (iPhone and iPad),
and in the Kotlin shell on the Android emulator and a Samsung Galaxy A17; this repository's
Tauri shell passes it on the Mac and on Linux. Apps built with it run on two iPhones, the A17
and the Mac, including a real one, a podcast player. Beyond purchases, achievements and saves,
it covers cloud saves, files, sharing, links, keeping the screen awake, notifications,
permissions, reviews, a background task, background audio, location (including a route recorded
in the background), the app's settings as a schema, reading text past CORS, and downloads:
CAPABILITIES.md says how each is designed and where each stands. What is not
fixed yet is listed in CHANGELOG.md. The JS side is written in TJS;
TJS-FINDINGS.md records how that is going.
Starting an app
bun add tosijs-native
Put a tosijs-native.config.ts beside your web build (defineConfig: the app's id, name, icon
and the capabilities it uses), create the API in the page with
createNative(config, nativeBridge({ capabilities: config.capabilities })), and build:
bunx tosijs-native doctor # what this machine still needs
bunx tosijs-native build --target ios # or mac, android
bunx tosijs-native run --target android # build, install and open
BUILDING.md covers the command, signing and devices; examples/ holds small apps
built this way. The command needs Bun, and Xcode or the Android SDK for those
targets. While working on tosijs-native itself, link it into an app (bun link here, then
bun link tosijs-native there) rather than installing it from a folder: a file: dependency is
a copy, and the command refuses to build from a stale one.
Licence
Code is Apache-2.0. Documentation, images, icons, models and other content, including the code samples in the docs, are CC0 1.0: public domain, no attribution needed. Third-party material keeps its own licence (see the acknowledgements). What you make with it is yours.