6

SurrealDB | The ultimate database for tomorrow's applications

 1 year ago
source link: https://surrealdb.com/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

The ultimate database for tomorrow's applicationsSurrealDB logo

SurrealDB is the ultimate multi-model 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.

Why use SurrealDB?

SurrealDB is an innovative NewSQL cloud database designed for serverless applications, Jamstack applications, single-page applications, and traditional applications alike. Its unmatched versatility and exceptional cost-effectiveness make it suitable for deployment in the cloud, on-premise, in embedded systems, and in edge computing environments. For a quick start, check out our getting started guide!

tick-a3e79715894a5e7d6793a1f38a424c44.svg 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-a3e79715894a5e7d6793a1f38a424c44.svg 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-a3e79715894a5e7d6793a1f38a424c44.svg 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.

database-api-security-30f3a965e4b86f9b9e24278a6835b41d.png

Database, realtime API layer, and security permissions all-in-one

SurrealDB combines the database layer, the querying layer, and the API and authentication layer into one platform. Advanced table-based and row-based customisable access permissions allow for granular data access patterns for different types of users. There's no need for custom backend code and security rules with complicated database development.

Tables, documents, and graph. Store and model your data in any way

As a multi-model database, SurrealDB enables developers to use multiple techniques to store and model data, without having to choose a method in advance. With the use of tables, SurrealDB has similarities with relational databases, but with the added functionality and flexibility of advanced nested fields and arrays. Inter-document record links allow for simple to understand and highly-performant related queries without the use of JOINs, eliminating the N+1 query problem.

multimodel-database-80c3f15beb93c28361af90b838238dd7.png
graph-database-c3cb6f8143e5d56a474b5b636dd52b94.png

Advanced inter-document relations and analysis. No JOINs. No pain.

With full graph database functionality, SurrealDB enables more advanced querying and analysis. Records (or vertices) can be connected to one another with edges, each with its own record properties and metadata. Simple extensions to traditional SQL queries allow for multi-table, multi-depth document retrieval, efficiently in the database, without the use of complicated JOINs and without bringing the data down to the client.

Simple schema definition for frontend and backend development

With SurrealDB, specify your database and API schema in one place, and define column rules and constraints just once. Once a schema is defined, database access is automatically granted to the relevant users. No more custom API code, and no more GraphQL integration. Simple, flexible, and ready for production in minutes, not months.

schema-direct-to-client-b62d646b4c624da630d3489f00c214d1.png
browser-sync-80af8f64d14ad325ef439e1f125604a4.png

Connect and query directly from web-browsers and client devices

Connect directly to SurrealDB from any end-user client device. Run SurrealQL queries directly within web-browsers, ensuring that users can only view or modify the data that they are allowed to access. Highly-performant WebSocket connections allow for efficient bi-directional queries, responses and notifications.

Query the database with the tools you want. Your data, your choice.

SurrealDB is designed to be flexible to use, with support for SurrealQL, GraphQL (coming soon), CRUD support over REST, and JSON-RPC querying and modification over WebSockets. With direct-to-client connection with in-built permissions, SurrealDB speeds up the development process, and fits in seamlessly into any tech stack.

multiple-integrations-00037b0e32441c612cd272105ef75b1c.png
realtime-live-queries-35311f790d6599f9b7f2b6968edc387b.png

Realtime live queries and data changes direct to application

SurrealDB keeps every client device in-sync with data modifications pushed in realtime to the clients, applications, end-user devices, and server-side libraries. Live SQL queries allow for advanced filtering of the changes to which a client subscribes, and efficient data formats, including DIFFing and PATCHing enable highly-performant web-based data syncing.

Scale effortlessly to hundreds of nodes for high-availability and scalability

SurrealDB can be run as a single in-memory node, or as part of a distributed cluster - offering highly-available and highly-scalable system characteristics. Designed from the ground up to run in a distributed environment, SurrealDB makes use of special techniques when handling multi-table transactions, and document record IDs - with no use of table or row locks.

scale-up-b019363d5b449895c37c89f8b8e12837.png
database-plugins-64c1b0dc2512d3eceecc5eea657e516e.png

Extend your database with JavaScript and WebAssembly functions

Embedded JavaScript functions allow for advanced, custom functionality, with computation logic being moved to the data layer. This improves upon the traditional approach of moving data to the client devices before applying any computation logic, ensuring that only the necessary data is transferred remotely. These advanced JavaScript functions, with support for the ES2020 standard, allow any developer to analyse the data in ever more simple-yet-advanced ways.

Designed to be embedded or to run distributed in the cloud

Built entirely in Rust as a single library, SurrealDB is designed to be used as both an embedded database library with advanced querying functionality, and as a database server which can operate in a distributed cluster. With low memory usage and cpu requirements, SurrealDB has been specifically designed to run in all types of environment.

cloud-or-embedded-fdf2ee1800597055670fd9f80f84358a.png

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-a3e79715894a5e7d6793a1f38a424c44.svg

Document & graph database

tick-a3e79715894a5e7d6793a1f38a424c44.svg

JOIN-less deep fetching

tick-a3e79715894a5e7d6793a1f38a424c44.svg

Distributed ACID transactions

tick-a3e79715894a5e7d6793a1f38a424c44.svg

Built with Rust

tick-a3e79715894a5e7d6793a1f38a424c44.svg

Structured and un-structured data

tick-a3e79715894a5e7d6793a1f38a424c44.svg

SQL-style querying

tick-a3e79715894a5e7d6793a1f38a424c44.svg

GraphQL and REST API

tick-a3e79715894a5e7d6793a1f38a424c44.svg

Support for multi-tenant apps

tick-a3e79715894a5e7d6793a1f38a424c44.svg

Multi-row, multi-table transactions

tick-a3e79715894a5e7d6793a1f38a424c44.svg

Online and offline data sync

tick-a3e79715894a5e7d6793a1f38a424c44.svg

In-built access and permissions

tick-a3e79715894a5e7d6793a1f38a424c44.svg

Multi-column and full-text indexes

tick-a3e79715894a5e7d6793a1f38a424c44.svg

Incrementally computed views

tick-a3e79715894a5e7d6793a1f38a424c44.svg

Distributed and highly-scalable

tick-a3e79715894a5e7d6793a1f38a424c44.svg

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 arbitrary length decimals.

-- 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.

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.

-- 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.

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.

-- 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";

We are building SurrealDB for everyone

SurrealDB is being built in the open. We would love for you to be involved.

     

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.

Product

Documentation

Why

Install

Features

Releases

Roadmap

  Status

Community

GitHub

Discord

Twitter

YouTube

LinkedIn

Reddit

Instagram

Stack Overflow

Threads

Medium

Dev

Legal

Privacy policy

Cookies policy

Security policy

License FAQs

security.txt

About

About us

Careers

Community

Open source

Blog

Media

Store

SurrealDB logopoweredby-surrealdb-light

Copyright © SurrealDB Ltd.
Registered in England and Wales, no. 13615201
Registered address: Huckletree Oxford Circus, 213 Oxford Street, London, W1D 2LG


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK