Registry / database / snake-orm

snake-orm

JSON →
library0.0.25jsnpmunverified

A minimal ORM for Node.js supporting MySQL and SQLite. Current stable version: 0.0.25. Release cadence is irregular; API and documentation are sparse. Key differentiator: light weight with chainable query builder (`.where().limit().offset()`) similar to Knex. Lacks migration, model validation, and eager loading. Primarily targets small projects or prototypes. Note: package name is 'snake-orm', but import uses 'SnackeOrm' (typo in code).

npm install snake-orm
INSTALL
IMPORT
SIG · SNAKE-ORM
S
snake-orm
databasejavascriptv0.0.25
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 export
const SnakeOrm = require('snake-orm');
import SnakeOrm from 'snake-orm'; // ESM not supported
This package does not provide ESM exports. Use CommonJS require. Note the typo 'SnakeOrm' (vs 'SnakeOrm' in code).
SnakeModel
const { SnakeModel } = require('snake-orm');
import { SnakeModel } from 'snake-orm'; // ESM not supported
Destructure from the CommonJS require. The class name is 'SnakeModel' (capital S, capital M).
getOrCreateSnakeOrmProxy
SnakeOrm.getOrCreateSnakeOrmProxy(database, username, password, config);
SnakeOrm.getOrCreateSnakeOrmProxy(config); // missing database, username, password
First three arguments are required: database, username, password. Config object comes fourth.

Initializes a connection, defines a model, and performs basic find and chainable query operations.

const SnakeOrm = require('snake-orm'); SnakeOrm.getOrCreateSnakeOrmProxy('test_db', 'root', 'password', { dialect: 'mysql', host: 'localhost', logger: false }); const { SnakeModel } = SnakeOrm; class User extends SnakeModel { constructor() { super(...arguments); } } // Find user with primary key 1 User.find(1).then(user => console.log(user)).catch(err => console.error(err)); // Chainable query User.where('age > ?', 18).limit(10).offset(0).then(users => console.log(users));
Debug
Known issues
gotchaTypo in code: 'SnackeOrm' vs 'SnakeOrm' – the required module is named 'snake-orm', but the returned object is often referred to as 'SnakeOrm' (with 'k'). However, in the README examples, they use 'SnackeOrm' (with 'c'). This inconsistency may cause confusion.
fix
Use 'SnakeOrm' as the variable name (matching the package name), but destructure correctly.
affects: all
gotchaPackage does not support ES modules (ESM). Attempting to use 'import' will throw an error.
fix
Use CommonJS require() instead.
affects: all
gotchaDocumentation is minimal; methods like 'Bomb Method' (find) are not clearly explained. Expected behavior may differ from other ORMs.
fix
Refer to source code or experiment with small tests.
affects: all
gotchaDatabase drivers (mysql2 or sqlite3) must be installed separately; they are not included as dependencies.
fix
Install the required driver: npm install mysql2 or npm install sqlite3.
affects: all
Errors
Common errors & fixes
TypeError: Cannot destructure property 'SnakeModel' of '(intermediate value)' as it is undefined.
The require('snake-orm') returned undefined, possibly because the package is not installed or there is a typo in the require path.
fix
Ensure snake-orm is installed: npm install snake-orm. Check that the path is correct and no typos.
Error: Cannot find module 'mysql2' (or 'sqlite3')
Missing database driver dependency.
fix
Install the required driver: npm install mysql2 (or sqlite3).
TypeError: SnakeOrm.getOrCreateSnakeOrmProxy is not a function
Using import instead of require. The package does not support ESM.
fix
Change to const SnakeOrm = require('snake-orm');.
Upgrade
Version history
0.0.25latest on npm
Audit
Dependencies
mysql2optionalMySQL driver required when using MySQL dialect.
sqlite3optionalSQLite driver required when using SQLite dialect.
Agent activity
12 hits · last 30 days
node
10
Meta
1
Amazon
1
Resources