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

dreeked

v1.1.2

Published

AI-powered CLI tool to generate ORM schemas from PostgreSQL and MySQL databases

Readme

Insomma CLI Tool

AI-powered CLI tool to generate ORM schemas from PostgreSQL and MySQL databases using advanced language models.

Features

  • Multi-Database Support: Works with both PostgreSQL and MySQL databases
  • Multi-ORM Support: Generate schemas for Prisma, TypeORM, Drizzle, and Zod
  • Complete Metadata Extraction: Tables, columns, relationships, indexes, enums, and constraints
  • AI-Powered Generation: Uses Meta's Llama 3.3 70B model via DeepInfra
  • Auto-Detection: Automatically detects database type from connection string
  • Flexible Output: Write to file or output to stdout
  • Connection Testing: Verify database connectivity before processing
  • Comprehensive CLI: Multiple commands for different use cases

Installation

Global Installation

npm install -g insomma

Run with npx

npx insomma --help

Run with bunx

bunx insomma --help

Setup

Get DeepInfra API Key

  1. Sign up at DeepInfra
  2. Get your API key from the dashboard
  3. Set it as an environment variable or pass it as an option

Set Environment Variable (Recommended)

export DEEPINFRA_API_KEY="your-api-key-here"

Usage

PostgreSQL Examples

Basic Schema Generation

insomma \
  --connection "postgres://user:password@localhost:5432/mydb" \
  --orm prisma \
  --output schema.prisma

Generate TypeORM Entities

insomma \
  --connection "postgres://user:pass@host:port/db" \
  --orm typeorm \
  --output entities.ts

MySQL Examples

Basic Schema Generation

insomma \
  --connection "mysql://user:password@localhost:3306/mydb" \
  --orm prisma \
  --output schema.prisma

Generate Drizzle Schema

insomma \
  --connection "mysql://user:pass@host:port/db" \
  --orm drizzle \
  --output schema.ts

Universal Examples

Generate Zod Validation Schemas

insomma \
  --connection "postgres://user:pass@host:port/db" \
  --orm zod \
  --output validations.ts

Output to Console

insomma \
  --connection "mysql://user:pass@host:port/db" \
  --orm prisma

Specify Database Type Explicitly

insomma \
  --connection "some-custom-connection-string" \
  --type mysql \
  --orm prisma

Test Database Connection

# Auto-detect database type
insomma test-connection \
  --connection "postgres://user:pass@host:port/db"

# Specify database type
insomma test-connection \
  --connection "mysql://user:pass@host:port/db" \
  --type mysql

List Database Tables

# PostgreSQL
insomma list-tables \
  --connection "postgres://user:pass@host:port/db"

# MySQL
insomma list-tables \
  --connection "mysql://user:pass@host:port/db"

Command Options

Main Command

  • -c, --connection <string> - Database connection string (required)
  • -t, --type <string> - Database type (postgres, mysql, auto) [default: auto]
  • -o, --orm <string> - Target ORM (prisma, typeorm, drizzle, zod) [default: prisma]
  • -f, --output <string> - Output file path (optional)
  • --api-key <string> - DeepInfra API key (optional if env var set)
  • --verbose - Enable verbose logging

Test Connection Command

  • -c, --connection <string> - Database connection string (required)
  • -t, --type <string> - Database type (postgres, mysql, auto) [default: auto]

List Tables Command

  • -c, --connection <string> - Database connection string (required)
  • -t, --type <string> - Database type (postgres, mysql, auto) [default: auto]

Connection String Formats

PostgreSQL

postgres://username:password@hostname:port/database
postgresql://username:password@hostname:port/database

Examples:

# Local database
postgres://postgres:password@localhost:5432/myapp

# Remote database
postgres://user:[email protected]:5432/production

# With SSL
postgres://user:pass@host:5432/db?sslmode=require

MySQL

mysql://username:password@hostname:port/database

Examples:

# Local database
mysql://root:password@localhost:3306/myapp

# Remote database
mysql://user:[email protected]:3306/production

# With SSL
mysql://user:pass@host:3306/db?ssl=true

Database Type Detection

The tool automatically detects the database type from the connection string:

  • PostgreSQL: Detected by postgres://, postgresql:// prefixes or port :5432
  • MySQL: Detected by mysql:// prefix or port :3306
  • Manual Override: Use --type option to specify explicitly

Supported ORMs

Prisma

Generates complete Prisma schema with:

  • Generator and datasource blocks (PostgreSQL/MySQL specific)
  • Proper data type mappings for each database
  • Relationships with @relation
  • Constraints and indexes
  • Database-specific features

TypeORM

Generates TypeScript entity classes with:

  • Proper decorators (@Entity, @Column, etc.)
  • Database-specific type mappings
  • Relationship definitions
  • Column constraints
  • Auto-increment handling

Drizzle

Generates Drizzle schema with:

  • Database-specific imports (pg-core/mysql-core)
  • Table definitions using pgTable/mysqlTable
  • Proper column types for each database
  • Foreign key relationships
  • Constraints and indexes

Zod

Generates validation schemas with:

  • Type-safe validations
  • Database-appropriate Zod types
  • Optional/required field handling
  • Custom validations
  • Database-specific field handling

Examples by Database

E-commerce PostgreSQL to Prisma

insomma \
  --connection "postgres://admin:secret@localhost:5432/ecommerce" \
  --orm prisma \
  --output prisma/schema.prisma \
  --verbose

Blog MySQL to TypeORM

insomma \
  --connection "mysql://blogger:pass123@blog-db:3306/blog" \
  --orm typeorm \
  --output src/entities/index.ts

Analytics PostgreSQL to Drizzle

insomma \
  --connection "postgres://analyst:[email protected]:5432/metrics" \
  --orm drizzle \
  --output lib/schema.ts

CRM MySQL to Zod

insomma \
  --connection "mysql://crm:[email protected]:3306/customer_data" \
  --orm zod \
  --output lib/validations.ts

Metadata Extraction

The tool extracts comprehensive database metadata including:

PostgreSQL

  • Tables: Names, schemas, comments
  • Columns: Data types, constraints, defaults, comments
  • Relationships: Foreign keys with cascade rules
  • Indexes: Custom indexes (excluding primary keys)
  • Enums: PostgreSQL enum types and values
  • Constraints: Primary keys, unique constraints, check constraints

MySQL

  • Tables: Names, schemas, comments
  • Columns: Data types, constraints, defaults, comments, auto-increment
  • Relationships: Foreign keys with cascade rules
  • Indexes: Custom indexes (excluding primary keys)
  • Enums: ENUM and SET column types
  • Constraints: Primary keys, unique constraints

Database-Specific Features

PostgreSQL Features

  • Full schema support
  • Custom enum types
  • Advanced constraint types
  • UUID and serial types
  • JSONB support

MySQL Features

  • Auto-increment columns
  • ENUM and SET types
  • Unsigned integer types
  • MySQL-specific data types
  • Storage engine considerations

Error Handling

The tool provides clear error messages for:

  • Invalid connection strings
  • Unsupported database types
  • Network connectivity issues
  • API authentication problems
  • Unsupported database features
  • File system permissions

Troubleshooting

Connection Issues

# Test your connection first
insomma test-connection --connection "your-connection-string"

# Specify database type if auto-detection fails
insomma test-connection --connection "your-connection-string" --type mysql

Database Type Detection Issues

# Force database type
insomma --type postgres --connection "..." --orm prisma
insomma --type mysql --connection "..." --orm prisma

API Key Issues

# Verify your API key is set
echo $DEEPINFRA_API_KEY

# Or pass it directly
insomma --api-key "your-key" --connection "..." --orm prisma

Verbose Logging

# Enable verbose output for debugging
insomma --verbose --connection "..." --orm prisma

Requirements

  • Node.js 16 or higher
  • PostgreSQL or MySQL database access
  • DeepInfra API key
  • Internet connection for AI generation

Supported Database Versions

PostgreSQL

  • PostgreSQL 10+
  • All major cloud providers (AWS RDS, Google Cloud SQL, Azure Database)

MySQL

  • MySQL 5.7+
  • MySQL 8.0+
  • MariaDB 10.3+
  • All major cloud providers (AWS RDS, Google Cloud SQL, Azure Database)

License

MIT License - see LICENSE file for details.