Giter VIP home page Giter VIP logo

joist-ts's Introduction

npm CircleCI

joist-ts

An opinionated ORM for TypeScript/node.

Goals

  • Schema-Driven Code Generation (continually-generated classes w/the getter/setter/relation boilerplate)
  • Guaranteed N+1 safe (pervasive use of DataLoader)
  • All Relations are Async/Await (with a type-safe escape hatch)
  • Best-in-class Performance (all SELECT/INSERT/UPDATE operations are bulk)
  • Fast Unit Tests (for downstream projects, baseline is 10-20ms/test case)
  • Unit of Work (navigate between entities as a consistent graph)
  • Small & simple codebase (maintainable by a single engineer if needed)

(See goals for more in-depth descriptions of each bullet and misc features for "kinda like docs" highlights of things.)

(Also see Schema Assumptions for the assumptions Joist makes about your database schema.)

Non-Goals

  • NoSQL/Mongo/etc. support.
  • Anything-but-Postgres support at this point.
  • Browser/client-side support

Status

Joist is currently used in production at Homebound. All of the features should generally be solid/working, with a caveat that fill a bug report if you run into anything.

Install

See Getting Started and the integration-tests, which is essentially a sample app with a domain model of Author, Book, etc. entities.

Documentation

Lack of documentation is currently Joist's biggest pain point.

The current "best" documentation sources are:

Building Joist

After checkout:

  • Run yarn install
  • Run yarn build
  • cd packages/integration-tests
  • Run make db to boot up a Docker postgres instance w/the integration test schema.
  • Run yarn test to run the tests.
  • Prior to committing your changes, please run yarn workspaces run format

Todo

In general priority/itch order:

  • Open source joist-graphql-utils with the entityResolver logic in it
  • Fix reactive rules not catching "middle-references" changing (fixed?)
  • Optionally move begin to the start of Unit of Work
  • readonly asyncValue that integrations into populate
  • Add Collection.load(loadHint) (see branch, potential tsc 3.9 issue)
  • Support user-defined types
    • Hack day: CalendarInterval that matches *_start_date, *_end_date, _duration_in_days
      • Would need to be able to add to Opts, Filters, derivedValue?
  • LargeCollection support
    • I.e. joist-config.json entry to mark (say) publisher.authors as "too big to never read at once" and use a different/restricted API, i.e. forced paging
  • JSON support, i.e. toJSON
  • First-class support for soft deletion?
  • Op locks/version column?
  • An in-memory backend
  • hasOneThrough that can be used as find/SQL filters
    • Need to declare in codegen to a) add to FilterType + b) verify once traverses relations

History / Inspiration

Joist is also the name for a Java-based ORM I wrote circa 2008.

joist-ts has many of the same ideas (in terms of opinionated codegen), just applied to TypeScript, and leveraging DataLoader.

The EntityManager.find syntax is heavily inspired from MikroORM, as well as the concept of EntityManager.populate.

License

MIT

joist-ts's People

Contributors

alexkuang avatar blimmer avatar chr1sjf0x avatar haislip avatar lucyconklin avatar mmeinzer avatar nickallmakeropscompass avatar stephenh avatar zgavin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.