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



AboutQuickstartFabricsAppsSpecExamplesDocumentationCommunity


ℹ️ About

A tiny program is a joy to write. Three lines, one substrate:

a = 2
b = 5
print(a + b)

Real apps don't stay here. a moves into a database. b comes from a form submission. The result renders in a browser. A background job reruns it when either input changes. Three lines become three hundred: an ORM, a request handler, a template, a websocket, a queue. Almost none of it is about a + b anymore — it's all interaction between substrates.

Nu makes interaction the primitive.

  • Ref — a name for a value, wherever it lives. A KV slot, a UI widget, an LLM endpoint, a remote object.
  • Interaction — what you do with a Ref. Read, write, branch, iterate, compose.
  • Fabric — binds Refs to a real backend.

Same program, a and b persisted in a KV store:

import nu


class DB(nu.Shape):
    a = nu.kv.IntRef.slot()
    b = nu.kv.IntRef.slot()


# compute a + b and print it
compute = DB.a.set(2) >> DB.b.set(5) >> nu.print(DB.a + DB.b)

# assemble: rocksdb-backed
app = nu.With(
    nu.kv.rocksdb_navigator(".dbsum"),
    body=nu.kv.auto_flow_atomic(compute),
)

nu.run(app)

Same program, result rendered in a live browser dashboard:

import asyncio
import nu


class DB(nu.Shape):
    a = nu.kv.IntRef.slot()
    b = nu.kv.IntRef.slot()


class Dashboard(nu.ui.Page):
    out = nu.ui.TextRef.slot()


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


# compute a + b and render into the dashboard text block
compute = DB.a.set(2) >> DB.b.set(5) >> Dashboard.out.set(DB.a + DB.b)

# assemble: rocksdb-backed, served over the browser
app = nu.With(
    nu.kv.rocksdb_navigator(".dbsum"),
    nu.ui.server(nu.kv.auto_flow_atomic(compute)),
)

asyncio.run(nu.arun(app))

Same primitive, different substrate. One Ref for any resource, one Interaction for any op. Nu doesn't care what the backend is.

Persistence, reactivity, atomicity, observability, distribution — not features Nu has. What falls out of naming interactions instead of executing them:

  • Persist across restarts — the KV slot is already durable.
  • Re-render live on input changes — wrap in a React interaction.
  • Handle terabytes — shard the KV Fabric; the Refs don't notice.
  • Run distributed across a cluster — bind through nu.ray; the Refs don't notice.

Full walkthrough at nustack.dev.

🏁 Quickstart

Three steps: install, run a demo, explore Nu.

01 · Install

Python 3.10+ · everything ships in the wheel.

pip install "nustack-py[all]"

02 · Run a demo

Each one boots a live browser dashboard and picks up where it left off on restart. nu demo lists them all.

counter sampled
counter demo A live counter, persistent across restarts.
nu demo counter
sampled demo An infinite series, live-sampled into a line-chart.
nu demo sampled
movies
movies demo A movie tracker: form, filterable table, detail pages.
nu demo movies

03 · Explore Nu

  • Read the docs — tutorials, how-tos, and the fabric reference.
  • Browse examples — full source for every demo, plus more programs to steal from.

🧵 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.13.tar.gz (2.0 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.13-py3-none-any.whl (454.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nustack_py-0.1.13.tar.gz
  • Upload date:
  • Size: 2.0 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.13.tar.gz
Algorithm Hash digest
SHA256 e0aef60b56621404271124b8a56f5ea5ef2d9fd5bcb83acd1bcb635c1f2b2fdb
MD5 4a7a9deeea4fb9f8fdd2c0fcd4fab272
BLAKE2b-256 89d9c32e6eb86dfff10e9c0c98135d0f27864300bb39c11c8f40a2c7b136b062

See more details on using hashes here.

Provenance

The following attestation bundles were made for nustack_py-0.1.13.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.13-py3-none-any.whl.

File metadata

  • Download URL: nustack_py-0.1.13-py3-none-any.whl
  • Upload date:
  • Size: 454.2 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.13-py3-none-any.whl
Algorithm Hash digest
SHA256 75aaacb69979e88c1985d30a9434ec3cbcc494d821a4a85e3885a43df6394c0f
MD5 b67fed2bb7004eb9e668cd2bf34e2d15
BLAKE2b-256 b6d8caca5f962e11be281adf56025ed0eb0eb9da0172282977558c387813afba

See more details on using hashes here.

Provenance

The following attestation bundles were made for nustack_py-0.1.13-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