{"id":49230,"library":"rhinozug","title":"Rhinozug","description":"A database connection and migration module from Rhinogram, designed as an internal tool to be used alongside rhinozug-CLI. It wraps Knex.js with MySQL and PostgreSQL support, providing a configured Knex connection object for projects. Version 1.1.6 is the latest stable release; no public release cadence is indicated. Its key differentiator is tight integration with Rhinogram's migration tooling.","status":"active","version":"1.1.6","language":"javascript","source_language":"en","source_url":null,"tags":["javascript"],"install":[{"cmd":"npm install rhinozug","lang":"bash","label":"npm"},{"cmd":"yarn add rhinozug","lang":"bash","label":"yarn"},{"cmd":"pnpm add rhinozug","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core dependency; Rhinozug returns a Knex connection object.","package":"knex","optional":false},{"reason":"MySQL driver for database connections when using MySQL.","package":"mysql","optional":true},{"reason":"PostgreSQL driver for database connections when using PostgreSQL.","package":"pg","optional":true}],"imports":[{"note":"This package is ESM-only; CommonJS require will fail. Use dynamic import if necessary.","wrong":"const rhinozug = require('rhinozug')","symbol":"default","correct":"import rhinozug from 'rhinozug'"},{"note":"Named export is 'connect', not 'connection'.","wrong":"import { connection } from 'rhinozug'","symbol":"connect","correct":"import { connect } from 'rhinozug'"},{"note":"Knex type is imported directly from 'knex', not from 'rhinozug'.","wrong":"import { Knex } from 'rhinozug'","symbol":"Knex","correct":"import type { Knex } from 'knex'"}],"quickstart":{"code":"import rhinozug from 'rhinozug';\nimport { Knex } from 'knex';\n\nconst config = {\n  client: 'mysql',\n  connection: {\n    host: process.env.DB_HOST ?? 'localhost',\n    user: process.env.DB_USER ?? 'user',\n    password: process.env.DB_PASS ?? 'password',\n    database: process.env.DB_NAME ?? 'mydb'\n  }\n};\n\nconst db: Knex = rhinozug(config);\n// Use db as a regular Knex instance\nconst result = await db('users').select('*');\nconsole.log(result);","lang":"typescript","description":"Shows how to import, configure, and use rhinozug to obtain a typed Knex connection using MySQL."},"warnings":[{"fix":"Use import syntax or dynamic import: const rhinozug = await import('rhinozug')","message":"Package is ESM-only since v1.0; using require() will throw a runtime error.","severity":"breaking","affected_versions":">=1.0"},{"fix":"Use the returned object directly as a Knex connection.","message":"The package returns a Knex instance; do not call new Knex() separately.","severity":"gotcha","affected_versions":">=0.0"},{"fix":"Ensure config.client is 'mysql' or 'pg' (case-sensitive).","message":"The config object must include a 'client' field set to 'mysql' or 'pg'.","severity":"gotcha","affected_versions":">=0.0"}],"env_vars":null,"search_vec":"'1.1.6':39 'alongsid':18 'cadenc':48 'cli':21 'configur':32 'connect':4,34 'databas':3 'design':10 'differenti':53 'indic':50 'integr':56 'intern':13 'javascript':62 'key':52 'knex':33 'knex.js':24 'latest':42 'migrat':6,60 'modul':7 'mysql':26 'object':35 'postgresql':28 'project':37 'provid':30 'public':46 'releas':44,47 'rhinogram':9,58 'rhinozug':1,20 'rhinozug-c':19 'stabl':43 'support':29 'tight':55 'tool':14,61 'use':17 'version':38 'wrap':23","created_at":"2026-06-07T17:00:42.999116+00:00","updated_at":"2026-06-07T17:00:42.999116+00:00","problems":[{"fix":"Switch to import syntax or use dynamic import: const rhinozug = await import('rhinozug')","cause":"Using CommonJS require() for an ESM-only package.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module not supported"},{"fix":"Install knex as a dependency: npm install knex","cause":"Missing Knex dependency or incorrect peer dependency.","error":"Error: Knex: require is not defined"},{"fix":"Install mysql: npm install mysql","cause":"Missing MySQL driver package.","error":"Error: Client 'mysql' is not a valid Knex client"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"rhinozug","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}