Surqlize is published on npm as surqlize. It declares the JavaScript SDK as a peer dependency, and your code imports Surreal from that package to open the connection, so a project installs both.
Install the packages
bun add surqlize surrealdbSurqlize ships ESM and CommonJS builds with type declarations, so it can be imported with either module system.
import { Surreal } from "surrealdb";
import { orm, table, t } from "surqlize";Requirements
| Requirement | Version |
|---|---|
surrealdb JavaScript SDK | ^2.1.0 |
| TypeScript | 5 or 6 |
| SurrealDB server | 3.0 or later |
The SDK and the server are versioned separately: version 2 of the SDK is the one that connects to a SurrealDB 3.x server.
Surqlize targets SurrealDB 3.x. A few features depend on the server version, and the page for each feature says which. Computed fields need 3.0, filtering or projecting a live query needs 3.0, and .retry() recognises a transaction conflict from the structured error that SurrealDB 3.1.0 and later report.
Use one version of the SDK
The connection that you pass to Surqlize and Surqlize itself must come from the same installed copy of surrealdb. When a project installs two different versions of the SDK, TypeScript can report an error where the connection is passed to orm():
Type 'Surreal' is not assignable to type 'SurrealSession'.
Property '#private' in type 'Surreal' refers to a different member that cannot be accessed from within type 'SurrealSession'.To check which versions a project resolves, run npm ls surrealdb (or bun pm ls --all).
If a query fails with a DuplicateSurrealError, the connection was created by a different copy of surrealdb from the one Surqlize imports. See error handling.