JSORM the isomorphic, framework-agnostic Javascript ORM

Start here: Why JSORM?

Typescript
Javascript
// JSORM is like "ActiveRecord in Javascript". It can:
//
// * Deeply nest reads and writes
// * Automatically handle validation errors
// * Replace *ux patterns
// * ...and much more!

// define models
@Model()
class ApplicationRecord extends JSORMBase {
  static baseUrl = "http://my-api.com"
  static apiNamespace = "/api/v1"
}

@Model()
class Person extends ApplicationRecord {
  static jsonapiType = "people"

  @Attr() firstName: string
  @Attr() lastName: string

  get fullName() {
    return `${this.firstName} ${this.lastName}`
  }
}

// execute queries
Person
  .where({ first_name: 'John' })
  .order({ created_at: 'desc' })
  .per(10).page(2)
  .includes({ jobs: 'company' })
  .select({ people: ['first_name', 'last_name'] })

// persist data
let person = new Person({ firstName: 'Jane' })
person.save()
    
// JSORM is like "ActiveRecord in Javascript". It can:
//
// * Deeply nest reads and writes
// * Automatically handle validation errors
// * Replace *ux patterns
// * ...and much more!

var jsorm = require('jsorm')

// define models
const ApplicationRecord = jsorm.JSORMBase.extend({
  static: {
    baseUrl: 'http://my-api.com',
    apiNamespace: '/api/v1'
  }
})

const Person = ApplicationRecord.extend({
  attrs: {
    firstName: jsorm.attr(),
    lastName: jsorm.attr()
  },
  methods: {
    fullName: function() {
      return this.firstName + ' ' + this.lastName;
    }
  }
})

// execute queries
Person
  .where({ first_name: 'John' })
  .order({ created_at: 'desc' })
  .per(10).page(2)
  .includes({ jobs: 'company' })
  .select({ people: ['first_name', 'last_name'] })

// persist data
var person = new Person({ firstName: 'Jane' })
person.save()