Back to services

NSH

NSH (Native Shell) is a cross-platform native UI runtime. Modules written in TSX and Tailwind are rendered as each platform's own native interface on iOS, Android, macOS, Windows, Linux, GPUI and the Web. Modules can be loaded at runtime as plugins inside an existing app, or packaged as standalone apps.

View alternatives to NSH
Contributor:
einverne
Suggest edit
Recent reviews

Alternatives

Website preview

Tech stack

No tech stack added yet. Sign in to suggest some

NSH stands for Native Shell. Developed by Longbridge, it is a cross-platform native UI runtime implemented in Rust. Developers or AI models write UI modules in TSX and Tailwind, and NSH renders them on each platform using that platform's own UI. On iOS, Android, macOS, Windows and Linux they become native views, in GPUI apps they become GPUI elements, and on the Web they become HTML. An app can load these modules as plugins at runtime. The same module can also be packaged as a standalone app.

Key features

  • Truly native UI: Every element maps to a platform view, including UIKit, Android views, AppKit, Win32 drawn with Direct2D, and GTK 4. Layout uses flexbox and grid (based on Taffy). The system's built-in text, input, scrolling and accessibility capabilities can be used directly. Native components such as maps and WebViews can also be layered with NSH views.
  • Works as a plugin or a standalone app: Embed NshAppView (iOS), NshView (Android) or AppView (desktop and GPUI) in any screen of an existing app, or use createPlayer for Web pages. Modules can be loaded from a built-in bundle, a dev server or a downloaded signed package, so feature updates can be decoupled from the host app's release cycle.
  • AI-friendly: A module is a single TSX file made up of components, signals and Tailwind class names, which is the format large models are best at generating. All elements, properties and modules have TypeScript type declarations generated from the Rust source. Documentation is provided to models as llms.txt. nsh trace can run a module headlessly without a device for checking.
  • Sandboxing and signing: Each view's module runs in its own QuickJS virtual machine, with limits on memory, call time and node count, and can only use the capabilities granted by the host. Release packages are signed with Ed25519, release keys are certified by an offline root key, and devices check a revocation list.
  • Performance: Only the app's own code is JavaScript. Signals, the renderer, layout, animation and all built-in modules are implemented in Rust, and each frame is passed to the UI thread as a single batch.
  • One command-line tool for the whole toolchain: A single nsh binary handles packaging, type checking, the hot-reload dev server and publishing.

Supported platforms

PlatformRenderingRequirements
iOSUIKit, CoreTextiOS 15+
AndroidAndroid viewsAndroid 9 (API 28)+
macOSAppKit, Core AnimationmacOS 14+
WindowsWin32, Direct2D, DirectWriteWindows 10 1809+
LinuxGTK 4, PangoGTK 4.14+
GPUI (macOS/Windows/Linux)GPUImacOS, Windows; Linux requires Vulkan
WebHTML, CSSModern browsers

Target users and use cases

  • Cross-platform app developers who want to build UIs with a web technology stack while getting native look and performance.
  • Teams that want to embed dynamic modules in existing native apps and ship them through signed packages, independent of app store releases.
  • AI application developers who want large models to generate UIs and run them safely in a sandbox.
  • Rust developers building desktop apps with GPUI.

Installation and usage

curl -fsSL https://nsh.dev/install.sh | sh     # macOS、Linux
irm https://nsh.dev/install.ps1 | iex          # Windows(PowerShell)
brew install longbridge/tap/nsh                # Homebrew

Create an app and run it with hot reload:

nsh init my-app
nsh run my-app
nsh run my-app --target ios      # 也支持 android、macos、gpui、web

To publish a signed update, first generate a root key and a release key with nsh keygen, then certify with nsh certify, and finally generate a signed .nshpkg with nsh publish. A standalone app can be packaged with nsh package --target <platform>.

Technical requirements and notes

  • Running on the iOS simulator requires Xcode, and running on Android requires the Android SDK.
  • Building from source requires the Rust toolchain; the rust-toolchain.toml in the repository specifies the version.
  • The project is licensed under Apache-2.0.
  • The project is new, with about 121 stars on GitHub. Documentation, guides and an online demo are available at nsh.dev.
  • The repository provides sample apps such as gallery, counter and hopper, as well as examples of embedding in native iOS and Android apps.