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

stabilize-cli

v3.2.0

Published

Command-line interface for Stabilize ORM — model generation, migrations, seeding, health checks, and database management

Readme

Stabilize ORM CLI

The official command-line interface for the Stabilize ORM.


stabilize-cli is the essential companion tool for Stabilize ORM, providing a powerful set of commands to manage your database schema, generate files, and run development tasks directly from your terminal.


Features

  • Code Generation: Instantly scaffold new models, migrations, seed files, and REST API routes.
  • Flexible Field Arguments: Pass column definitions as arguments to generate:model, e.g. name:string active:boolean.
  • Multi-Row Seeding: Use --count <number> with generate:seed to control seed row count.
  • Schema Management: Auto-generate database-specific SQL migrations from models.
  • AutoMigrate: migrate:auto creates missing tables, columns and indexes in one step. It only ever adds — it never drops a column or changes a column type.
  • Schema Diffing: db:diff compares your model definitions against the live database and reports drift.
  • Soft Deletes & Versioning: Scaffold models with softDelete and versioned options.
  • Database Backup & Restore: Backup and restore your database with db:backup and db:restore.
  • REST API Generation: Generate full CRUD API scaffolds with generate:api.
  • Fresh Migrations: Drop and re-migrate with migrate:fresh (no seed).
  • Database Size Analysis: View table sizes and row counts with db:size.
  • Interactive SQL Console: Run ad-hoc queries with db:console (alias db:sql).
  • Model Introspection: Inspect model fields and validators with model:info, and catch definition errors with model:validate.
  • Cross-DB Compatibility: Works with PostgreSQL, MySQL/MariaDB, SQLite, SQL Server, and MongoDB.
  • MongoDB Support: The document database is a first-class target, not a degraded one. db:console accepts command documents, and status, db:tables, db:table:info, db:size, db:drop, db:truncate, db:diff, db:backup, db:restore, seeding and migration status all understand collections, _id, and real Date values. query is the one exception: MongoDB has no SQL to run, so rather than failing with MONGO_UNSUPPORTED from inside the driver it says so and points at the commands that do work.
  • TypeScript-First: All generated files are TypeScript, loaded directly by Node or Bun — no build step.
  • Runs on Node.js and Bun: One published bundle, no native dependencies, no runtime lock-in.

Installation

# Using npm
npm install -g stabilize-cli

# Using Bun
bun add -g stabilize-cli

The published CLI is a single JavaScript bundle with no native dependencies, so the same install runs on either runtime.


Runtimes

| Runtime | Version | SQLite driver | | ------- | -------- | ---------------------- | | Node.js | 22.18+ | node:sqlite (built in) | | Bun | 1.3+ | bun:sqlite (built in) |

Both are fully supported, and the other four backends — PostgreSQL, MySQL/MariaDB, SQL Server and MongoDB — behave identically on either.

Node.js: add "type": "module" to your project

The CLI imports your config/database.ts, models/*.ts and the rest of your project at run time. Node decides how to treat a .ts file by looking at the nearest package.json, and without "type": "module" it treats it as CommonJS — so the import statements in your own files fail with:

SyntaxError: Cannot use import statement outside a module

Add this to your project's package.json if you are running the CLI under Node:

{
  "type": "module"
}

Bun detects module syntax on its own, so Bun projects need nothing.

Node.js 22.18 or later is required. That is the release where Node loads TypeScript by default; earlier 22.x releases need a flag and are not supported.


Commands

Generation

| Command | Description | | ------------------------------------ | ------------------------------------------------- | | generate:model <Name> [fields...] | Create a new model file in models/ | | generate:migration <Name> | Generate a migration from a model | | generate:seed <Name> | Generate a seed file. Use --count <n> | | generate:api <Name> | Generate a REST API scaffold from a model | | generate:test <Name> | Generate a test file for a model | | generate:all <Name> [fields...] | Generate model, migration, and seed together | | config:init | Scaffold a starter config/database.ts |

Migrations

| Command | Description | | ---------------------- | ------------------------------------------------------------ | | migrate | Apply all pending migrations | | migrate:rollback | Roll back the most recent migration | | migrate:fresh | Drop all tables and re-run all migrations (no seed) | | migrate:status | Detailed migration status with timestamps | | migrate:pending | Show only pending migrations | | migrate:auto | Auto-migrate: create tables, add missing columns and indexes | | db:diff | Compare model definitions against the database schema | | seed | Run all pending seed files |

migrate:auto is additive only — it creates what is missing and never drops a column or alters a column type.

Database

| Command | Description | | ---------------------- | ----------------------------------------------- | | db:tables | List all tables in the database | | db:table:info <table>| Show detailed column info for one table | | db:size | Database and table size statistics | | db:truncate [table] | Truncate a table, or all tables | | db:drop [--force] | Drop all tables (use --force to skip confirm) | | db:reset [--force] | Drop, migrate, and seed the database | | db:backup | Backup the database to a timestamped file | | db:restore <file> | Restore from a backup file | | db:console (db:sql) | Start an interactive console (SQL, or documents on MongoDB) | | query <sql> | Execute a raw SQL query and display results (SQL backends only) |

Models, Status & Health

| Command | Description | | ------------------- | -------------------------------------------------- | | model:info <name> | Show detailed info about a model | | model:validate | Validate all model definitions for errors | | status | Show migration and seed status | | health | Check database and cache health | | health:json | Health check with JSON output for automation | | info | Show CLI, ORM, and environment information |

Command Examples

Generate a User model:

stabilize-cli generate:model User name:string active:boolean email:string

Generate a REST API scaffold:

stabilize-cli generate:api User
# Creates api/User.ts with full CRUD routes

Backup the database:

stabilize-cli db:backup
# Creates backups/backup_20250101120000.db

Restore from backup:

stabilize-cli db:restore backups/backup_20250101120000.db --force

Fresh migration (drop + migrate):

stabilize-cli migrate:fresh --force

Auto-migrate (additive only):

stabilize-cli migrate:auto
# Creates missing tables, columns and indexes.
# Never drops a column and never changes a column type.

Check for schema drift:

stabilize-cli db:diff
# Reports where your models and the live database disagree

View database size:

stabilize-cli db:size
# Shows file size, table count, and row counts

Check status:

stabilize-cli status

Project Documentation


License

MIT License - see LICENSE.