Skip to content

Open source · Early preview

Write it once in Go.Native on every platform.

NSGo is a cross-platform UI framework. Your app’s state, layout and styles run in Go, and 14 platforms draw it with their own native views.

  • iOS
  • App Clips
  • tvOS
  • watchOS
  • macOS
  • Android
  • HarmonyOSPreview: ArkUI draws a first set of views, and you sign the package yourself to install it on a phone.
  • Windows
  • Linux
  • Web
  • WeChatExperimental: mini programs hold an app to 2 MB, which larger apps exceed for now.
  • QQExperimental: mini programs hold an app to 2 MB, which larger apps exceed for now.
  • AlipayExperimental: mini programs hold an app to 2 MB, which larger apps exceed for now.
  • DouyinExperimental: mini programs hold an app to 2 MB, which larger apps exceed for now.
The NSGo gallery’s Stocks demo in its desktop layout, on the web backendThe NSGo gallery’s Stocks demo in its desktop layout, on the web backend
The NSGo gallery’s components in its phone layout, on the web backendThe NSGo gallery’s components in its phone layout, on the web backend

How it works

Go owns the app. The platform draws it.

No embedded browser and no custom renderer sit between your app and the screen: each update crosses to the main thread once, as one batch of only what changed.

  1. Your appGo or TSX
    • Components
    • Signals
    • Styles and Tailwind
  2. NSGo engineIn Go
    • Reactive graph
    • Flexbox and grid
    • Text preparation
  3. The platformNative views
    • AppKit · UIKit
    • Android Views
    • Direct2D · GTK · DOM

What you get

Everything an app needs, in one language.

  • Truly native

    Each platform draws with its own views, text, scrolling and accessibility.

  • A reactive engine

    Signals update only what reads them. Animation runs on the platform’s frame clock.

  • Layout and styles you know

    Flexbox and grid, CSS-like styles, Tailwind classes, light and dark themes, right-to-left languages.

  • Components included

    Unstyled in base, ready to use in ui: from buttons and menus to data tables, charts, a code editor and a terminal.

  • Go or TSX

    Components as Go values, or TSX with Tailwind classes, compiled ahead with no Node.

  • Tests that act like users

    Find a control by its text and press it, headless or in a real window.

The API

A component is just Go.

Elements are structs, state is a signal, and a test presses the button the way a user would.

  • No template language

    A component is a function that returns elements.

  • Fine-grained updates

    Pressing changes the one text that reads the count.

  • Embeds anywhere

    Put an NSGo view inside an iOS, Android, desktop or web app.

package main
import (
"fmt"
"github.com/nsgo-dev/nsgo"
"github.com/nsgo-dev/nsgo/base"
"github.com/nsgo-dev/nsgo/core"
)
func Root(cx *core.Scope) core.Node {
count := core.NewSignal(cx, 0)
return core.View{
Style: core.Style{Padding: core.All(24), Gap: 12},
Children: []core.Node{
core.Text{ContentFunc: func() string {
return fmt.Sprintf("Pressed %d times", count.Get())
}},
base.Button{
Label: "Press me",
OnPress: func(core.PressEvent) {
count.Update(func(n int) int { return n + 1 })
},
Style: core.Style{
Padding: core.Symmetric(6, 14),
CornerRadius: 8,
Background: core.RGB(0x007aff),
Color: core.RGB(0xffffff),
},
Children: []core.Node{core.Text{Content: "Press me"}},
},
},
}
}
func main() { nsgo.Run(Root) }

Workflow

One tool, from first line to store.

nsgo creates, runs, tests and packages apps. It installs with Go and runs wherever Go does.

  1. 01

    Create

    A Go, TSX or mixed app.

    $ nsgo init
  2. 02

    Run

    Hot reload on every save.

    $ nsgo dev
  3. 03

    Test

    Headless or in a native window.

    $ nsgo test
  4. 04

    Ship

    Signed packages for each target.

    $ nsgo build

Start building with NSGo.

Follow the guide to install the tool and create your first app.