npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@owujib/sabi-orm

v0.0.5

Published

Active Record ORM for the Sabi framework

Readme

@owujib/sabi-orm

Active Record ORM for the Sabi framework — Postgres, MySQL, and SQLite, with migrations, seeders, and a CLI. No query builders, no repositories: you query, create, and persist records through static and instance methods on the model class itself.

Install

npm install @owujib/sabi-orm pg    # or mysql2 / better-sqlite3

Supported drivers: postgres, mysql, sqlite. Install the matching driver package alongside @owujib/sabi-orm — that's the only place a database-specific package name shows up.

Setup

// src/sabi-orm.config.ts
import type { SabiOrmConfig } from '@owujib/sabi-orm';

const config: SabiOrmConfig = {
  driver: 'postgres',
  connection: {
    host: process.env.DB_HOST ?? 'localhost',
    port: Number(process.env.DB_PORT ?? 5432),
    database: process.env.DB_NAME ?? 'app',
    user: process.env.DB_USER ?? 'root',
    password: process.env.DB_PASSWORD ?? '',
  },
  pool: { min: 2, max: 10 },
  migrations: { directory: './src/database/migrations' },
  seeds: { directory: './src/seeds' },
};

export default config;
// src/app/Providers/DatabaseServiceProvider.ts
import { ServiceProvider } from '@owujib/sabi';
import { DatabaseServiceProvider as OrmProvider } from '@owujib/sabi-orm';
import config from '../../sabi-orm.config';

export class DatabaseServiceProvider extends ServiceProvider {
  private ormProvider = new OrmProvider(this.app, config);

  register(): void {
    this.ormProvider.register();
  }

  boot(): void {
    this.ormProvider.boot();
  }
}

Models

import { BaseModel } from '@owujib/sabi-orm';

export class User extends BaseModel {
  static tableName = 'users';

  id!: number;
  email!: string;
  created_at!: Date;
  updated_at!: Date;
}
const user = await User.find(1);
const users = await User.all();
const created = await User.create({ email: '[email protected]' });

created.email = '[email protected]';
await created.save();
await created.delete();

await User.transaction(async () => {
  await User.create({ email: '[email protected]' });
});

Migrations

// src/database/migrations/20240101_create_users_table.ts
import type { Schema } from '@owujib/sabi-orm';

export async function up(schema: Schema) {
  await schema.createTable('users', (table) => {
    table.increments('id');
    table.string('email').notNullable().unique();
    table.timestamps(true, true);
  });
}

export async function down(schema: Schema) {
  await schema.dropTable('users');
}

Seeders

// src/seeds/users_seed.ts
import type { Db } from '@owujib/sabi-orm';

export async function seed(db: Db) {
  await db('users').insert({ email: '[email protected]' });
}

CLI

npx sabi-orm --config ./src/sabi-orm.config.ts migrate
npx sabi-orm --config ./src/sabi-orm.config.ts migrate:rollback
npx sabi-orm --config ./src/sabi-orm.config.ts migrate:make <name>
npx sabi-orm --config ./src/sabi-orm.config.ts seed
npx sabi-orm --config ./src/sabi-orm.config.ts seed:make <name>

A project scaffolded with npx @owujib/sabi new already wires these up as npm run migrate, npm run migrate:make -- <name>, npm run seed, etc.

License

ISC