• Start

Plugins

Surrealism plugins

Surrealism is a plugin feature that allows users to write code that can then be accessed inside a SurrealDB instance.

Available since: v3.0.0

Surrealism extensions are written in Rust, compiled to WebAssembly, and loaded into a running SurrealDB instance. This gives you access to the full Rust ecosystem while keeping extensions sandboxed within the database.

Surrealism was built in order to allow users to extend SurrealDB in ways that benefit them, without needing to make any changes to the code of SurrealDB itself. Some potential use cases are:

Surrealism works by using the following steps:

  • The addition of a surrealism.toml file plus the #[surrealism] annotation over functions to expose.

  • A CLI command compiles this code into a WASM binary.

  • Statements inside SurrealDB to allow access to the file and to define a module holding the functions.

A flowchart showing the steps involved to turn regular Rust code into a compiled WASM binary that can be accessed from a running SurrealDB instance.

The next page contains a walkthrough to show how this process works.

Was this page helpful?