Native Shell (NSH for short) is a native UI framework for every platform. You build an app once, with one app model — components, signals, styles and the same API everywhere — and NSH runs it on iOS, Android, macOS, Windows, Linux and the web, each time as an app of that platform: made of its own views, edited with its own text system, used the way its users expect. Write the whole app in Rust, write screens in TSX, or combine both on one engine. On top of the same engine, apps you have shipped can take new UI at run time — written by your team or generated by a model — as signed modules, in a sandbox the host configures.
[!IMPORTANT] NSH unifies the app, not the pixels. The same app has the same features on every platform; how it is drawn, how its text is edited and how its menus open belong to each platform.
Native in NSH has two layers: the platform‘s foundations, and the platform’s interaction.
The platform's foundations. Each platform has a backend of its own, built on the UI that platform already has:
| Platform | Views | Text | Text input |
|---|---|---|---|
| iOS | UIKit | CoreText | The system's text fields and text views |
| Android | Android views | StaticLayout | EditText |
| macOS | AppKit, Core Animation | CoreText | NSTextField, NSTextView |
| Windows | Win32 windows drawn with Direct2D | DirectWrite | NSH‘s editor, with the system’s input methods (IMM32) |
| Linux | GTK 4 | Pango | GTK's Text and TextView |
| Web | HTML elements styled with CSS | The browser's fonts | The browser's inputs |
Text selection and its menu, input methods, accessibility and scrolling come from the platform, and what a new OS release brings to them reaches the app with it. Native components — a map, a web view, a video player, any view the host registers — are one more view in the same hierarchy, laid out, clipped and scrolled with the rest (Native components).
The platform's interaction. The components NSH provides in nsh/base behave as each device's users expect, so the app writes them once:
| Desktops (and desktop browsers) | Phones and tablets | |
|---|---|---|
Menu | A popup at its trigger; submenus cascade beside their item | A sheet from the bottom; a submenu replaces its menu's items |
ContextMenu | A right click opens it at the pointer | A finger held on the trigger opens it as a sheet |
Tooltip | Shown when the pointer rests on the trigger | Shown when the app opens it |
Popover | A press outside closes it and reaches what is under the pointer | A press outside closes it |
Pages, dialogs, the keyboard and the status bar follow the same idea: navigation stacks push and pop with each platform's motion, and the back button, Escape and swipe-back do what they do there (Navigation).
Cross-platform in NSH means each device gets the app it expects, not the same screen scaled up or down:
md:, lg:) and the window’s size (window() in Rust) change the structure, not only the size: a chat app shows its sidebar, conversations and messages side by side in a wide window, and one screen at a time on a phone (Layout, Tailwind).desktop={{…}} props and platform.select say so (Platform-specific code).nsh test runs the app‘s tests headless, and the same tests in macOS, Windows, Linux and GPUI windows, an iOS simulator, an Android device or a browser, with the platform’s own input (Testing and tracing).Take an app like a chat client. Its developer builds it on the desktop with nsh run, opens it in an iOS simulator with nsh run --target ios to check the phone layout, then in a browser with nsh run --target web — the same project each time — and nsh package makes the installable apps and the website. One engineer can carry what used to take a team per platform, while the backend is built alongside.
NSH is built in Rust, and Rust is a first-class language for writing apps with it:
nsh executable creates, builds, type-checks, runs with hot reload, tests, packages and signs apps for every target. It brings its own TSX bundler and TypeScript checker, so a developer coming from Rust, Swift, Kotlin or C++ installs Rust and nsh, and works (Installation, CLI).The same counter, in Rust and in TSX:
use nsh_core::ui::prelude::*; #[component] pub fn Counter() -> impl IntoElement { let count = signal(0); view() .flex_1() .items_center() .justify_center() .gap_3() .child(text(move || count.get().to_string()).text_5xl().font_weight(FontWeight::BOLD)) .child( view() .rounded_lg() .bg(rgb(0x2563eb)) .px_5() .py_3() .active(|s| s.opacity(0.6)) .on_press(move || count.update(|n| *n += 1)) .child(text("Tap").text_lg().text_color(white())), ) }
import { mount, signal, Text, View } from "nsh"; function Counter() { const count = signal(0); return ( <View style={{ flex: 1, alignItems: "center", justifyContent: "center", gap: 12 }}> <Text style={{ fontSize: 48, fontWeight: "700" }}>{count()}</Text> <View onPress={() => count.update((n) => n + 1)} activeStyle={{ opacity: 0.6 }} class="rounded-lg bg-blue-600 px-5 py-3" > <Text class="text-white text-lg">Tap</Text> </View> </View> ); } mount(Counter);
A view (view(), <View>) becomes a UIView on iOS, a ViewGroup on Android, an NSView on macOS, a GTK widget on Linux, a retained view drawn with Direct2D on Windows and an HTML element on the web; a text becomes a native text view, and the button‘s press feedback (.active(..), activeStyle) runs on the main thread. When you tap, count.update changes one signal, and only the text that reads it is updated: the component function does not run again. The Rust app is native code from start to end; in the TSX app, only the module’s own code is JavaScript.
NSH is retained: every element is a view the platform keeps, and an update changes only what changed.
That suits the screens most apps are made of — chats, mail, forms, lists, documents, settings, an AI reply streaming in — where a few views change at a time and the rest wait. Such screens sit near idle between updates, and scrolling and animation hold 120 FPS on ProMotion displays. In the NSH performance benchmark, a 500-row quote table updated 1,000 times a second uses 18% of a core on Linux in NSH Rust, against 20% for the same screen written directly on GPUI Fast. Heavy computation belongs in Rust: TSX runs in QuickJS, an interpreter, while a Rust module runs at native speed even when TSX calls it — sorting 100,000 rows takes about 3 ms that way, as in plain Rust (Performance).
The toolchain is a single nsh binary. An app is written in Rust, in TSX, or both, and each takes its own path to the same Rust engine.
A Rust app is a crate, built entirely with Rust and Native, with no JavaScript runtime:
nsh builds the runner of each target — the iOS, Android, macOS, Windows, Linux or web app — with your crate linked in. Components, state, handlers and the engine are compiled together into native code.A TSX app (a module) is a set of .tsx / .ts files with an entry, usually App.tsx:
nsh bundles the module's files (with rolldown and Oxc) and compiles the JSX with its own compiler. Imports of nsh and nsh/* stay imports: the runtime serves them natively, so the bundle holds only your code. The bundle is compiled to QuickJS bytecode.| Rust app | TSX app | |
|---|---|---|
| Written in | Rust | TSX (TypeScript and JSX) |
| Built into | Native code, linked into each target's runner | QuickJS bytecode, loaded by the runtime |
| JavaScript engine | None | QuickJS, one VM per view |
While developing (nsh run) | Rebuilt and restarted on each save | Hot updates on each save |
| After release | Ships with the app | Also delivered at run time as signed packages, in a sandbox |
| Suits | Whole apps, heavy computation, system work | Screens written quickly, plugins, AI-generated UI |
The two combine: a Rust app can take TSX screens, and TSX screens import its Rust components, modules and classes; such an app links QuickJS to run them (Building with Rust).
From the engine on, both paths are the same. Changes are collected per turn, laid out with Taffy (flexbox and CSS grid), and handed to the main thread as one batch of view operations per frame; the main thread applies the batch to native views. Text is measured and laid out once on the engine thread (CoreText on Apple platforms, StaticLayout on Android, DirectWrite on Windows, Pango on Linux, the browser's font metrics on the web) and only drawn on the main thread.
On the web, the same engine runs in the page: the browser shows HTML elements styled with CSS, scrolls them, selects their text and handles input, and nsh package --target web publishes the app as a static site whose files are named by content, ready for any CDN (Web).
[!NOTE] The main thread never waits for the app‘s code. Questions the system asks synchronously (may this input accept another character, may the user swipe back, may this sheet close) are answered natively from props set beforehand, such as
maxLength,popOnBackorcloseOnSwipe. Events reach the app’s handlers afterwards.
NSH began as a way for native apps to take UI after release, and that stays one of its main uses. An app embeds an NshAppView (iOS), NshView (Android), AppView (macOS, Windows, Linux and GPUI apps) or createPlayer (a web page) wherever a module should appear, and NSH runs TSX modules inside it:
.nshpkg) the app downloads at run time. The app checks its signature against the keys it trusts and against a revocation list before running it (Signed packages). The host app ships the runtime; teams build modules against its API and deliver them on their own schedule.The same mechanism lets an app answer with an interface. A model writes a small TSX module (a form, a chart, a booking card), your server checks, builds and signs it, and the app shows it natively:
On iOS, the host's part is a few lines:
let app = NshAppView() // a UIView: place it anywhere try app.grantCapabilities(#"{ "network": { "hosts": ["api.example.com"] } }"#) let info = try await app.loadPackage(at: downloadedFile, trust: trust) // verified, then run
NSH is designed for software written with AI, whole apps as much as generated screens:
.nsh/types), and Rust APIs are typed, so generated code is checked by a compiler. These docs are served as plain text for models (llms.txt, llms-full.txt).nsh. nsh test runs headless, without a device, and reports errors and the views produced; the compiler also runs in-process (nsh_bundler::compile_module) and in the browser (Playground).| Platform | Requires | Backend | Embedded with |
|---|---|---|---|
| iOS | iOS 15.0+ | UIKit | NativeShell.xcframework |
| Android | Android 9+ | Android views | nsh.aar |
| macOS | macOS 14+ | AppKit | AppView |
| Windows | Windows 10 1809+ | Win32, Direct2D | AppView |
| Linux | GTK 4.14+ | GTK 4 | AppView |
| Web | Modern browsers | HTML | createPlayer, iframe |
| GPUI | Desktops | GPUI | AppView (GPUI, GPUI Kit apps) |
| Mac Catalyst | macOS | UIKit | For development (--target catalyst) |
Longbridge builds NSH for its own clients. The first need was a plugin layer for the mobile client, and GPUI Shell, which makes GPUI desktop apps extensible in JavaScript, was the starting point. On phones, UI drawn by GPUI itself would have had to rebuild what the platform already does — text selection and its menu (Copy, Share, Translate, Look Up), input methods, accessibility, the visual materials each iOS release brings — and every mobile team would have taken on a new UI stack. NSH therefore renders with each platform's own UI, and it grew from that plugin layer into a framework for whole apps on every platform.
The two are positioned differently. GPUI Shell extends GPUI desktop applications; Native Shell is a framework for native apps on phones, desktops and the web, and its GPUI backend embeds NSH apps in GPUI and GPUI Kit apps (GPUI).
For whole apps, NSH sits among cross-platform frameworks such as React Native, Flutter, Qt, GPUI, Slint, Electron and Tauri; for UI delivered after release, among web views, server-driven UI and mini-program containers. Its choice is each platform's own UI and interaction under one app model, with Rust as the app language and TSX beside it. Comparing approaches goes through each.
nsh, write a first app in Rust or TSX and run it on each platform.