SurrealDB Docs Logo

Enter a search query

Concepts

This page aims to give details about some of the core concepts of SurrealDB, including the intended usecases, design choices, and overarching features.

Traditional database or backend layer

SurrealDB can be used either as a traditional database platform, with backend languages and frameworks including Golang, Python, Rust, C, Java, .Net, Node.js, and PHP. Alternatively, you can use SurrealDB as a complete backend platform, connecting directly to it from frontend languages and frameworks including JavaScript, WebAssembly, React.js, Next.js, and Ember.js. In this mode, permissions can be defined on a table, record, and field level, allow for granular data access patterns for multiple different types of users.

Relational, document, or graph

SurrealDB is, at its core, a document database. Each record is stored on an underlying key-value store storage engine, with the ability to store arbitrary arrays, objects, and many other types of data. However, SurrealDB isn’t just a document database. Because of the way that SurrealDB handles Record IDs and the fetching of individual records from the underlying key-value storage engine, it can be used to store time-series ordered data, and highly-connected graph data. With the addition of an SQL-like query language (named SurrealQL), it is easy to create, update, and read data from across the database.

Single-node or distributed

SurrealDB is designed to be run in many different ways, and environments. Due to the separation of the storage and compute layers, SurrealDB can be run in embedded mode, as a vertically-scalable, single-node database server, or as a horizontally-scalable, multi-node, distributed cluster. In embedded mode, SurrealDB can be run with an in-memory storage engine, in a web browser it can persist data using IndexedDB, or it can persist data using the file-based RocksDB storage engine. As a database server, SurrealDB can currently be configured to store data using RocksDB, TiKV, or FoundationDB.

System structure

SurrealDB works similarly to other traditional relational databases, and document databases, with a few slight differences. SurrealDB is designed and developed to be a multi-tenant database platform with a high-level namespace layer designed as a separation for each organisations, department, or development team. There is no limit to the number of namespaces on SurrealDB. Below this, the databases layer is similar to databases in other database management systems. There is no limit to the number of databases on each namespace. Within each database, data can be stored within table definitions, otherwise known as collections in other database management systems. In SurrealDB each row or document is called a record and columns are called fields. While you can define:

You cannot define records, you can only create, read, update and delete them.

Multiple access methods can be defined on namespace and database. The record access method allows for custom authentication across tables, records, and fields.

© SurrealDB GitHub Discord Community Cloud Features Releases Install