Official Rust SDK for developing VTX Project plugins.
vtx-sdk provides safe, idiomatic Rust bindings for the VTX Host ABI. It abstracts away the complexity of the WebAssembly Component Model (wit-bindgen), allowing plugin authors to focus on business logic rather than low-level bindings.
-
Type-Safe APIs
Complete Rust wrappers for all WIT import interfaces (SQL, Stream I/O, FFmpeg, Context, Event Bus). -
Low Boilerplate
export_plugin!andVtxPluginprovide default implementations for common exports (migrations,resources,handle_event,authenticate). -
Database Integration
SQLite helpers with automatic JSON deserialization. -
Helper Utilities
ResponseBuilder,UserBuilder,BufferExt,VtxEventExt, and a unifiedVtxErrormodel.
Unlike traditional Wasm projects, this SDK does not maintain a local copy of the WIT interface definitions. Instead, it relies on the
vtx-protocol crate as the Single Source of Truth (SSOT).
-
Build Time
Thebuild.rsscript dynamically retrieves the WIT definition path from thevtx-protocolbuild dependency and injects it into the compilation process. -
Runtime / Metadata
TheWIT_DEFINITIONconstant is also sourced directly from the protocol crate, ensuring zero divergence between the SDK and the protocol.
Add vtx-sdk to your plugin’s Cargo.toml:
[dependencies]
vtx-sdk = "0.1.8"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
anyhow = "1.0"
[lib]
crate-type = ["cdylib"] # Required for compiling to Wasm