npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

mobx-model

v1.0.13

Published

Simple model with attributes and relations updated from json

Readme

Mobx-model 1.0 npm version

This is a library to simplify mobx data stores that mimic backend models. It includes simple class that makes API requests and executes callbacks on success/failure. Model attributes and relations are then updated from server-side json. Note that you will need es6 support with static properties to use mobx-model.

The idea is to have single source of truth — graph of model objects that reference each other. Each model class holds collection of cached model instances available through Model.all() and Model.get(:id) methods.

Mobx-model is not a replacement for Backbone.Model since it supports single source of truth principle. Model instance methods that are created by defining attributes and relations are intended to be used as a way to access state of the models. To hydrate the state you have to use set method on an instance or a class, that will set or update your model attributes and trigger re-renders on appropriate components thanks to mobx-react.

You can also define actions on model classes or instances or on the BaseModel itself that will communicate with your data store — API, localstorage or whatever you need, just make sure to call set when you need to update state of the models.

This library is not perfect, but it works for us together with Rails + ActiveModel Serializers 0.8.3 on the backend, making work with normalized database structure much easier. If you want to make it work with your backend setup then raise an issue — I'll be glad to help you out to make library universal.

Note that currently polymorphic associations are not supported, though there are some workarounds.