Skip to content

Guides

Using WASM plugins

You do not have to author Rust yourself to benefit from Surrealism. Many teams install a pre-built .surli archive produced by another team or pipeline, or a package published to Silo. Writing an extension means writing Rust, configuring package.toml, and running surreal ext build yourself, as described in Creating custom extensions. This page focuses on installing one.

If you receive an archive from another team, inspect it locally first:

surreal ext info demo.surli
surreal ext sig --fnc can_drive demo.surli

These commands show the functions it exports, their signatures, and whether each one can write.

SurrealDB needs access to the .surli file. Use DEFINE BUCKET to create or configure bucket storage, then upload the file according to your environment's path and permissions model. A Silo package needs no bucket, because the database fetches it from Silo.

surreal ext install reads the archive, shows who signed it, its digest, the functions it adds and the capabilities it requests, and asks which to accept before it defines the extension:

surreal ext install 'f"extensions:/demo.surli"' --as demo \
    -e ws://localhost:8000 -u root -p secret --ns app --db main

Confirm the signer's key fingerprint or CI identity with the team that published the archive before you accept it. In a script, pass the decisions as flags, such as --trust-signer and --with-capability.

The command runs a DEFINE EXTENSION statement, which can also be written by hand when the signer and capabilities are already known.

After the extension is defined, call its functions through the name it was installed as, such as ext::demo::can_drive(18). Consult the extension's documentation for exact names and parameters.

To move to a new version of the archive, upload it under a new file name and run surreal ext upgrade, which compares the new signer and capabilities with the installed ones before it redefines the extension.

Was this page helpful?