JSORM the isomorphic, framework-agnostic Javascript ORM
Why JSORM?
Contracts like JSONAPI and GraphQL treat the API like a database. When querying a database, we have two options:
- Type the low-level query language directly (in the database world, this would be hand-typing SQL).
- Use an ORM (like Rails’s
ActiveRecord
, Phoenix’sEcto
, Django’sDjangoORM
, or Node’sSequelize
).
While both options have pros and cons, we tend to think ORMs have two overwhelming benefits: ease of use and composable queries. We’ll explore both these concepts in other sections.
So, we want a javascript ORM for our JSONAPI “database”. Because
ActiveRecord
is arguably the most well-known ORM, we’ve tried to match
its interface to make this library accessible to new users. That said,
you’ll find we’ve tried to favor explicitness over implicitness in
order to avoid common ActiveRecord
pitfalls.