Registry / database / toshihiko

toshihiko

JSON →
library1.0.4jsnpmunverified

Toshihiko is a simple ORM for Node.js, primarily targeting MySQL databases with built-in cache support. The latest version (1.0.4) is stable but the project appears to be in maintenance mode, with documentation for v1.x still incomplete as of the README. It offers a lightweight alternative to heavyweight ORMs like Sequelize, but lacks active development and has a niche user base. Release cadence is low; the last updates were in 2018.

npm install toshihiko
INSTALL
IMPORT
SIG · TOSHIHIKO
T
toshihiko
databasejavascriptv1.0.4
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.

Toshihiko
import Toshihiko from 'toshihiko'
const Toshihiko = require('toshihiko').default;
Default export for the ORM constructor; supports both ESM and CJS, but CJS import may require .default in older versions.
Model
import { Model } from 'toshihiko'
const Model = require('toshihiko').Model;
Named export for defining models; common mistake is trying to use default export as Model.
types
import { types } from 'toshihiko'
Named export for data type constants (STRING, INTEGER, etc.) – optional but commonly used.

Create a Toshihiko instance, define a model, and insert a record using callback style.

const Toshihiko = require('toshihiko'); const toshihiko = new Toshihiko({ host: 'localhost', port: 3306, user: 'root', password: process.env.DB_PASSWORD ?? '', database: 'test' }); const User = toshihiko.define('user', { id: { type: Toshihiko.TYPE.INTEGER, primaryKey: true, autoIncrement: true }, name: { type: Toshihiko.TYPE.STRING, allowNull: false }, age: { type: Toshihiko.TYPE.INTEGER } }); User.insert({ name: 'Alice', age: 25 }, (err, result) => { if (err) console.error(err); else console.log('Inserted:', result); });
Debug
Known issues
gotchaDocumentation for v1.x is incomplete; many examples still reference 0.9 syntax.
fix
Refer to preview docs or source code for correct usage.
affects: >=1.0 <2
gotchaNo built-in connection pooling; each new Toshihiko instance opens a separate MySQL connection.
fix
Use a connection pool externally or share one instance.
affects: >=1.0
deprecatedCallbacks only; no Promise support natively.
fix
Wrap calls in Promise or use a promise wrapper like util.promisify.
affects: >=1.0
deprecatedPackage has not been updated since 2018; may have unpatched vulnerabilities.
fix
Consider migrating to a maintained ORM like Sequelize or TypeORM.
affects: *
Errors
Common errors & fixes
Error: Cannot find module 'toshihiko'
Package not installed
fix
npm install toshihiko --save
TypeError: Toshihiko is not a constructor
Incorrect import: used default import with require but forgot .default
fix
const Toshihiko = require('toshihiko').default; or use import Toshihiko from 'toshihiko'
Error: ER_ACCESS_DENIED_ERROR: Access denied for user 'root'@'localhost'
Invalid credentials or database does not exist
fix
Check DB_HOST, DB_USER, DB_PASSWORD, and DB_DATABASE environment variables.
Upgrade
Version history
1.0.4latest on npm
Audit
Dependencies
mysqlrequiredMySQL driver for database connectivity
Agent activity
15 hits · last 30 days
node
12
Meta
2
OpenAI (training)
1
Resources
toshihiko — npm install toshihiko · libregistry