Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including related with all npm packages installed. Try it out:

var related = require("related")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

related v2.16.0

Unopinionated ORM for relational databases

Related ORM

ORM for relational databases.

npm Travis GitHub license node

On the fly builds an extensive API representing your database and its tables including their relations and columns. No need to write javascript models.


  • Supports Postgres & MySQL
  • Simple loading and filtering of nested entities
  • Advanced query builder that rocks
  • Transactions
  • Table locks
  • Bulk operations
  • User extendable models (optional)
  • Connection pooling
  • Extensions for soft-deletes, nested sets, multilingual content, geo distance computation and reference counting
  • Complex DB Cluster support (includes read replicas and failover on AWS RDS)
  • No conventions for column names etc.
  • Commercial support avialable
  • And much more
var Related = require('related');

// The ORM looks at your database and builds on the fly models. 
// You can start working on your database immediatelly. 
new Related({
      schema        : 'mySchemaName' // optional
    , database      : 'myDatabaseName'
    , type          : 'postgres'     // or mysql
    , hosts: [{
          host      : 'localhost'
        , username  : 'postgres'
        , password  : ''
        , maxConnections: 20
        , pools     : ['master', 'read', 'write']
}).load().then(function(orm) {

    // get 10 events, their images, their tags, their categories, their venues,
    // the venues images, the venues types. the 'get' prefix change sscope to the other model
    // the 'fetch' prefix doenst change the scope and you can continue working on the current
    // model
    orm.event({id:}, ['*'])
        .find().then(function(events) {

    }).catch(function(err) {

        log('something went wrong :(');


We are currently working on an extensive documentation and a website. Until those are online please look at the tests


RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free