GithubHelp home page GithubHelp logo

johnknapp / mobx-orm Goto Github PK

View Code? Open in Web Editor NEW

This project forked from appjudo/mobx-orm

0.0 0.0 0.0 142 KB

MobX-based ORM for API resources and other asynchronous data sources

License: Other

JavaScript 6.82% TypeScript 93.18%

mobx-orm's Introduction

MobX ORM

An object-relational mapping (ORM) library providing convenient MobX-based abstractions for API resources and other asynchronous data sources.

Core Ideas

Repository pattern: mobx-orm uses the Repository design pattern (popular in C# database access) to represent RESTful API resources. Each repository encapsulates the AJAX mechanics of a related API endpoints of single type of data (e.g. User, Product, etc.) and abstracts these concerns into a simple set of CRUD methods, along with a client-side cache of data already fetched and returned from the API server.

Asynchronous observables: Each data query immediately returns a MobX observable object or array, initially empty, with observable properties to indicate when the data requested has been returned from the API server (or other data source) and populated into the object/array. These asynchronous observables can be used immediately to render React components, checking the isLoading property to first render a loading indicator, and then show the loaded data on the second render (triggered automatically by mobx-react's observer component wrapper). Each of these observables also has a promise property containing a JavaScript Promise, which can be awaited or chained with then or catch to perform follow-up actions.

Random-access pagination: mobx-orm provides a paginated observable array structure allowing any arbitrary page index to be loaded in any order. This can be used out of the box for standard pagination or infinite scrolling interfaces, or combined with react-virtualized or react-window for virtual scrolling.

Client-side models: mobx-orm is written in TypeScript, and developers are encouraged to write their own client-side model classes in ES2015+ or TypeScript. The base Model class provides useful methods to interact with each model object's source repository and send changes back to the server.

API abstraction: mobx-orm allows API consumers to structure their own client-side models and other abstractions for server-side data, which can make data much easier to work with on the client side, and can also streamline the syntax and formatting of data from multiple disparate data sources, such as different versions of an evolving API or multiple APIs published by separate organizations.

Roadmap

  • Documentation
  • Automated tests
  • Support for MobX 5
  • Relationship decorators
  • Service abstractions
  • Snapshots

Contributing

Please see our guide to contributing.

License

mobx-orm is licensed under the MIT License.

Copyright © 2017-2020 AppJudo Inc. and its affiliates.

mobx-orm's People

Contributors

svicalifornia 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.