tosijs-native

The tosijs-native icon: an owl on a chip

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.

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 on an iPhone, in Liquid Glass: a large title, a list of rows with coloured icons on a translucent card, and a floating glass tab bar    The same screen on Android, in Material: a plain title, rows with monochrome icons, and Material's navigation bar
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.