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 system – hasOne, 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

2 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors