An ORM for Backbone-Relational.


This module is absolutely not ready for any usage, as it is in very early development. Pull requests are welcome, but be aware that everything may change very fast; your relevant pull request today may not be relevant tomorrow.

A simple npm install backbone-relational-mapper should do the trick. Open an issue if it doesn't.

You also need a database driver: npm install pg (the only supported database is Postgres at the moment).

First you need to configure your database connection:

  dialect: 'postgres'
  host: 'localhost'
  database: 'my_database'
  user: 'my_user'
  password: 'my_password'

You should only need to do this once; it should persist across calls to require().

Then, you should define your models as you would do in Backbone-Relational, with an added fields object:

class SomeModel extends Backbone.RelationalModel

    some_text_field: 'TEXT'