Skip to content

selori/scyllinx

Repository files navigation

ScyllinX Logo

ScyllinX

A TypeScript ORM for ScyllaDB and SQL databases inspired by Laravel Eloquent

NPM Version MIT License TypeScript Node.js

🚀 Quick Start📖 Documentation🤝 Contributing

✨ Overview

ScyllinX is a modern Object-Relational Mapper (ORM) written in TypeScript, designed to provide a simple, expressive, and fluent API for working with databases. Inspired by Laravel Eloquent, it brings familiar Active Record patterns to Node.js while offering compatibility with both ScyllaDB (Cassandra-compatible) and traditional SQL databases.

🔥 Key Features

  • Active Record Syntax – Define models and interact with them directly
  • ScyllaDB-first design with SQL compatibility (SQLite, PostgreSQL, MySQL)
  • 🔗 Rich relationship systemhasOne, hasMany, belongsTo, belongsToMany, and more
  • 🔍 Type-safe Query Builder with full IntelliSense support
  • 🧠 Model lifecycle hooks, casting, and validation
  • 📄 Automatic API Documentation using JSDoc + VitePress
  • 💡 Composable schema definitions and decorators for cleaner models
  • 🧪 Built-in testing support with Jest

📦 Installation

pnpm add scyllinx
# or
npm install scyllinx
# or
yarn add scyllinx

🧪 Supported Databases

Database Status Driver
ScyllaDB/Cassandra 🧪 Beta cassandra-driver
SQLite 🧪 Beta better-sqlite3
PostgreSQL 🧪 Beta pg
MySQL 🧪 Beta mysql2
MongoDB 🧪 Beta mongodb

🚀 Quick Start

1. Configure Database Connection

import { ConnectionManager } from 'scyllinx';
import { databaseConfig } from './config/database';

const connectionManager = ConnectionManager.getInstance();
await connectionManager.initialize(databaseConfig);

connectionManager.getConnection().connect();

2. Define Models

import { Model, HasMany } from 'scyllinx';
import { Post } from './models/Post'

interface UserAttributes {
  id: string;
  name: string;
  email: string;
  created_at?: Date;
  updated_at?: Date;
  // Relationships attributes
  posts?: Post[]
}

class User extends Model<UserAttributes> {
  protected static table = 'users';
  protected static primaryKey = 'id';
  protected static fillable = ['name', 'email'];
  protected static timestamps = true;

  // Define relationships
  postsRelation(): HasMany<User, Post> {
    return this.hasMany(Post, 'user_id');
  }
}

// Declaration Merging IMPORTANT
interface User extends UserAttributes {}

export { User, UserAttributes }

3. Create and Query Models

// Create a new user
const user = await User.create({
  name: 'John Doe',
  email: 'john@example.com'
});

// Find a user
const foundUser = await User.find('user-id');

// Query with conditions
const activeUsers = await User.query()
  .where('active', true)
  .orderBy('created_at', 'desc')
  .limit(10)
  .get();

// Update a user
await user.update({ name: 'Jane Doe' });

// Delete a user
await user.delete();

📄 Documentation

📘 Full documentation is available at: https://selori.github.io/scyllinx

👨‍💻 Contributing

We welcome contributions of all kinds!

🧷 Guidelines:

  1. Fork and clone the repository
  2. Use pnpm to install dependencies
  3. Use conventional commits (e.g., feat:, fix:)
  4. Run pnpm lint && pnpm test before submitting a PR
  5. Update documentation if applicable

Please see our Contributing Guide for details.

📜 License

MIT © ScyllinX Team – 2025 See LICENSE for full license text.

Developed with ❤️ for modern TypeScript applications

About

A modern TypeScript ORM for ScyllaDB and SQL databases with Laravel-inspired syntax

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published