repobenchmarks // next-gen databases
DEVELOPER TOOLS
$ surreal start --user root --pass root file:mydatabase.db

SurrealDB Multi-Model Engine

A database written in Rust that merges relational tables, JSON documents, graph relations, and realtime subscriptions into a unified SurrealQL query language.

Engine: Rust (Embedded or Distributed) Query Language: SurrealQL Stars: >27,000
SurrealQL Graph Traversal: SELECT ->purchased->product.* FROM user:tobie; Zero foreign key JOIN overhead

Modern application architectures often end up with sprawling database sprawl: PostgreSQL for relational data, MongoDB for JSON documents, Neo4j for social graphs, and Redis for pub/sub real-time events. Maintaining four different database backends creates high DevOps complexity. SurrealDB consolidates these capabilities into a single multi-model engine written in Rust.

Key Architectural Innovations

  • Graph Relations Without Foreign Keys: Link records using first-class directional pointers (e.g. RELATE user:123->likes->post:456) and traverse deep relationships in sub-millisecond queries without expensive SQL table joins.
  • Flexible Modes (Embedded to Distributed): Can run in-memory for testing, embedded directly inside a Rust app (like SQLite), or distributed across Kubernetes clusters backed by TiKV.
  • Direct Frontend Connectivity: With built-in authentication and row-level permissions, web and mobile apps can query SurrealDB directly via WebSockets without needing an intermediate backend API layer.

SurrealDB Unified Multi-Model Engine

SurrealDB Unified Engine Shows single Rust core supporting Document, Graph, Relational, and Realtime WebSocket interfaces simultaneously. Document Schemaless JSON Graph Direct Edge Pointers Relational Strict Typed Tables Realtime LIVE SELECT WebSockets

SurrealDB vs Traditional Relational and Document Stores

Feature SurrealDB PostgreSQL MongoDB
Data Models Document + Graph + Relational Relational + JSONB Document Only
Graph Relations Native pointer syntax (`->`) Recursive CTEs / Foreign keys `$lookup` aggregation
Realtime Live Queries Native `LIVE SELECT` streams Requires LISTEN/NOTIFY Change streams (Oplog)
⚠ Storage Engine Gotcha: Memory vs Persistent File

When launching SurrealDB via CLI or Docker, running surreal start without specifying a storage backend will default to an in-memory database (memory). In memory mode, all data is permanently discarded when the process exits or container reboots. To persist your database to disk, always specify a storage file prefix: surreal start --user root --pass root file:/path/to/data.db.

Explore SurrealDB at surrealdb.com or inspect the code on GitHub.