Registry / database / app_mysqli_js

app_mysqli_js

JSON →
library1.5.16jsnpmunverified

Entity framework for MySQL based on mysqljs/mysql. Stable version 1.5.16 (as of 2025) with moderate release cadence. Provides a simple ORM-like layer for CRUD operations, supporting model definitions, query building, and connection pooling. Differentiates from mysqljs/mysql by adding abstraction for models and relationships, but requires mysqljs/mysql as a dependency. No TypeScript definitions.

npm install app_mysqli_js
INSTALL
IMPORT
SIG · APP_MYSQLI_JS
A
app_mysqli_js
databasejavascriptv1.5.16
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
const mysqli = require('app_mysqli_js')
import mysqli from 'app_mysqli_js'
Package is CommonJS-only, no ESM support
Model
const { Model } = require('app_mysqli_js')
const { Model } = require('mysqli')
Model is a named export from the package
mysqli
const { mysqli } = require('app_mysqli_js')
const mysqli = require('app_mysqli_js').default
default export is the mysqli instance creator, not a named export

Creates a MySQL connection using environment variables, defines a model, and inserts a record.

const mysqli = require('app_mysqli_js'); const db = mysqli.createConnection({ host: process.env.DB_HOST ?? 'localhost', user: process.env.DB_USER ?? 'root', password: process.env.DB_PASS ?? '', database: process.env.DB_NAME ?? 'test' }); const User = db.model('User', { name: String, email: { type: String, required: true } }); User.create({ name: 'Alice', email: 'alice@example.com' }).then(user => console.log(user.id));
Debug
Known issues
gotchaPackage uses mysqljs/mysql under the hood; SQL injection possible if raw queries are used without escaping.
fix
Always use parameterized queries or the model methods to avoid SQL injection.
affects: all
deprecatedThe `mysqli.createConnection` may be deprecated in favor of `mysql.createPool` in future versions.
fix
Use `mysqli.createPool` for better connection management.
affects: >=1.5.0
breakingVersion 2.0 changed the model definition syntax; `String` shorthand no longer supported.
fix
Use explicit { type: String } for all fields.
affects: >=2.0.0
Errors
Common errors & fixes
Cannot find module 'app_mysqli_js'
Forgot to install the package or typo in package name
fix
npm install app_mysqli_js
TypeError: db.model is not a function
Using a connection created with `createPool` but trying to call `model` on pool instead of connection
fix
Call `db.model()` on the result of `createConnection()`, not `createPool()`.
Upgrade
Version history
1.5.16latest on npm
Audit
Dependencies
mysqlrequiredCore MySQL driver for connection and queries
Agent activity
64 hits · last 30 days
node
36
Bingbot
25
OpenAI (training)
1
Resources
app_mysqli_js — npm install app_mysqli_js · libregistry