UNAVI Docs unavi.xyz
Build · How it works

Architecture

The Wired is defined by two things. The HSD scene format describes what is in a space, and the wired:* WIT (WebAssembly Interface Types) packages are the API a script calls. Any peer that speaks both can join The Wired.

The rest of this page covers how unavi builds its peer, using Bevy for rendering, iroh for networking, and wasmtime for scripts. Another implementation could make different choices here.

How UNAVI's pieces fit The Wired is the HSD scene format and the wired WIT scripting API, both implemented by unavi-app. unavi-app and unavi-node are both peers and connect to each other over iroh. Every peer's iroh endpoint carries iroh-docs documents, iroh-blobs content and iroh-gossip presence. The Wired HSD scenes .hsda → .hsdz wired:* WIT the scripting API Peers unavi-app desktop and web app bevy-hsd · scenes unavi-script · wasmtime unavi-space · presence unavi-portal · portals unavi-policy · trust unavi-identity · DIDs iroh unavi-node always-on peer unavi-registry did:web over HTTP hosts documents Network iroh endpoint one per peer · bevy-iroh, unavi-store iroh-docs documents iroh-blobs content by hash iroh-gossip who is in a space

Peers

Every running copy of UNAVI is a peer. There is no central server that a space depends on.

unavi-app is the desktop and web app. It assembles the other crates into one Bevy app.

unavi-node is an always-on peer that runs without the app. It serves hosted files, publishes its own did:web over HTTP, and can run the registry. It never opens a connection itself, since peers come to it. A space's document lives with the people in it, and the app syncs it from them rather than from a node.

Networking

Each peer has one iroh endpoint. It identifies the device and connects directly to other peers, through NATs where needed. Three iroh protocols run over it.

ProtocolCarries
iroh-docsDocuments, as signed key-value stores that sync between peers
iroh-blobsBulk content such as meshes, images, and compiled scripts, addressed by hash
iroh-gossipPresence, meaning who is in a space right now

An HSD document is an iroh-docs namespace. Its entries point at blobs by hash, so a mesh used by many prims is stored once.

Identity

Each person and node has a DID (decentralized identifier). People get a did:key by default, and nodes use a did:web on their domain. Every connection proves which DID is behind an endpoint, and each peer's trust decisions are keyed by DID.

Scripts

Scripts are WebAssembly components, run by unavi-script on wasmtime. The host implements the wired:* packages, so a script can be written in any language with a WebAssembly component toolchain. See the Scripting API.

The registry

A registry lists public spaces and who is in them. A listing can only be changed by the DID that wrote it. A registry runs as part of unavi-node, unless the node is started with --no-registry. Its catalog and presence are capped per identity and overall, with a shared pool for did:key identities, as Running a node lists.