• Start

Guides

Using WASM plugins

How to load a pre-built Surrealism WASM module into SurrealDB, register it, and call its functions from SurrealQL.

Available since: v3.0.0

You do not have to author Rust yourself to benefit from Surrealism. Many teams will consume a pre-built .wasm file produced elsewhere (for example, an internal build pipeline or a vendor), whereas authoring a module means writing Rust, configuring surrealism.toml, and running surreal module yourself. This page focuses on the consumer path.

SurrealDB needs access to the binary. Use DEFINE BUCKET to create or configure bucket storage and upload the .wasm according to the statement’s options (path, permissions, and naming depend on how you manage files in your environment).

Once the WASM is stored, DEFINE MODULE associates that bucket’s artefact with a module name and exposes the compiled functions to SurrealQL. The module definition must line up with how the plugin was built (exported function names and signatures).

After the module is defined, call its exported functions like any other Surrealism entry point your version supports—typically by qualifying the function with the module you registered. Consult your plugin’s documentation for exact names and parameters. If you upgrade the .wasm, repeat the bucket upload and module definition steps (or your deployment automation) so the running instance picks up the new binary.

Was this page helpful?