Docs

Comparing approaches

An app that wants UI it did not ship with — answers generated by a model, features from partners or other teams, screens that change without a release — has a handful of established options, on phones and desktops alike. They differ in what draws the UI, what the delivered code may do, and how much of the app has to change to host them. This page compares them with NSH, and then compares NSH with the cross-platform frameworks used to write whole apps.

#The options

What draws itWhat it can expressConfinementFit for generated UICost to the host app
Web view (H5)A browser engineAnything HTML, CSS and JS canSame-origin rules; native access through a hand-written bridgeModels write HTML well; the result looks and behaves like a web pageA browser engine per view; a bridge to maintain
Server-driven UIThe app’s own native viewsOnly the components and actions the app built in, described in JSONTotal: the schema is the limitEasy to generate, little to express: no local state or logic beyond what the schema providesA renderer for every component and its versions, in each app
Mini-program containersUsually a web engine with a proprietary layerA platform-specific framework and APIThe container’s permission modelProprietary dialect, less known to modelsA large container SDK
Over-the-air updates of a cross-platform app (React Native with a code-push service, for example)That framework’s rendererThe whole frameworkNone: updates are trusted app codeCode generated per request is not what these updates are forThe app has to be written in that framework
NSHThe platform’s own UI: UIKit, Android views, AppKit, GTK 4, Win32 with Direct2DComponents with state, logic, animation and layout; host-registered native viewsSigned packages, a VM per view with host-set limits, capabilities granted per viewDesigned for it: one TSX module, typed API, headless checksOne view and a library in an existing native app

#How NSH differs

  • The platform’s own UI. A module is made of the platform’s views, so text selection and its menu, input methods, accessibility and scrolling are the system’s own — the same reason NSH exists next to GPUI Shell.
  • More than a schema. Server-driven UI only recombines what the app already ships. An NSH module has its own state, logic, animations and layout, so a model can produce an interface the app’s developers never anticipated.
  • Confined by the host. Delivered code is untrusted. NSH checks signatures and revocations before running anything, gives each view its own VM with memory, call-time and node limits, and lets the host decide which network hosts, web pages and system settings a module may reach (Sandbox and capabilities).
  • Embedded, not adopted. The app stays native and keeps its toolchain; NSH is a view placed where a module should appear (Platforms).
  • One module, every platform. The same bundle runs on iOS, Android, macOS, Windows and Linux, each time with that platform’s own UI (Platforms).

#Cross-platform frameworks

NSH is designed for modules inside native apps, but the same modules can be packaged as whole apps for every platform, so it is natural to compare it with the frameworks people write cross-platform apps in. The comparison is about how each draws and where it runs, not about maturity: these frameworks have large ecosystems that NSH does not have.

What draws itPlatformsApp codeCode delivered after release
React NativeThe platform’s views on iOS and Android; desktops through separate projectsiOS, Android; Windows and macOS out of treeJavaScript or TypeScript, with ReactOver-the-air updates of trusted app code
FlutterIts own engine draws every pixeliOS, Android, macOS, Windows, Linux, webDartNot part of the framework
ElectronChromium, bundled with the appmacOS, Windows, LinuxHTML, CSS, JavaScriptWeb content the app loads
TauriThe system’s web viewmacOS, Windows, Linux, iOS, AndroidHTML, CSS, JavaScript; Rust for the native sideWeb content the app loads
NSHThe platform’s own UI on each platformiOS, Android, macOS, Windows, LinuxTSX modules; the runtime and components are RustSigned packages, verified and sandboxed per view

What sets NSH apart:

  • Native UI on every platform, not one renderer everywhere. Flutter draws everything itself, and Electron and Tauri show web pages; NSH builds each platform’s own views, so text selection, input methods, accessibility and the system’s look come from the platform.
  • Small modules inside native apps. The frameworks above own the whole app. NSH is designed to sit inside an app written with the platform’s own tools, as one view among others, and to run modules the app did not ship with, in a sandbox.
  • A light runtime. No browser engine per app or per view; JavaScript only runs the module’s own code, and everything it calls is native Rust.

#When another option fits better

  • The UI is a document or an existing web page: a web view shows it as it is.
  • The set of screens is fixed and small, and only content and order change: server-driven UI needs no runtime at all.
  • The whole app is written in a cross-platform framework already: its own update mechanism ships its code.
  • You need a large ecosystem of third-party packages, or a desktop UI kit with desktop controls today: NSH’s components are the mobile set.

#See also