My brother and I have just π launched our scalable cloud graph database SurrealDB in public open beta. We've been working on it for 7 years now, and it's completely free to use. We wanted to create a database that allowed developers to focus on building frontend applications, and not worrying about the backend infrastructure.
SurrealDB is a newsql multi-model database, that operates in schemafull or schemaless mode, with tables, inter-document record links (no JOINs), and graphdatabase modelling functionality. You can query it from the backend, or from frontend applications (Chrome, Firefox, Safari, Electron, Tauri) with javascript, with in-built permissions and authentication.
Database, API, and permissions
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.
Multi-model database
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.
Inter-document links
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
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.
Connect from the browser
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.
Flexible querying
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.
Realtime live queries
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
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.
Embedded functions
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.
Embedded or distributed
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, the system requirements have been specifically thought through for running in all types of environment.
Quick look...
Set granular π permissions to ensure that only the right people can π see the right data.
Aggregate views let you pre-compute π analytics queries as data is written to SurrealDB in an efficient and performant way. No more π₯΄ complicated queries for dashboard analytics.
Any feedback/users/testers appreciated
We're really pleased with where we've got to so far, but we have such a long journey to go!
We are looking for as much feedback, suggestions, contributors, or advice as possible from this awesome community! π SurrealDB
Top comments (19)
This looks really cool!!!
Do I see correctly that the database is totally written from scratch in Rust?
The query syntax looks pretty elegant to me!
A killer feature would be a declarative schema management for me.
Thank you very much @peteole! Absolutely! Written entirely in Rust from scratch. We have a schema definition language and schema migration/updating functionality on our roadmap!
I was looking for something exactly like this for a long time! I have a feeling there was much too little going on in the database market for the last years and a rewrite from scratch that fixes the historical issues of sql seems like the right thing we need!
We have some really big things planned for SurrealDB and there is a lot of stuff on our roadmap. It is great to have you on the journey with us. Thank you very much for your kind words @peteole!
I imagine that. Do you also plan typesafe client libraries generated from the database schema like edgedb? Maybe it's even possible to combine a vscode extension with some typescript magic to generate response types on the fly as well as syntax highlighting (or even intellisense?) in the parameters for the query. For SQL there is sqlx doing something like that and I believe it would be really cool if you could support it natively. But I can imagine there are lots of other cool things that can be added as well :)
Hi @peteole, absolutely! We have a GraphQL implementation with schema definition support on the roadmap. Syntax highlighting for SurrealQL is planned for Atom, Vscode, Sublime Text, and Codemirror. Thatβs actually a really good idea to support native compile-time parsing of SurrealQL code. This is absolutely something we can do with the SurrealDB Rust library. Are you a Rust user?
I've recently worked a bit with rust. What's a bit of an issue with the compile time parsing of SurrealQL code is that you have to somehow feed the database schema to the compiler. In sqlx it is sometimes a bit annoying that initial builds fail when opening the project since the dev database the schema is fetched from is not yet running. Maybe one could directly fetch the database schema from a declarative schema definition file? In SQL it is not that simple since you have a huge list of migrations to parse, but maybe if you define the database schema with something like graphql types it could work...
Absolutely @peteole, and thatβs where the GraphQL schema comes in. I like the idea of SQLX, but I donβt like the idea of having to connect to a remote service in order to compile the code fully. A schema declaration file should sit in your project, and enable the code to compile. This is a great idea!
Honestly the coolest thing since i discovered coding, I'm actually astouned how excited it got about it.
I have one of those evil laugh powerful momemts of my career where i just felt i gain the power of a god or the like.
Im big on tooling and cant wait to make amazing tooling around SurrealDB to make it even easier to solve complex problems.
Big shoutout, well done guys!
Thank you very much for the kind words Simon! We hope you enjoy SurrealDB!
I definitely prefer GraphQL with a GUI! A single endpoint to "rull them all" and the benefits are countless... Look how far Hasura has come using GraphQL as their main service! SurrealDB can go even further.
Thank you very much DODANEX!
As a first set of feedback running the first query from the docs using docker
results in
I'm pretty sure this should be fixable with a tiny bit of thinking, but it would be nice if the first example "just worked" :)
Hi @peteole ! Did you start the server with
--user root
and--pass root
arguments (to set the root username and password? Then the--user "root:root"
curl argument will authenticate with this username and password.There is also a new
surreal sql
command which starts a REPL, which is much easier to use than the curl command (we'll update the documentation soon using this REPL, but in the meantime you can see how to use the tool here: surrealdb.com/docs/cli/sql).We've got many improvements coming to the docs very soon, and all feedback is extremely useful, so thank you!
Nope, I was just copying the command from the website:)
Hi @peteole at the top of the page under the 'Start the server' section it should give the arguments for starting the server with a default root user.
As mentioned above, we have many improvements coming to the docs soon, so thank you for the feedback β ! Also, in the meantime, if you notice anything else, or have trouble understanding anything at all, just let us know on here or any of our other community platforms π!
This should do there trick:
Why can't I select text on your site?
Hi @greenhatman I think that's CSS that is causing that. You should be able to select the code in the code blocks though. Are there other bits of text that you want to select?