Node Builder
Node builder for the Weave SDK — declarative configuration for storage, network, identity, and replication adapters.
Purpose
Application SDK for identities, drives, stores, messaging, replication, and peer networking.
The node source reference lists the builder and store methods.
Developer workflow
The builder configures namespace, identifier, storage, bootstrap peers, port and mDNS. Building a node does not prove a peer connection or a replicated remote read; start and check the network explicitly when the application needs it.
A WeaveNode is the single object an application talks to. Passing one configured node through an application can centralize stores and identity. Direct primitive construction remains available to applications that manage those integrations themselves.
Primary types to know
AgentMessage— libs/weave-sdk/src/messaging.rsBasisStore— libs/weave-sdk/src/node.rsConnectedPeer— libs/weave-sdk/src/network_manager.rsForumStore— libs/weave-sdk/src/node.rsGnosisStore— libs/weave-sdk/src/node.rsLensStore— libs/weave-sdk/src/node.rsLocusStore— libs/weave-sdk/src/node.rsMessagingManager— libs/weave-sdk/src/messaging.rsNetworkConfig— libs/weave-sdk/src/network_manager.rs
Example shape
use weave_sdk::prelude::*;
#[tokio::main]
async fn main() -> WeaveResult<()> {
// WeaveNode::builder() returns a WeaveNodeBuilder. Required fields are
// namespace + identifier (used to derive the OAS DID) and a storage_dir.
// Optional builder methods set bootstrap peers, listening port, and
// identity overrides.
let node = WeaveNode::builder()
.namespace("l1fe")
.identifier("example-agent")
.storage_dir("/tmp/weave-example")
.bootstrap(&[])
.port(0)
.mdns(true)
.build()
.await?;
// The constructed node exposes its DID and config. Its discovery key is
// SHA-256-derived from the identity public-key bytes.
println!(
"did={} dht_port={} storage={}",
node.identity().did(),
node.config().dht_port,
node.config().storage_dir.display(),
);
Ok(())
}