A comprehensive SurrealDB schema management toolkit with Effect.js integration.
Main Package - Modern, type-safe SurrealDB schema management with Effect.js
- 🔧 Code-first schemas with Schema.Class architecture
- 🧩 Schema.pipe composition for reusable constraints
- 📝 Rich annotations for documentation and tooling
- 🚀 Migration support with automated generation
- 🎯 173 comprehensive tests demonstrating all patterns
- 📚 Progressive examples from basic to real-world applications
Legacy Package - Original Deno-based implementation (archived)
- 📜 Historical reference and migration source
- 🦕 Deno runtime with TypeScript
- 🔍 Query parsing and type inference experiments
Dogfooding App (Coming Soon)
Real-world application built with @necmttn/surql-schema to validate the library design and user experience.
# Install dependencies
bun install
# Run all tests
bun test
# Development mode (all packages)
bun dev
# Build all packages
bun build
# Format code
bun format
# Lint code
bun lint# Install the main package
bun add @necmttn/surql-schema
# Create your first schema
import { SurrealField, SurrealTable, SurrealSchema } from '@necmttn/surql-schema';
const userTable = SurrealTable.create("user", [
SurrealField.id("user"),
SurrealField.string("email").unique().description("User email"),
SurrealField.string("name").description("User display name"),
SurrealField.datetime("created_at").default("time::now()"),
]);
const schema = SurrealSchema.create("my_app", "1.0.0")
.addTable(userTable);
// Generate SurrealQL
console.log(schema.toSurrealQL());Follow the progressive examples in the main package:
- Level 1: Basic Usage - Schema.Class fundamentals
- Level 2: Composition - Schema.pipe patterns
- Level 3: Annotations - Metadata and documentation
- Level 4: Advanced - Validation and migrations
- Level 5: Real-World - Complete applications
- Effect.js Integration - Leverages Effect's Schema.Class and pipe patterns
- Type Safety - Compile-time and runtime validation
- Developer Experience - Rich tooling and documentation generation
- Migration Support - Automated schema evolution with rollback
- Performance - Optimized for large schemas and complex relationships
- Real-World Ready - Production patterns for e-commerce, SaaS, and content platforms
We welcome contributions! The monorepo structure makes it easy to:
- Improve the core library in
packages/surql-gen/ - Add new examples to demonstrate patterns
- Build applications that showcase the library capabilities
- Enhance documentation and learning resources
MIT - See LICENSE for details.