# SurrealDB

> A multi-model database that unifies documents, graphs, vectors, time-series, and relational data in one ACID transaction — the context layer for AI agents.

SurrealDB is a multi-model database built in Rust that combines document, graph, relational, time-series, geospatial, and vector data models into a single engine with one query language (SurrealQL). It is developed by SurrealDB Ltd., registered in England and Wales, and is available as a managed cloud service, self-hosted binary, embedded library, or WebAssembly module running in the browser.

## What It Is

SurrealDB positions itself as the "context layer for AI agents" — a unified database infrastructure where storage, context, and memory live in a single ACID transaction. Rather than stitching together a vector database, a graph database, a document store, and a separate memory middleware, SurrealDB provides all of these as native primitives in one engine. Its query language, SurrealQL, extends SQL with graph traversals, record links, vector operations, full-text search, and built-in authentication, so developers can express complex multi-model queries in a single round trip.

## Core Architecture

The platform is organized into three layers:

- **Spectron** — persistent agent memory with entity extraction, knowledge graphs, temporal facts, and hybrid retrieval, built into SurrealDB rather than bolted on top.
- **SurrealDB** — the multi-model context engine supporting documents, graphs, vectors, time-series, full-text, and relational data in one ACID transaction with built-in auth, permissions, live queries, event triggers, and custom API endpoints.
- **SurrealDS** — a distributed storage layer with quorum consensus, compute-storage separation, and support for object storage backends (S3, GCS, Azure Blob), enabling horizontal scale and high availability.

## Key Capabilities

- **Multi-model queries**: Graph traversal, vector similarity (HNSW with cosine, euclidean, manhattan), full-text search (BM25), and hybrid search (reciprocal rank fusion) can all be combined in a single SurrealQL statement.
- **ACID transactions**: Multi-row, multi-table transactions across all data models with no partial writes.
- **Built-in auth and permissions**: Record-level access control, table-level permissions, field-level security, and third-party JWT/OAuth support are defined directly in the schema — no sidecar auth service required.
- **Live queries**: Real-time push notifications to connected clients as data commits, with no polling or message broker needed.
- **Extensibility**: Custom functions in SurrealQL or JavaScript, and WebAssembly plugins compiled from Rust for near-native performance in a sandboxed environment.
- **Deployment flexibility**: Runs as a single binary on macOS, Linux, and Windows; as a Docker container; embedded in Python and JavaScript runtimes; via WebAssembly in the browser; or as a distributed cluster with a Kubernetes operator and Helm charts.
- **SDKs**: Official SDKs for Rust, JavaScript/TypeScript, Python, Go, Java, .NET, PHP, and C, with client-side support for React, Next.js, Vue, Svelte, Angular, and SolidJS.

## Deployment and Licensing

The core SurrealDB database is released under the Business Source License 1.1 (BSL 1.1), which permits non-production use freely and converts to Apache License 2.0 on 2030-01-01. SDKs and client libraries are released under Apache 2.0 or MIT. The BSL license means the core engine is source-available but not OSI-approved open source. SurrealDB Cloud runs on AWS and offers a managed "Start" tier with usage-based compute pricing, a "Scale" tier for fault-tolerant production workloads (waitlist), and an "Enterprise" tier for self-hosted or private cloud deployments with custom pricing.

## Update: SurrealDB 3.x

The latest stable release series is 3.x, with v3.0.5 published on 2026-03-27. The SurrealDB site publishes benchmark results comparing 3.x against 2.x across CRUD operations, batch writes, full-table scans, and indexed queries, measured using the open-source crud-bench harness. The 3.x series introduced the SurrealDS distributed storage engine, Spectron agent memory, WebAssembly plugin support, and the Model Context Protocol (MCP) integration for connecting AI tools like Cursor, VS Code, and Claude directly to the database. The GitHub repository shows 32,300+ stars and active development with the main branch receiving regular pushes.

## Compliance and Security

SurrealDB holds SOC 2 Type II, ISO 27001, GDPR, CCPA, and Cyber Essentials Plus certifications. Enterprise features include FIPS-compliant cryptography, encryption at rest, security audit logging with streaming to S3/CloudWatch/Datadog/Splunk, trusted execution environments, and priority security patching ahead of the open-source release cycle.

## Features
- Multi-model database: documents, graphs, vectors, time-series, relational in one engine
- SurrealQL query language with graph traversal, vector search, and full-text search
- ACID transactions across multiple rows and tables
- HNSW vector indexing with cosine, euclidean, and manhattan distance metrics
- Hybrid search combining BM25 full-text and vector similarity via reciprocal rank fusion
- Live queries with real-time push notifications to connected clients
- Built-in authentication and row-level permissions defined in schema
- Spectron agent memory with entity extraction, knowledge graphs, and temporal facts
- WebAssembly plugin support for custom extensions compiled from Rust
- Custom JavaScript functions embedded in queries
- GraphQL schema auto-generation and querying
- REST API and WebSocket protocol support
- Custom HTTP API endpoints defined in SurrealQL
- Table events and asynchronous event triggers
- Aggregate indexed views for pre-computed analytics
- Geospatial data types and operators (GeoJSON)
- Versioned temporal tables (experimental)
- SurrealML: import and run PyTorch, TensorFlow, and Sklearn models inside the database
- File storage buckets with S3, GCS, and Azure Blob backends
- Model Context Protocol (MCP) integration for AI tools
- LangChain integration
- Embedded deployment in Python, JavaScript, WebAssembly, and browser
- Single binary with no external runtime dependencies
- Kubernetes operator and Helm charts
- Docker container support
- SOC 2 Type II, ISO 27001, GDPR, Cyber Essentials Plus compliance
- FIPS-compliant cryptography (Enterprise)
- Distributed live queries across multi-node clusters (Enterprise)
- Surrealist visual UI for data exploration and graph visualization

## Integrations
JavaScript / TypeScript, Python, Rust, Go, Java, .NET, PHP, C, React, Next.js, Vue.js, Angular, Svelte, SolidJS, WebAssembly, Docker, Kubernetes, Helm, LangChain, Cursor (MCP), VS Code (MCP), Claude (MCP), AWS S3, Google Cloud Storage, Azure Blob Storage, PyTorch, TensorFlow, Scikit-learn (Sklearn), OpenTelemetry, Datadog, Splunk, CloudWatch, Auth0 (JWT/OAuth)

## Platforms
WINDOWS, MACOS, LINUX, WEB, API, VSC_EXTENSION, DEVELOPER_SDK, CLI

## Pricing
Freemium — Free tier available with paid upgrades

## Version
v3.0.5

## Links
- Website: https://surrealdb.com
- Documentation: https://surrealdb.com/docs
- Repository: https://github.com/surrealdb/surrealdb
- EveryDev.ai: https://www.everydev.ai/tools/surrealdb
