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

@sqlml/cli

v0.3.8

Published

DBML-first database toolkit — generate TypeORM/Prisma models, manage migrations, version schemas, and browse data via Web UI.

Readme


Design your database schema in DBML, generate TypeORM entities or Prisma schemas, manage migrations, track schema versions, and browse your data with a built-in Web UI — all from one CLI.

Install

npm install -g @sqlml/cli

Quick Start

# 1. Initialize project (picks TypeORM or Prisma)
sqlml init

# 2. Edit your DBML schema
#    → sqlml/src/lib/schema/my-schema.dbml

# 3. Generate ORM models from DBML
sqlml generate my-schema

# 4. Set up migrations
sqlml migration:init
sqlml migration:generate add-users
sqlml migration:up

# 5. Launch the Web UI
sqlml ui

What It Does

| Capability | Description | |------------|-------------| | Schema Design | Write database schemas in DBML — a clean, readable DSL | | Model Generation | Auto-generate TypeORM entity classes or Prisma schema files | | Migrations | Generate, run, revert, and track migrations (both ORMs) | | Schema Versioning | Snapshots, diffs, and change history for your DBML | | Web UI | Visual dashboard, schema editor, data browser, SQL query editor | | Multi-Database | PostgreSQL, MySQL, MariaDB, SQLite, MSSQL, Oracle |

DBML Example

Validate your DBML schema online at dbdiagram.io

Table users {
  id uuid [primary key, default: `uuid_generate_v4()`]
  username varchar [not null, unique]
  email varchar [not null, unique]
  role user_role [not null, default: 'user']
  created_at timestamptz [default: `now()`]
}

Table posts {
  id uuid [primary key, default: `uuid_generate_v4()`]
  title varchar(255) [not null]
  body text
  author_id uuid [not null, ref: > users.id]
  published_at timestamptz
}

Enum user_role {
  admin
  user
  moderator
}

Commands

Core

sqlml init                    # Initialize project (interactive)
sqlml generate [schema]       # Generate SQL + entities from DBML
sqlml direct                  # Generate entities from existing database
sqlml ui                      # Start Web UI at localhost:4200
sqlml ui-stop                 # Stop Web UI

Migrations

sqlml migration:init          # Baseline existing database
sqlml migration:generate <n>  # Generate migration from schema diff
sqlml migration:up            # Run pending migrations
sqlml migration:revert        # Revert last migration
sqlml migration:status        # Show migration status
sqlml migration:from-dbml [n] # Generate migration from DBML changes

Schema Versioning

sqlml diff                    # Show schema changes since last snapshot
sqlml snapshot:create         # Create schema snapshot
sqlml snapshot:list           # List snapshots
sqlml snapshot:show <version> # Show specific snapshot
sqlml schema:history          # Full change history

ORM Support

TypeORM

sqlml init        # → Select "typeorm"
sqlml generate    # → Generates decorated entity classes

Generates entity files with @Entity, @Column, @PrimaryColumn, relationship decorators, indexes, and configurable naming conventions.

Prisma

sqlml init        # → Select "prisma"
sqlml generate    # → Generates schema.prisma
  • Generates schema.prisma from DBML
  • migration:init baselines with prisma migrate diff + auto-adds uuid-ossp extension
  • migration:up runs prisma migrate deploy
  • migration:generate uses prisma migrate dev --create-only

Web UI

sqlml ui

Opens at http://localhost:4200 with:

  • Dashboard — Project overview, ORM-specific command reference
  • Schema Editor — Monaco Editor with DBML syntax highlighting
  • Schema Diff — Side-by-side snapshot comparison with color-coded changes
  • Migrations — View, run, and revert migrations
  • Database — Connection manager, schema tree browser, paginated data grid with inline editing, SQL query editor (Cmd+Enter to run)
  • Settings — Configuration editor

See @sqlml/ui for standalone installation.

Database to Entities (Direct Mode)

Generate entities from an existing database without DBML:

# PostgreSQL
sqlml -h localhost -d mydb -u postgres -x pass -e postgres -o ./src/entities

# MySQL
sqlml -h localhost -d mydb -u root -x pass -e mysql -p 3306 -o ./src/entities

# SQLite
sqlml -d ./database.sqlite -e sqlite -o ./src/entities

# MSSQL
sqlml -h localhost -d mydb -u sa -x pass -e mssql -o ./src/entities

Configuration

Settings are stored in .config-sqlml (auto-created by sqlml init).

Add .config-sqlml and .sqlml/ to .gitignore to protect credentials.

Connection

| Variable | Default | Description | |----------|---------|-------------| | ORM_TYPE | typeorm | ORM to use: typeorm or prisma | | DB_TYPE | postgres | Database engine: postgres, mysql, mariadb, sqlite, mssql, oracle | | DB_HOST | localhost | Database server hostname | | DB_PORT | 5432 | Database server port | | DB_NAME | — | Database name (or file path for SQLite) | | DB_USER | — | Database username | | DB_PASSWORD | — | Database password | | DB_SCHEMA | public | Schema(s) to use — comma-separated for multiple (e.g. auth,store,cms) | | DB_SSL | false | Enable SSL connection |

File Paths

| Variable | Default | Description | |----------|---------|-------------| | SCHEMA_DIR | sqlml/src/lib/schema | Directory for .dbml schema files | | SQL_DIR | sqlml/src/lib/sql | Directory for generated SQL files | | ENTITIES_DIR | sqlml/src/lib/entities | Directory for generated entity/model files | | MIGRATIONS_DIR | sqlml/src/lib/migrations | Directory for migration files |

Table Filtering

| Variable | Default | Description | |----------|---------|-------------| | SKIP_TABLES | — | Comma-separated list of tables to exclude from generation | | ONLY_TABLES | — | Comma-separated list of tables to include (excludes all others) |

Naming Conventions

| Variable | Default | Values | Description | |----------|---------|--------|-------------| | CASE_FILE | param | param, pascal, camel, snake, none | File naming convention (e.g. user-profile.ts) | | CASE_ENTITY | pascal | pascal, camel, snake, none | Entity class naming (e.g. UserProfile) | | CASE_PROPERTY | camel | pascal, camel, snake, none | Property naming (e.g. firstName) | | SUFFIX_FILE | — | any string | Suffix appended to file names (e.g. .entity) | | SUFFIX_CLASS | — | any string | Suffix appended to class names (e.g. Entity) |

Generation Options

| Variable | Default | Description | |----------|---------|-------------| | PROPERTY_VISIBILITY | none | Property visibility modifier: none, public, protected, private | | STRICT_MODE | none | TypeScript strict mode: none or ! (definite assignment) | | LAZY | false | Generate lazy-loaded relations | | ACTIVE_RECORD | false | Use Active Record pattern (extends BaseEntity) | | RELATION_IDS | true | Generate @RelationId decorated properties | | SKIP_SCHEMA | false | Skip schema option in @Entity decorator | | GENERATE_CONSTRUCTOR | true | Generate constructor in entity classes | | PLURALIZE_NAMES | true | Pluralize relation property names | | INDEX_FILE | true | Generate index.ts barrel file for entities | | EXPORT_TYPE | named | Export style: named or default | | EOL | LF | Line ending style: LF or CRLF |

Web UI

| Variable | Default | Description | |----------|---------|-------------| | UI_PORT | 4200 | Port for the Web UI server | | UI_SERVER_PORT | — | Override server port (takes precedence over UI_PORT) | | UI_THEME | dark | UI color theme: dark or light | | UI_OPEN_BROWSER | true | Automatically open browser when running sqlml ui |

Example

# Connection
ORM_TYPE=typeorm
DB_TYPE=postgres
DB_HOST=localhost
DB_PORT=5432
DB_NAME=mydatabase
DB_USER=postgres
DB_PASSWORD=
DB_SCHEMA=public
DB_SSL=false

# File Paths
SCHEMA_DIR=./sqlml/src/lib/schema
SQL_DIR=./sqlml/src/lib/sql
ENTITIES_DIR=./sqlml/src/lib/entities
MIGRATIONS_DIR=./sqlml/src/lib/migrations

# Table Filtering
# SKIP_TABLES=migrations,seeds
# ONLY_TABLES=users,posts,comments

# Naming Conventions
CASE_FILE=param
CASE_ENTITY=pascal
CASE_PROPERTY=camel

# Web UI
UI_PORT=4200
# UI_SERVER_PORT=4200
UI_THEME=dark
UI_OPEN_BROWSER=true

# Generation Options
PROPERTY_VISIBILITY=none
STRICT_MODE=none
LAZY=false
ACTIVE_RECORD=false
RELATION_IDS=true
SKIP_SCHEMA=false
GENERATE_CONSTRUCTOR=true
PLURALIZE_NAMES=true
INDEX_FILE=true
EXPORT_TYPE=named
EOL=LF

Supported Databases

| Database | Engine | Driver | |----------|--------|--------| | PostgreSQL | postgres | pg | | MySQL | mysql | mysql2 | | MariaDB | mariadb | mysql2 | | SQLite | sqlite | sqlite3 | | MSSQL | mssql | mssql | | Oracle | oracle | oracledb |

Requirements

  • Node.js >= 20.0.0 (tested on 20.x, 22.x, 23.x, 24.x, 25.x)
  • TypeORM >= 0.3.20 or Prisma (peer dependency)

Links

License

MIT