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

v1.2.0

Published

Command-line interface for Stabilize ORM, providing tools for model generation, migrations, and seeding with programmatic model support

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, and seed files with a single command.
  • Flexible Field Arguments for Models: Pass column definitions as arguments to generate model, e.g., name:string active:boolean.
  • Multi-Row Seeding: Use --count <number> (or -n <number>) with generate seed to control how many seed rows are generated, using the model's schema.
  • Schema Management: Automatically generate database-specific SQL migrations from your existing models.
  • Lifecycle Hooks Support: Scaffold models with hooks defined in ModelConfig or as class methods for beforeCreate, afterUpdate, etc.
  • Soft Deletes & Versioning: Scaffold models with softDelete and versioned options for audit, rollback, and time-travel support.
  • Database Tooling: Run migrations, roll them back, and check their status against the database.
  • Data Seeding with Dependencies: Populate your database with test data, manage seed history, and respect dependencies between seed files.
  • Cross-DB Compatibility: Seed and migration history tables are now created with auto-increment id and proper string/timestamp types for MySQL, Postgres, and SQLite.
  • Workflow Automation: A powerful db:reset command to drop, migrate, and seed your database for a clean development slate, with a --force flag for non-interactive use.
  • TypeScript & Modern Bun Support: All files generated are TypeScript-first, designed for Bun runtimes.

📦 Installation

For the best experience, install the CLI globally using your preferred package manager.

# Using npm
npm install -g stabilize-cli

# Using Bun
bun add -g stabilize-cli

After installation, the stabilize-cli command will be available in your terminal.


✅ Prerequisites

The Stabilize CLI is designed to work within a project that has stabilize-orm@^1.3.0 installed and configured. It automatically looks for a config/database.ts file in your project's root directory to connect to the database.


💻 Commands

All commands are run using the stabilize-cli executable.

| Command | Description | | ---------------------------------- | --------------------------------------------------------------------------- | | generate model <Name> [fields...] | Creates a new model file in models/ with hooks, soft delete, and versioning. Pass column definitions as extra arguments (e.g. name:string active:boolean). | | generate migration <ModelName> | Generates a new SQL migration from an existing model. | | generate seed <SeedName> | Creates a new seed file in seeds/, based on the model schema. Use --count <number> or -n <number> to control number of rows. | | migrate | Applies all pending migrations to the database. | | migrate:rollback | Rolls back the most recently applied migration. | | seed | Runs all pending seed files, respecting dependencies. | | seed:rollback | Rolls back the most recently applied seed. | | status | Shows the status (APPLIED or PENDING) of all migration and seed files. | | db:drop [--force] | Drops all tables in the database. Use --force to skip confirmation. Use with caution. | | db:reset [--force] | Drops, migrates, and seeds the database. Use --force to skip confirmation. For development only. |

Command Examples

Generating a new User model with custom fields:

stabilize-cli generate model User name:string active:boolean email:string
# ✔ Success: Model generated: models/User.ts

Generating a seed file for User with 10 rows (uses model's schema):

stabilize-cli generate seed User --count 10
# ✔ Success: Seed generated: seeds/20251019135400_User.ts

Generating a migration from the Product model:

stabilize-cli generate migration Product
# ✔ Success: Migration generated: migrations/20251018203000_create_product_table.json

Applying all pending migrations:

stabilize-cli migrate
# ✔ All pending migrations applied.

Applying all pending seeds:

stabilize-cli seed
# ✔ Successfully applied 1 seed(s).

Resetting the database non-interactively:

stabilize-cli db:reset --force
# ✔ Database reset complete.

Checking the status of your database:

stabilize-cli status

# Migration Status
# ---------------------------------
# [ APPLIED ] 20251018203000_create_product_table
#
# Seed Status
# ---------------------------------
# [ PENDING ] 20251018203000_Product

🧑‍💻 Advanced Usage

Model Generation with Hooks and Soft Delete

By default, generated models include:

  • versioned: true for audit and time-travel support.
  • softDelete: true with a deletedAt column for soft deletes.
  • Lifecycle hooks defined in ModelConfig and as class methods.
  • Custom columns: Pass fields as arguments, e.g. name:string isActive:boolean createdAt:date.
stabilize-cli generate model Product name:string category:string price:numeric

📃 Project Documentation


🤝 Contributing

Contributions are welcome! Please read the Contributing Guide for details on our code of conduct and the process for submitting pull requests.


📑 License

This project is licensed under the MIT License - see the LICENSE file for details.


Created with ❤️ by ElectronSz
File last updated: 2025-10-19 13:59:00 UTC