Available since: v3.0.0
Surrealism plugins remain an experimental functionality under active development. This guide describes SurrealDB 4.0, and notes where earlier versions differ. A server runs extensions only when the surrealism experimental capability is allowed, for example with --allow-experimental surrealism. Version 3.1.0 made many additions to Surrealism's core functionality. We look forward to feedback on the plugin system, either via raising an issue or PR on the SurrealDB repo, or on our Discord server - the #surrealism channel is a good place to start.
SurrealDB's extension system, known as Surrealism, lets you add custom functionality to the database engine without modifying its core. Before SurrealDB 4.0, extensions were called modules. Extensions are compiled to WebAssembly (WASM) and loaded at runtime, which means they run in a sandboxed environment with predictable performance characteristics.
This section covers:
Plugins - an overview of the plugin architecture, how plugins are discovered and loaded, and the types of extensions you can create.
Guides - step-by-step walkthroughs for creating custom extensions, understanding how extensions run, and installing pre-built ones.
Attribute reference - options for the
#[surrealism]attribute used to mark functions as Surrealism functions, such ascomment,init, database access through aTransaction, and namespaced exports.
Guides
Using WASM plugins - load and call a compiled plugin