Skip to content
Automatic relationship management for JavaScript objects.
JavaScript HTML
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Automatic relationship management for JavaScript objects.

Relationships are defined as first class objects, e.g. ParentChild(parent,child).

Subsequent to relation definition, modifications to either party in a relation force updates on the other. For example, parent.children.add(child) automatically ensures child.parents.includes(parent) is true. And, child.parents.delete(parent) automatically ensures parent.children.includes(child) is false.

Many-to-many, one-to-many, many-to-one, and one-to-one relationships are supported. When a relationship is of type "many", a specific cardinality can be enforced, e.g. 2.

A shorthand notation supports symmetric relationships like Brother. Additionally, symmetric relationships are automatically created, e.g. defining ParentChild automatically defines ChildParent.

Objects participating in relationships can be automatically instanceof checked and relationships can be inherited down the JavaScript prototype tree.


npm install relation-manager

The index.js and package.json files are compatible with so that relation-manager can be served directly to the browser from the node-modules/relation-manager directory when using node Express.

Browser code can also be found in the browser directory at


Here are some example relation definitions:

	{class: Person, relation:"parent", property:"parents", cardinality:Infinity, unique:true},
	{class: Person, relation:"child", property:"children", cardinality:Infinity, unique:true});
	{class: Person, property:"husband", cardinality:1},
	{class: Person, property:"wife", cardinality:1});
	{class: Person, relation:"brothers", property:"brothers", cardinality:Infinity, unique:true});
	{class: Person, relation:"owner", property:"owner", cardinality:1},

More detailed documentation will be available in v0.0.4.

Building & Testing

Building & testing is conducted using Travis, Mocha, Chai, and Istanbul.


This package requires a full Proxy implementation. The Proxy implementation for Chrome looks like it will be in v50.X, which is currently in beta. The package will not work in Node.js until the most recent v8 engine is added to Node.js.

Updates (reverse chronological order)

2016-03-02 v0.0.4 Added unit tests, more class validation, usage documentation.

2016-03-01 v0.0.3 Initial public release.

You can’t perform that action at this time.