Skip to content

Necmttn/surql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@necmttn/surql-gen Monorepo

A comprehensive SurrealDB schema management toolkit with Effect.js integration.

📦 Packages

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

🚀 Apps

Dogfooding App (Coming Soon)

Real-world application built with @necmttn/surql-schema to validate the library design and user experience.

🛠 Development

# 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

📖 Quick Start

# 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());

🎯 Learning Path

Follow the progressive examples in the main package:

  1. Level 1: Basic Usage - Schema.Class fundamentals
  2. Level 2: Composition - Schema.pipe patterns
  3. Level 3: Annotations - Metadata and documentation
  4. Level 4: Advanced - Validation and migrations
  5. Level 5: Real-World - Complete applications

🌟 Key Features

  • 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

📚 Documentation

🤝 Contributing

We welcome contributions! The monorepo structure makes it easy to:

  1. Improve the core library in packages/surql-gen/
  2. Add new examples to demonstrate patterns
  3. Build applications that showcase the library capabilities
  4. Enhance documentation and learning resources

📄 License

MIT - See LICENSE for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors