NEW

New University Course: SurrealDB for AI Engineers

Start the course

1/3

AUTH

Auth built into the database

Sign in. Record access, JWT and third-party tokens from Auth0 or Clerk, defined in SurrealQL.
Scope. What each user sees, down to the row and the field, checked on every query and live subscription.
One place. Rules live in the schema beside the data they guard, versioned with it and enforced by the engine.

ACCESS CONTROL

Identity and permissions, in the query language

Sign-in logic, token verification and per-row rules live in the schema, versioned with the data and enforced by the engine.

RECORD ACCESS

Users authenticate against your own tables

DEFINE ACCESS account ON DATABASE
TYPE RECORD
SIGNUP (
CREATE user SET
email = $email,
pass = crypto::argon2::generate($pass)
)
SIGNIN (
SELECT * FROM user WHERE
email = $email AND
crypto::argon2::compare(pass, $pass)
);
ROW-LEVEL PERMISSIONS

Rules travel with the data

DEFINE TABLE order PERMISSIONS
FOR select WHERE user = $auth.id
FOR create WHERE $auth.id != NONE;

DEFINE TABLE post SCHEMALESS PERMISSIONS
FOR select WHERE published = true OR user = $auth.id
FOR create, update WHERE user = $auth.id
FOR delete WHERE user = $auth.id OR $auth.admin = true;
FIELD-LEVEL CONTROL

Validate every field

DEFINE FIELD email ON TABLE user
TYPE string
ASSERT string::is_email($value);

DEFINE INDEX email ON TABLE user
FIELDS email UNIQUE;

Auth evaluated where the data lives

One source of truth

Access rules live in the schema beside the data they protect, versioned together.

Enforced in the transaction

The engine checks permissions on every query, live subscription and API call.

One operation

The check and the query are the same operation, with no auth server in between.

THE PLATFORM

Everything an application and its agents know. Five surfaces, one engine.

IN PRODUCTION

Trusted at scale. Samsung, Nvidia, Verizon, Tencent, and Walmart run on SurrealDB.

14,000+

Developers building on SurrealDB Cloud

4M+

Developers building on SurrealDB worldwide

FROM THE TEAMS

SurrealDB gives us a foundation where we can unify semantic search, knowledge graphs, and AI-driven decision making without stitching together multiple systems. Collapsing responsibility into SurrealDB has become our default engineering posture.
Justin Foley

VP of Engineering, Later

GET STARTED

Build auth into your data. Access, permissions and validation in SurrealQL, enforced on every request.