SurrealORM Logo

SurrealORM

A TypeScript ORM for SurrealDB with decorators and type safety.

Installation

npm install 
@surrealorm/orm

Quick Start

TypeScript
import { Entity, BaseEntity, Property, SurrealORM } from '@surrealorm/orm';

// Define your entity
@Entity()
class User extends BaseEntity {
  @Property({ unique: true })
  email!: string;

  @Property()
  name!: string;

  @Property()
  age!: number;
}

// Connect to SurrealDB
const orm = new SurrealORM({
  url: 'http://localhost:8000',
  namespace: 'test',
  database: 'test',
  username: 'root',
  password: 'root'
});

// Specify the type of connection or leave blank for root user
await orm.connect("namespace");

// Create a new user
const user = new User();
user.email = 'john@example.com';
user.name = 'John Doe';
user.age = 30;
await orm.create(user);

// Disconnect from SurrealDB
await orm.disconnect();
SurrealORM LogoSurrealORM

A TypeScript ORM for SurrealDB with decorators and type safety.

Resources

© 2025 SurrealORM. All rights reserved.

SurrealORM