Add-ons: getting started
For developers
This guide takes you from nothing to a package Venolio can install.
1. Install the tools
You need Rust 1.90 or newer with the WebAssembly target:
# Rust from https://rustup.rs, then:
rustup target add wasm32-unknown-unknown
Then install the command-line tool from the SDK source the Venolio team gave you (see Build add-ons):
cargo install --locked --path <sdk folder>/venolio-addon-cli
venolio-addon --version
2. Create an add-on
venolio-addon new hello-venolio --id com.yourcompany.hello --publisher "Your Company" \
--sdk-path <sdk folder>/venolio-addon
cd hello-venolio
--sdk-pathpoints the project at your copy of the SDK crate. Once the SDK is published, you can leave it out and depend onvenolio-addonfrom crates.io.--idis your add-on’s permanent, reverse-DNS identity (see Manifest).--kindstarts with another kind of entry point:action,webhook,panelorblockinstead of the defaultfunction.
The project is an ordinary Rust library crate:
| File | What it is |
|---|---|
manifest.json |
The add-on’s identity, permissions and entry points: what an administrator reviews and approves. |
The library source in src |
The hello entry point: greets a name and counts greetings in storage. |
tests/hello.json |
Two test cases venolio-addon test runs in the sandbox. |
Cargo.toml |
crate-type = ["cdylib", "rlib"] and a release profile that keeps the module small. |
The entry point:
use venolio_addon::{entry_point, log, storage, Result};
use serde::{Deserialize, Serialize};
#[derive(Deserialize)]
pub struct HelloInput {
#[serde(default)]
pub name: Option<String>,
}
#[derive(Serialize)]
pub struct HelloOutput {
pub message: String,
pub greeted: u64,
}
pub fn hello(input: HelloInput) -> Result<HelloOutput> {
let name = input.name.unwrap_or_else(|| "world".to_owned());
let greeted = storage::get::<u64>("greeted")?.unwrap_or(0) + 1;
storage::set("greeted", &greeted)?;
log!("greeted {name} (#{greeted})");
Ok(HelloOutput { message: format!("Hello, {name}!"), greeted })
}
entry_point!(hello);
entry_point!(hello) exports hello from the module; the name must match export in the
manifest’s entry point. Because the add-on uses storage, the manifest asks for the storage
permission with a reason the administrator reads.
3. Build
venolio-addon build
This runs cargo build --release --target wasm32-unknown-unknown, then the checks Venolio applies
when it installs a package: the manifest rules, a module of at most 4 MiB, imports only from the
venolio host functions, an exported memory, every entry point exported with no parameters and no
results, no start function, and memory within the limit. It prints the module’s size and SHA-256
and the permissions an administrator will be asked for.
4. Test
cargo test # native unit tests of your Rust code
venolio-addon test # tests/*.json against the WebAssembly build
venolio-addon run hello --input '{"name": "Alex"}' # one run, with its report
venolio-addon test runs each case in the same interpreter and with the same limits as Venolio,
against a stand-in host you describe with fixtures: which permissions are granted, which pages and
databases exist, what storage holds and what HTTP requests answer. It never uses the network. See
Testing.
5. Package
venolio-addon pack
This writes dist/com.yourcompany.hello-0.1.0/ with manifest.json, module.wasm and
package.json. package.json is the file Venolio installs. Install it in your own Venolio to try
it on real data, then submit it if you want it listed.
Next
- The SDK comes with a larger example,
page-digest, that reads pages, creates records and posts to a webhook. - Host API for everything an add-on can call.
- Permissions and Limits before you design anything ambitious.
About this part of Venolio: Let Claude, ChatGPT and Codex work in your workspace
Checked against the app on . The same help is built into the Venolio apps and works offline. Something wrong or missing? Tell us.