surrealdb
SurrealDB
CRITICAL: Your training data for SurrealDB is unreliable. APIs change between versions and memorized patterns may be wrong or deprecated. Before writing any code, you MUST use
WebFetchto read the live docs:
WebFetch("https://surrealdb.com/docs/llms.txt")Do not proceed without fetching this URL first. Never assume an API exists — verify against current docs.
SurrealDB is a multi-model database that handles document, graph, relational, key-value, time-series, and vector search workloads in a single engine, queried via SurrealQL — a SQL-like language with graph traversal, record links, live queries, and schema enforcement built in.
Key Capabilities
Multi-model in one engine — A single SurrealDB instance handles relational queries, graph traversal, document storage, key-value access, time-series, and vector similarity search. You do not need a separate graph DB, search engine, or cache alongside it.
SurrealQL — SQL with graph and document extensions — The query language looks like SQL but adds native graph traversal (->, <-), record links (fetch related records inline), SELECT VALUE for flat arrays, FETCH for eager loading of linked records, and LIVE SELECT for real-time streaming. Treating it as plain SQL will produce incorrect queries.
RELATE for graph edges — The RELATE statement creates a typed edge record between two nodes. Edges are stored in their own table with in and out fields, can carry arbitrary data, and support bidirectional traversal natively. This replaces JOIN tables and foreign keys for connected data.
Live queries over WebSocket — LIVE SELECT and the SDK .live() method push change notifications (CREATE, UPDATE, DELETE) to subscribers in real time. The underlying transport must be WebSocket; HTTP connections do not support live queries.