Skip to content
🚀 This documentation is for unreal-orm 1.0.0 alpha which requires SurrealDB 2.0 alpha SDK. For the stable version, see npm.

v1.0.0-alpha.3 – alpha.5

This alpha release marks the first public release of @unreal-orm/cli — a complete CLI toolkit for schema management. It also introduces implicit database support and significant DX improvements.

The new CLI package provides powerful tools for managing your SurrealDB schema:

Terminal window
# Quick start
bunx @unreal-orm/cli init
# Or with other package managers
npx @unreal-orm/cli init
CommandDescription
unreal initInitialize project with connection and sample tables
unreal pullGenerate TypeScript models from database schema
unreal pushApply TypeScript schema to database
unreal diffCompare code vs database schema
unreal mermaidGenerate ERD diagrams
unreal viewInteractive TUI for browsing/editing records
unreal docsOpen documentation
unreal githubOpen GitHub repository

New unreal view command provides a TUI for browsing and editing database records directly from the terminal.

Terminal window
unreal view

Capabilities:

  • Table list with concurrent count fetching
  • Records view with pagination and row selection
  • Record detail view with batch editing
  • Multi-line text editor with cursor movement and optimized rendering
  • Configurable --timeout and --concurrency options

Keyboard shortcuts:

  • ↑/↓ or j/k — Navigate
  • Enter — Select/Edit
  • e — Edit field
  • + — Add field, - — Remove field
  • s — Save changes
  • d — Delete record
  • b or Esc — Go back
  • q — Quit

All CRUD methods now support implicit database connections, reducing boilerplate:

// Before: explicit db required
const users = await User.select(db, { limit: 10 });
const user = await User.create(db, { name: "John" });
// After: implicit db (uses configured default)
const users = await User.select({ limit: 10 });
const user = await User.create({ name: "John" });

The unreal init command is now the primary entry point with improved DX:

  • CLI as dev dependency — Installed automatically for local usage
  • Auto-inject surreal.ts import — Optionally adds import to your app entry point
  • Package manager detection — Supports npm, yarn, pnpm, and bun

CLI reference documentation is now automatically generated from Commander.js definitions:

  • New CLI Reference section in docs sidebar
  • Individual pages for each command with options tables
  • Stays in sync with actual CLI implementation
  • Centralized AST logic — Schema AST, parser, and generator moved from unreal-cli to unreal-orm
  • AST-based DDL generation — Replaced legacy DDL generation with unified AST implementation
  • Shared utilities — CLI now uses schema utilities exported from ORM package
  • ESM fixes — Resolved runtime ESM errors using bun build
  • Consistent release process — Added publish:flow script to both packages
  • Galaxy theme — Added starlight-theme-galaxy plugin for improved docs styling
  • Updated migration guide — Comprehensive CLI tools documentation
  • Fixed banner overflow — Custom CSS fix for theme styling issue

Extra fields (fields not defined in your schema) are now assigned directly to model instances.

// Before
console.log(user.$dynamic.someExtraField);
// After
console.log(user.someExtraField);

The from method now supports surql template literals and raw queries:

import { surql } from "surrealdb";
// Record ID (still works)
const user = await User.from(db, "user:123");
// SurrealQL query (new)
const users = await User.from(db, surql`SELECT * FROM user WHERE age > 18`);
// Raw query string (new)
const users = await User.from(db, { raw: "SELECT * FROM user WHERE active = true" });
PackageVersion
unreal-orm1.0.0-alpha.3 → 1.0.0-alpha.5
@unreal-orm/cli1.0.0-alpha.3 → 1.0.0-alpha.5
  • fix(cli): Update init command to install packages with @latest tag
  • docs: update docs to use @latest tag
  • chore: Switch publish tag from alpha to latest
  • fix(orm): Switch build from bun build to unbuild to fix Node.js ESM resolution errors when using bunx @unreal-orm/cli