Registry / database / simple-sql-orm

simple-sql-orm

JSON →
library1.0.9jsnpmunverified

A lightweight SQL ORM for Node.js inspired by Laravel's query builder, allowing fluent method chaining (table, where, select, orderBy, groupBy, skip/take, aggregate functions) and raw queries. Version 1.0.9 is the latest, released with minimal documentation and no clear release cadence. Key differentiators: simple API, MySQL-only, no TypeScript support, no connection pooling, no migrations. Suitable for small projects but lacks advanced features and has limited community adoption.

npm install simple-sql-orm
INSTALL
IMPORT
SIG · SIMPLE-SQL-ORM
S
simple-sql-orm
databasejavascriptv1.0.9
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.

ORM
import { ORM } from 'simple-sql-orm'
const orm = require('simple-sql-orm')
The package exports an ORM class; CommonJS require with destructuring is correct: const { ORM } = require('simple-sql-orm').
QueryTypes
import { QueryTypes } from 'simple-sql-orm'
const QueryTypes = require('simple-sql-orm').QueryTypes
Named export for raw query types. Ensure proper destructuring.
default import
import ORM from 'simple-sql-orm'
import { ORM } from 'simple-sql-orm'
The package does not have a default export; only named export { ORM } and { QueryTypes }.

Shows instantiation and basic query building with promises. The ORM returns promises for async operations.

const { ORM } = require('simple-sql-orm'); // Initialize ORM with host, database, user, password, port const orm = new ORM('localhost', 'mydb', 'root', 'mypass', 3306); // Example: get all users orm.table('users').get().then(users => { console.log(users); }).catch(err => { console.error(err); }); // Example: complex query orm.table('users') .select('id', 'name') .where('active', true) .orderBy('name', 'asc') .skip(0) .take(10) .get() .then(rows => console.log(rows));
Debug
Known issues
gotchaThe package uses MySQL driver without connection pooling; each query creates a new connection unless managed manually.
fix
Consider using a connection pool wrapper or switch to a more robust ORM like Sequelize.
affects: <=1.0.9
breakingThe `groupBy` method example in README shows incorrect output; it applies groupBy on first_name but outputs `GROUP BY 'users'.'id'`.
fix
Verify actual behavior; expected: `GROUP BY first_name`.
affects: <=1.0.9
gotchaThe ORM does not sanitize inputs; where conditions with array values use IN clause directly, but string interpolation may lead to SQL injection if values are unsanitized.
fix
Always validate and escape user inputs before passing to ORM methods.
affects: <=1.0.9
gotchaImport path issue: Some users try to import as default, but only named exports exist.
fix
Use `import { ORM } from 'simple-sql-orm'` or `const { ORM } = require('simple-sql-orm')`.
affects: <=1.0.9
deprecatedNo TypeScript definitions; package may not work with strict TypeScript configurations.
fix
Create your own declaration file or use with `// @ts-ignore`.
affects: <=1.0.9
Errors
Common errors & fixes
Cannot find module 'simple-sql-orm'
Package not installed or npm install not run.
fix
Run `npm install simple-sql-orm` in your project directory.
TypeError: ORM is not a constructor
Incorrect import: using default import when only named export exists.
fix
Use `const { ORM } = require('simple-sql-orm')` or `import { ORM } from 'simple-sql-orm'`.
Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client
MySQL 8+ uses caching_sha2_password by default; older mysql npm package may not support it.
fix
Use `npm install mysql2` instead of `mysql` and change connection logic, or alter MySQL user to use mysql_native_password.
TypeError: orm.table(...).get is not a function
Missing parentheses or chaining error: `orm.table('users').get` without calling `get()`.
fix
Ensure methods are invoked with parentheses: `orm.table('users').get()`.
Upgrade
Version history
1.0.9latest on npm
Audit
Dependencies
mysqlrequiredrequired for MySQL database connections
Agent activity
6 hits · last 30 days
node
4
Meta
2
Resources
simple-sql-orm — npm install simple-sql-orm · libregistry