Skip to main content
Drop a star to support Nu ⭐ Join the Nu Discord community
Nu

Nu – the interaction primitive

Build apps in one primitive that spans your whole stack — databases, UIs, AI agents, and services. No glue. 50x less code.

Discord Twitter Follow

Platform Support PyPI - Python Version PyPI Package License PyPI Downloads



AboutQuick StartEcosystemSpecExamplesDocumentationCommunity


ℹ️ About

Every app is a set of interactions between systems: a database, a UI, AI agents, services. Nu names those interactions directly:

  • Ref names what you touch. A KV slot, a UI widget, an LLM endpoint, a memory slot, a remote object.
  • Interaction describes what to do with it. Read, write, branch, iterate, compose.
  • Fabric binds Refs to a real backend.

Persistence, reactivity, atomicity, observability, and scalability are inherent, not bolted on.

🏁 Quick Start

They say a good example is worth 100 pages of API documentation, a million directives, or a thousand words.

Well, "they" probably lie... but here's an example anyway:

import nu

class Counter(nu.Shape):
    value: nu.kv.IntRef

class Dashboard(nu.ui.Page):
    count: nu.ui.TextRef

class App(nu.ui.Index):
    pages = nu.ui.Pages({"/": Dashboard})

app = nu.With(
    nu.kv.rocksdb_navigator(".dbcounter"),
    nu.ui.server(
        nu.kv.auto_flow_atomic(
            nu.ReactForever(
                Counter.value.on_change(),
                Dashboard.count.set(Counter.value),
            ),
        ),
    ),
    body=nu.kv.auto_flow_atomic(
        nu.IfDo(Counter.value.missing(), Counter.value.set(0))
        >> nu.ForeverDo(
            Counter.value.inc() >> nu.Delay(1.0),
        )
    ),
)

if __name__ == "__main__":
    import asyncio
    asyncio.run(nu.arun(app))

A dashboard on a live counter that persists across restarts. One Nu tree, two Fabrics. Kill it, run again, it picks up where it left off.

Install

Python 3.10+.

pip install "nustack-py[all]"

For lean installs and source builds see nustack.dev/docs/how-to/install.

Run

Save the snippet above as app.py, then:

python app.py

Open the browser tab that pops up — the counter ticks once a second, the dashboard mirrors it live.

More in examples/. Full walkthrough at nustack.dev/docs.

🌍 Ecosystem

Fabrics

Each fabric binds Refs to a real backend and unlocks a new capability.

Fabric What
nu.mem In-memory state fabric. Perfect for cache, hot state, and in-process coordination.
nu.kv Persistent state fabric. Refs over a KV backend (RocksDB, LMDB); transactions, snapshots, and change notifications, built in.
nu.ui Web UI fabric. Same fabric shape as the others, but the Refs are widgets — text, buttons, tables — rendered in the browser and live-updated as your state changes.
nu.invisibles Network fabric. Puts other fabrics on the network — bind a fabric in one process, use it from another; same Refs, same interactions, over TCP or Unix socket.
nu.ray Cluster compute fabric. Teleport a Nu tree to any worker in your Ray cluster; it runs there and returns the result.

Apps built on Nu

End-user tools written as Nu programs.

Repo What
nustackdev/nulog Pure-Python, serverless logger and metrics store. Log and observe metrics from any Python code; entries persist to an embedded KV store and scale to billions, in-process. One line boots a live viewer.

📐 Spec

Nu is a reference implementation of the interaction model — a language-agnostic specification of what an interaction is, how Refs name locations, and how Interactions compose into programs.

nustackdev/interaction-model

🛣️ Roadmap

TODO.

👥 Community

Nu README badge

Add a Nu badge to your README if you're building on Nu:

Nu

[![Nu](https://img.shields.io/badge/built%20with-Nu-%237A4CE0)](https://github.com/nustackdev/nu)

Contributing to Nu

Considering contributing to Nu? Start by opening an issue or a PR — the codebase is small and readable, and the model is stable enough to build on.

More questions?

  1. Read the docs
  2. Open a feature request or report a bug
  3. Join the Discord community

License

Apache-2.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nustack_py-0.1.8.tar.gz (1.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nustack_py-0.1.8-py3-none-any.whl (432.7 kB view details)

Uploaded Python 3

File details

Details for the file nustack_py-0.1.8.tar.gz.

File metadata

  • Download URL: nustack_py-0.1.8.tar.gz
  • Upload date:
  • Size: 1.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for nustack_py-0.1.8.tar.gz
Algorithm Hash digest
SHA256 d5a2ce7f739774e9c9b15ad3e4ce9e9604ce2e16c736170df032ca9b83d7858e
MD5 876829869020cd8d851a2164e405e9c8
BLAKE2b-256 8a3ada1f05fd1b856886fea17081c92bc5d19f142d67df9dd56f084554b15374

See more details on using hashes here.

Provenance

The following attestation bundles were made for nustack_py-0.1.8.tar.gz:

Publisher: publish-nu.yml on nustackdev/nu

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nustack_py-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: nustack_py-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 432.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for nustack_py-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 35c8bcfa1a1a69ebf3b38c9262f3e5b2c7519484f278f58910f7fc68b63dd2b2
MD5 b9bb3ee2e21e84489960fff0908fabae
BLAKE2b-256 c6d1b83f3cb7da1fd62c4bb73981489696e25b10b1f0048fe1a04c4043d14343

See more details on using hashes here.

Provenance

The following attestation bundles were made for nustack_py-0.1.8-py3-none-any.whl:

Publisher: publish-nu.yml on nustackdev/nu

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page