Surrealism extensions are written in Rust, compiled into .surli modules, and loaded into a running SurrealDB instance. This gives you access to the 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:
Adding functions to create fake / mock data for testing.
Accessing functionality in Rust crates that are too specific to merge into SurrealDB itself, such as language-specific functionality, custom case conversions, or quantitative finance.
Anything else you have built in your own code that you would like to access inside SurrealDB.
How Surrealism works
Surrealism works by using the following steps:
Use the
surreal module initcommand to begin a new project. This command works in a similar manner tocargo newin scaffolding a new project with its owntomlfile (surrealism.toml).Annotate functions to export with
#[surrealism].Use the
surreal module buildcommand to build the module.In SurrealDB, allow access to module files and define a module to access the functions.

What is available in Surrealism
Current Surrealism releases include:
function-level metadata such as
writeableandcommentvia#[surrealism(...)];one-time module initialisation with
#[surrealism(init)];namespaced exports with
#[surrealism] mod ...;optional read-only attached filesystem data packaged into the module archive;
server-side resource controls for execution time, memory, and module KV limits.
The next pages walk through the workflow and APIs: