Registry / database / coffee-class-orm

coffee-class-orm

JSON →
library0.0.16jsnpmunverified

An ORM for Node.js that uses CoffeeScript classes to interact with MySQL databases. Version 0.0.16 is the latest (as of 2015), with no active releases since. It is a lightweight, CoffeeScript-specific alternative to heavier ORMs like Sequelize. Designed for rapid prototyping with CoffeeScript, it directly maps class definitions to database tables. No longer maintained; exists primarily as an artifact of CoffeeScript's early popularity.

npm install coffee-class-orm
INSTALL
IMPORT
SIG · COFFEE-CLASS-ORM
C
coffee-class-orm
databasejavascriptv0.0.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.

CoffeeORM
import CoffeeORM from 'coffee-class-orm'
const CoffeeORM = require('coffee-class-orm');
Package is CJS only, but intended to be used with CoffeeScript's class syntax. ES import is not supported.
Model
class User extends CoffeeORM.Model
class User extends CoffeeORM
CoffeeORM exports a factory function, not a class; use CoffeeORM.Model as base.
CoffeeORM (default)
CoffeeORM = require('coffee-class-orm')
require('coffee-class-orm').default
No default export; use the function directly.

Shows how to define a model with a database table, columns, associations, and save an instance.

CoffeeORM = require('coffee-class-orm') class User extends CoffeeORM.Model @table 'users' @columns 'id', 'name', 'email' @has_many 'posts' user = new User(name: 'Alice') user.save (err) -> console.log 'Saved user', user.id
Debug
Known issues
gotchaPackage is CoffeeScript-only; requires CoffeeScript to be installed and .coffee files to be compiled at runtime or precompiled.
fix
Install CoffeeScript and use .coffee files or compile to JS.
affects: all
deprecatedNo updates since 2015; may have unpatched security vulnerabilities in dependencies.
fix
Migrate to a maintained ORM like Sequelize or TypeORM.
affects: all
breakingOnly supports MySQL; no support for other databases.
fix
Use a different ORM for PostgreSQL, SQLite, etc.
affects: all
Errors
Common errors & fixes
ReferenceError: CoffeeORM is not defined
CoffeeORM not required or not installed
fix
Run `npm install coffee-class-orm` and add `CoffeeORM = require('coffee-class-orm')` at top of file.
TypeError: CoffeeORM.Model is not a constructor
CoffeeORM is not a function; Model is not a class
fix
Use `class User extends CoffeeORM.Model`; ensure CoffeeORM is required correctly.
Error: Cannot find module 'mysql'
MySQL driver not installed
fix
Run `npm install mysql` to add the peer dependency.
Upgrade
Version history
0.0.16latest on npm
Audit
Dependencies
mysqlrequiredMySQL database driver required for database interaction
Agent activity
7 hits · last 30 days
node
6
OpenAI (training)
1
Resources
coffee-class-orm — npm install coffee-class-orm · libregistry