vtx-sdk 0.1.14

Official SDK for developing VTX plugins using Rust and WebAssembly.
Documentation

vtx-sdk

Crates.io License

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.

✨ Features

  • Type-Safe APIs
    Complete Rust wrappers for all WIT import interfaces (SQL, Stream I/O, FFmpeg, Context, Event Bus).

  • Low Boilerplate
    export_plugin! and VtxPlugin provide 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 unified VtxError model.

🏗️ Architecture

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
    The build.rs script dynamically retrieves the WIT definition path from the vtx-protocol build dependency and injects it into the compilation process.

  • Runtime / Metadata
    The WIT_DEFINITION constant is also sourced directly from the protocol crate, ensuring zero divergence between the SDK and the protocol.

📦 Installation

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