SurrealDB logo

SurrealDB is the ultimate cloud database for tomorrow's applications

Develop easier.Build faster.Scale quicker.

With an SQL-style query language, real-time queries with highly-efficient related data retrieval, advanced security permissions for multi-tenant access, and support for performant analytical workloads, SurrealDB is the next generation serverless database.

View our roadmap
Get started

Why SurrealDB?

SurrealDB is an innovative NewSQL cloud database, suitable for serverless applications, jamstack applications, single-page applications, and traditional applications. It is unmatched in its versatility and financial value, with the ability for deployment on cloud, on-premise, embedded, and edge computing environments. For a hassle-free setup, get started with SurrealDB Cloud in one-click.

Jamstack apps
Serverless apps

tick

Develop easier

There is no need for your team to learn new complicated database languages. Getting started with SurrealDB is as simple as one command - and advanced functionality is simple to understand, whilst still being fast and performant.

tick

Build faster

SurrealDB simplifies your database and API stack, removing the need for most server-side components. As a web database, client-side applications can be built with direct connections to SurrealDB, while traditional server-side development techniques can still leverage the powerful but simple querying and analytics abilities.

tick

Scale quicker

Forget about scaling databases, servers, loadbalancers, and API endpoints. SurrealDB takes the hassle out of your stack, enabling you to grow and operate at scale with a highly-available, highly-scalable distributed platform. Deploy anywhere, or keep it simple with SurrealDB Cloud.

A highly-scalable NewSQL database

SurrealDB is a flexible, developer-friendly, fully ACID transactional, realtime document-graph web database for serverless applications. Never again worry about database provisioning, scaling, sharding, replication, or correctness.

tick

Document & graph database

tick

JOIN-less deep fetching

tick

Distributed ACID transactions

tick

Built with Rust

tick

Structured and un-structured data

tick

SQL-style querying

tick

GraphQL and REST API

tick

Support for multi-tenant apps

tick

Multi-row, multi-table transactions

tick

Online and offline data sync

tick

In-built access and permissions

tick

Multi-column and full-text indexes

tick

Incrementally computed views

tick

Distributed and highly-scalable

tick

No complex back-end servers and APIs

Improved data modelling

SurrealDB doesn't force you into setting up your data model in any one way. Instead you can choose between simple documents, documents with embedded fields, or related graph connections between records. Use schemafull or schemaless tables giving you the flexibility to store whatever you need.

Once stored in SurrealDB, all data is strongly typed, with the ability to convert between different types seamlessly - and numbers can be stored and computed with 64 bit precision or as arbritrary length decimals.

Get started with SurrealDB
-- Create a 'user' record
CREATE user SET
	age = <int> 34,
	enabled = true,
	-- Store the current time
	created_at = time::now(),
	-- Specify embedded fields
	name.first = "Tobie",
	name.last = "Morgan Hitchcock",
	-- Add a field which is computed from other fields
	name.full = <string> string::join(' ', name.first, name.last),
	-- Add an array whose values point to other remote records
	friends = [user:gna732gnajan74hj, user:gna732gnajan74hj],
;
-- Select all users and fetch the users' friends' names
SELECT *, friends.*.name.full AS friends FROM user;

-- Set a variable to be used in subsequent statements
LET $tobie = (SELECT * FROM user WHERE name.first = "Tobie");

-- Select all users with complex graph traversal
SELECT *,
	-- Select all users who like this user
	<-like<-user AS friends,
	-- Select all products which friends have purchased
	<-like<-user->purchase->product AS recommended
	-- Only look at the single user selected above
	FROM $tobie
;

Powerful querying abilities

The primary method of querying SurrealDB is using SurrealQL, a similar but modified version of traditional SQL. SurrealQL enables linked documents to be traversed and queried efficiently, while still using an imperative language which remains understandable by data scientists.

With an innovative, but simple-to-understand, SQL language developers or data scientists can use a myriad of different techniques to store, query, and analyse the data in SurrealDB.

Get started with SurrealDB

Simplified data analytics

SurrealDB is designed to be quick to setup, and even quicker to implement. Multi-column indexes can be easily added and removed as your application evolves, allowing for strongly consistent reads and writes, and highly-performant reads.

Pre-computed table views allow superfast and highly-efficient aggregated data for queries which are known upfront - with simple view definition as easy as writing an SQL statement.

Get started with SurrealDB
-- Add a new 'user' record with some basic attributes
CREATE user SET
	age = 34,
	gender = 'm',
	name = 'Tobie Morgan Hitchcock'
;

-- Define a table which aggregates data from another table
DEFINE TABLE users_by_gender
	AS
		SELECT
			gender,
			count() AS total,
			math::mean(age) AS average_age
		FROM user
		GROUP BY gender
;
-- Specify access permissions for the 'post' table
DEFINE TABLE post SCHEMALESS
	PERMISSIONS
		FOR select
			-- Published posts can be selected
			WHERE published = true
			-- A user can select all their own posts
			OR user = $auth.id
		FOR create, update
			-- A user can create or update their own posts
			WHERE user = $auth.id
		FOR delete
			-- A user can delete their own posts
			WHERE user = $auth.id
			-- Or an admin can delete any posts
			OR $auth.admin = true
;

Faster app development times

WIth permissions in-built from the ground up, SurrealDB is the perfect web-database for serverless applications. Easily specify permissions with easy-to-write SQL statements, ensuring that only the correct users can access the specified data that they have permission to select or modify.

With support for SSL/TLS, Single-Sign-On, external 3rd party authentication, JWT token based authentication, and custom business authentication logic - SurrealDB offers strong security, with the flexibility of custom authentication methods that suit your app or business.

Get started with SurrealDB

Superpowered database functionality

When connecting with SurrealDB, all connections are made using WebSockets, allowing for bi-directional data syncing. Dependent on data access permissions, client-based document subscriptions are triggered in real-time whenever changes are made to the data.

Data subscriptions can be specified for whole tables, filtered result sets, or individual records - enabling a multitude of different use-cases in all types of applications.

Get started with SurrealDB
-- Subscribe to all changes to documents which match
LIVE SELECT * FROM document
	WHERE
		account = $auth.account
		OR public = true
;

-- Subscribe to all changes to a single 'post' record
LIVE SELECT * FROM post:c569rth77ad48tc6s3ig;

-- Stop receiving change notifications
KILL "1986cc4e-340a-467d-9290-de81583267a2";

Database libraries and clients

SurrealDB builds and maintains first-party database clients for a number of popular languages including Javascript, Typescript, Node.js, Deno, Rust, and Golang. All clients connect to SurrealDB using a binary protocol over a WebSocket connection for low-latency and efficient parsing, leading to blazingly fast queries.

Javascript Complete

npm install surrealdb
Github Documentation

Golang Complete

go get github.com/surrealdb/surreal.go
Github Documentation

Python Coming soon

pip install surrealdb
Github Documentation

Rust Coming soon

cargo install surrealdb
Github Documentation

Node.js Complete

npm install surrealdb
Github Documentation

Deno Coming soon

import * as surreal from "https://deno.land/x/surrealdb/mod.ts";
Github Documentation

Javascript framework connectors

In addition to the client libraries for the popular languages, SurrealDB maintains database client connectors for some of the popular Javascript frameworks, including Angular.js, and Ember.js. These connectors support real-time data asubscriptions and notifications using a binary protocol over a WebSocket connection, enabling advanced application functionality and awesome performance.

Ember.js Complete

ember install ember-surreal
Github Documentation

Angular.js Coming soon

npm install angular-surreal
Github Documentation

React.js Complete

npm install surrealdb
Github Documentation

Vue.js Complete

npm install surrealdb
Github Documentation