Nu — the interaction primitive.

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

Built for

  1. 01AI agentic systems
  2. 02Personal apps
  3. 03Data-intensive apps
  4. 04Enterprise in-house tools

Apache‑2.0Python 3.10+

Meet Nu.

What Nu is, how it works, why it matters.

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

tiny.py
python · 3 locpy
a = 2
b = 5
print(a + b)

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

Nu makes interaction the primitive.

Ref
A name for a value, wherever it lives: a KV slot, a UI text block, 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

>> chains interactions in order. Kill the process, run it again, the values are still there.

kv.py
python · 16 locpy
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

Dashboard.out is a Ref too. Setting a browser text block is the same interaction as setting a KV slot.

ui.py
python · 23 locpy
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.

Nu is small on purpose.

Nu is a model and a set of interfaces, hosted in Python. There is no runtime magic to learn beyond Refs and Interactions. Capabilities come from Fabrics. You compose them; the Refs and Interactions stay the same across every one.

nu.mem
plain dicts, hot state
nu.kv
persistent state on a KV store
nu.ui
browser widgets, live-rendered
nu.invisibles
any Fabric on the wire
nu.ray
teleport to a Ray cluster worker

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

Why this matters.

Because Refs are just names and Interactions are just descriptions, the runtime is free to persist them, replay them, ship them across the network, watch them for changes, batch them into a transaction, run them on another machine.

Which means the same lines that put a + b on a dashboard can, without changing shape:

  • 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.

interaction-model

the theory

The language-agnostic specification.

What an interaction is, how Refs name locations, how Interactions compose into programs. Nu is one implementation; anyone can build another.

nu

the python implementation

Batteries-included, ready to run.

The interaction model in pure Python, with Fabrics for the everyday jobs: in-memory state, kv-based state, UI, network, cluster compute.

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

counter demo

counter

A live counter, persistent across restarts.

nu demo counter
sampled demo

sampled

An infinite series, live-sampled into a fixed-size chart.

nu demo sampled
movies demo

movies

A movie tracker: form, filterable table, detail pages.

nu demo movies

Fabrics.

Fabrics are the tissue between Refs and the real world: memory, kv stores, UI, network, cluster. These are the ones Nu ships with today.

nu.mem

In-memory state fabric.

In-memory state on plain dicts. Perfect for cache, hot state, and in-process coordination.

substratemem

nu.virtuals

Persistent state fabric.

Refs over a KV backend (RocksDB, LMDB). Transactions, snapshots, and change notifications, built in.

Backends: rocksdb, lmdb

substrate · shapeskvrocksdblmdbacid-inmemtext

nu.ui

Web UI fabric.

Same fabric shape as the others, but the Refs are widgets: text, buttons, tables. The fabric renders them in the browser and live-updates them as your state changes.

rendering42counter_ref

nu.invisibles

Network fabric.

A Nu fabric that 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.

distributionobjectservercallerclientproxy

nu.ray

Cluster compute fabric.

A Nu fabric for cluster compute. Teleport a Nu tree to any worker in your Ray cluster; it runs there and returns the result.

compute

Standalone apps built on Nu.

Applications built on Nu today.

nulog

Pure-Python, serverless logger and metrics store. Billions of entries, live UI.

Log messages 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.

nu://nulogappnuloglivetimelevelmsgref15:24:03infoorder.placed{ id: "o_9x2" }15:24:04warnpayment.retry{ attempt: 2 }15:24:05infowebhook.received{ src: "stripe" }15:24:06infoorder.shipped{ id: "o_9x2" }15:24:07infoemail.sent{ to: "…" }built on nu

nuspace

A programmable knowledge base.

A knowledge base whose pages hold both writing, data and code as first-class citizens. Blocks store markdown, live metrics, saved searches, or automation rules, all in the same tree, all inspectable and composable.

Status: Coming soon.

nu://nuspace/q3-plannuspacelivepagesq3 planrefsQ3 plantarget:$12.4kbuilt on nu

Infra. The tools that power Nu fabrics.

Standalone Python libraries the fabrics build on. Each is useful on its own; together they form the substrate under Nu.

virtuals

Virtual Python collections over any KV storage.

Native-shaped Python collections that are thin views over an ordered KV store. Same API as a built-in dict or list, but the bytes stay on disk and stream in on access.

invisibles

Transparent remote objects for Python.

Move an object to another process or node; the calling code doesn't change. Sync stays sync, async stays async.

rdbpy

RocksDB for Python, with transactions.

RocksDB and its compression libs bundled into the wheel for Linux and macOS. No system install. Open a DB and put/get/iterate.

kh57

Deterministic range reservoir sampling.

Draw n uniform samples from a sub-range of a massive (billions) sorted KV dataset without scanning it. Any sorted KV store works as a backend.