Durable state for Nu apps, from prototype to terabytes.
nu.kv turns Refs into slots in a document-shaped data model over any KV storage, with snapshots for consistent reads and transactions for whole-state writes.
See it.
Declare a Shape, hang typed Refs off it, then read and write as plain Python attributes.
Refs are addresses. Shapes are your data model.
Any Python primitive, dict, list, tuple, nested Shape, or indexed collection can hang off a Shape as a typed Ref. Subscript and dot navigate through the tree. Nothing is fetched until a bracket runs it.
Wrap reads in Snapshot for a consistent view. Wrap writes in Transaction and the whole body commits or none of it does. Backend picks change one line at the top.
What your program gains.
Four properties once your state lives on nu.kv.
persistence
State is there when the process comes back.
Every write goes to the backing store. Restart, redeploy, crash and recover. The values are still there in the same slots you declared.
scalability
Shard the storage. Refs do not notice.
The same Ref API runs against a laptop directory and a terabyte-scale store. Partition by key, split across disks, add read-only tailers. The Shape code does not change.
reactivity
Any Ref emits on change.
Subscribe with on_change and wake code on write. The default observer fires in-process. Swap in the Redis observer and the same subscription fires across the cluster.
durability
Snapshots and transactions built in.
Wrap reads in Snapshot for one consistent view. Wrap writes in Transaction and the whole body commits or none of it does.
Pick a backend.
Storage on one line. Notifications on another. The Ref API stays the same across every combination.
rocksdb
LSM store for terabytes and up.
Billions of keys, range scans, snapshots, WAL. Primary writer plus read-only tailers in other processes. The default when data outlives the process.
lmdb
Memory-mapped, single-writer ACID.
Zero-copy reads, one writer, real transactions in a single directory. Reach for it when one process owns writes and readers want speed.
in-memory
ACID in RAM for tests and drafts.
Same Ref API, same brackets, no disk. Real snapshots and transactions, so tests exercise the production code path.
observers
Redis or in-memory pub/sub.
The observer decides who wakes up on write. In-memory for one process, Redis for many. on_change stays the same call.
Combines well with.
Refs are Refs. The state you declared here is what the other fabrics read, render, and react to.
nu.mem
Hot state, in-process.
Mix mem slots and kv slots on the same Shape. Scratch beside durable, same attribute syntax.
nu.ui
Live browser widgets.
Bind a widget to a kv slot. Writes flow both ways through the same Ref. No polling.
nu.cluster
Compute on the workers.
Teleport a body to a worker. The kv Refs travel with it. State stays one shared tree.
Try Nu.
One command gets you the wheel with every fabric. Then follow the movies tutorial to build a real app in an afternoon.
01 Install
pip install "nustack-py[all]"02 Run the demo
nu demo movies03 Build your app
Browse examplesLike what you see?
The project is young. Star it, join the room, watch what we ship next.