01 |IN-DATABASE LOGIC
From one-liners to compiled extensions
Custom functions, embedded JavaScript, and WebAssembly modules give you a ladder from a quick helper to native-speed compute, all callable directly from SurrealQL.
CUSTOM FUNCTIONS
Reusable logic, defined once
DEFINE FUNCTION stores named, typed procedures in the database. Call them from any query the way you call built-ins.
WEBASSEMBLY EXTENSIONS
Native-speed logic, sandboxed
Write an extension in Rust, compile it to a WebAssembly module, and load it into a running database. Its functions become callable from SurrealQL, sandboxed and inside the transaction.
02 |ONE ENGINE
Move the compute to the data
Pulling rows into an application server, transforming them, and writing them back costs a round trip and breaks atomicity. Running the logic in the database removes both problems.
No round trips
Logic executes beside the data, so there is no fetch-transform-write hop across the network for every operation.
One transaction
Functions and extensions participate in the same ACID transaction as the query that calls them - results commit together or not at all.
One deployment
No function-as-a-service to provision, secure, and scale separately. The compute ships with the database.
GET STARTED
Run your logic where your data lives
Define functions, script in JavaScript, and load WebAssembly extensions - all inside SurrealDB.
SOC 2 Type 2
GDPR
Cyber Essentials Plus
ISO 27001