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.
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.
| Protocol | Carries |
|---|---|
| iroh-docs | Documents, as signed key-value stores that sync between peers |
| iroh-blobs | Bulk content such as meshes, images, and compiled scripts, addressed by hash |
| iroh-gossip | Presence, 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.