HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
mobxjs
mobx-state-tree
TypeScript2016–2022
mobxjs / mobx-state-tree

mobx-state-tree

Full-featured reactive state management without the boilerplate

18Distinct people
21Mentions
1Explicit recommenders
7.1KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

Full-featured reactive state management without the boilerplate

GitHub

Where it is used

No documented product use was verified in the last source check.

What people are saying

For those that haven't tried, I recommend pairing with mobx-state-tree. https://github.com/mobxjs/mobx-state-tree

ralusek used a recommendation phrase. One indexed comment matches. This is a phrase match, not a verdict.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 3:56:07 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year21 dated mentions

Observed mentions: 2016-11-23 19:20:54 UTC to 2022-12-26 07:04:09 UTC.

024682016-01-01 00:00:00 UTC to 2017-01-01 00:00:00 UTC (exclusive): 1 mentions; 1 submissions, 0 comments20162017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments2018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 8 mentions; 0 submissions, 8 comments2019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 5 mentions; 0 submissions, 5 comments20192020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments2021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2022

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20162016-01-01 00:00:00 UTC2017-01-01 00:00:00 UTC110
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC303
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC808
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC505
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC303
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC000
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC101

From the project README

An excerpt from the repository, fetched Nov 13, 2026.

Read the project’s introduction
mobx-state-tree What is mobx-state-tree? Technically speaking, mobx-state-tree (also known as MST) is a state container system built on MobX, a functional reactive state library. This may not mean much to you, and that’s okay. I’ll explain it like this: MobX is a state management "engine", and MobX-State-Tree gives it structure and common tools you need for your app. MST is valuable in a large team but also useful in smaller applications when you expect your code to scale rapidly. And if we compare it to Redux, MST offers better performance and much less boilerplate code than Redux! MobX is one of the most popular Redux alternatives and is used (along with MobX-State-Tree) by companies worldwide. MST plays very well with TypeScript, React, and React Native, especially when paired with mobx-react-lite. It supports multiple stores, async actions and side effects, enables extremely targeted re-renders for React apps, and much more -- all in a package with zero dependencies other than MobX itself. Note: you don't need to know how to use MobX in order to use MST. Getting started See the Getting started tutorial or follow the free egghead.io course. 👉 Official docs can be found at http://mobx-state-tree.js.org/ Quick Code Example There's nothing quite like looking at some code to get a feel for a library. Check out this small example of an author and list of tweets by that author. import { types } from "mobx-state-tree" // alternatively: import { t } from "mobx-state-tree" // Define a couple models const Author = types.model({ id: types.identifier, firstName: types.string, lastName: types.string }) const Tweet = types.model({ id: types.identifier, author: types.reference(Author), // stores just the `id` reference! body: types.string, timestamp: types.number }) // Define a store just like a model const RootStore = types.model({ authors: types.array(Author), tweets: types.array(Tweet) }) // Instantiate a couple model instances const jamon = Author.create({ id: "jamon", firstName: "Jamon", lastName: "Holmgren" }) const tweet = Tweet.create({ id: "1", author: jamon.id, // just the ID needed here body: "Hello world!", timestamp: Date.now() }) // Now instantiate the store! const rootStore = RootStore.create({ authors: [jamon], tweets: [tweet] }) // Ready to use in a React component, if that's your target. import { observer } from "mobx-react-lite" const MyComponent = observer((props) => { return <div>Hello, {rootStore.authors[0].firstName}!</div> }) // Note: since this component is "observed", any changes to rootStore.authors[0].firstName // will result in a re-render! If you're not using React, you can also "listen" to changes // using `onSnapshot`: https://mobx-state-tree.js.org/concepts/snapshots Thanks! Michel Weststrate for creating MobX, MobX-State-Tree, and MobX-React. Infinite Red for supporting ongoing maintenance on MST. Mendix for sponsoring and providing the opportunity to work on exploratory projects like MST. Dan Abramov's work on Redux has strongly influenced the idea of snapshots and transactional actions in MST. Giulio Canti's work on tcomb and type systems in general has strongly influenced the type system of MST. All the early adopters encouraging to pursue this whole idea and proving it is something feasible.
Read the full README on GitHub

What Hacker News says

21 sources
mobx-state-tree (https://mobx-state-tree.js.org/) Benefits of it over mobx is data normalization with references and JSON patches which allow you sync complex state easily. Typed models are also a plus. Drawbacks are performance (see https://github.com/mobxjs/mobx-state-tree/issues/1267). Previously was using immer, which I loved because of immutability but moved off since classes and OOP didn't feel as natural as in mst. If I were to pick an alternative, might try redux with normalization https://redux.js.org/usage/structuring-reducers/normalizing-.... And if I were to build a state management tool, I would prioritize a library that has - immutability - JSON patches and snapshots - data normalization with references - schemas / models compatible with zod
In Ask HN: What is your favorite front end state management solution?
Awesome post, thanks for writing and sharing it. "The idea of the app logic producing an explicit tree mutation while holding an immutable reference to the old state of the tree feels very functional, though the app state itself is mutable. Even so, I haven’t seen this particular pattern in the functional programming UI literature (hopefully readers can fill me in). " IIUC, this sounds a lot like what MWeststrate does with Mobx-State-Tree^1 1. https://github.com/mobxjs/mobx-state-tree
In Towards Principled Reactive UI
I've used a few similar libraries [0][1][2] and wrote one for a personal project. If we categorize them as embedded DSLs for runtime type checking with some support for static interop, they all share three major flaws: 1. Sub-optimal developer experience: significantly noisier syntax compared to pure typescript, convoluted typescript errors, and slower type checking. 2. Unfixable edge cases in static type checking: Features like conditional types work less reliably on the types produced by the library. 3. Some typescript features can't be supported in the library (again, conditional types). I think a better way to approach the runtime+static type checking is to do it as a babel plugin, which would fix the DX and edge-case problems and also gracefully degrade in the case of typescript features that can't work in runtime. Since babel can no
Read the rest
w parse typescript, it is trivial to write a babel plugin that takes regular typescript files and converts their type annotations into runtime values [4]. Those values can then be fed into a simpler type checking library, giving us runtime type checking on top of the native static type checking experience. [0] https://github.com/gcanti/io-ts [1] https://github.com/pelotom/runtypes [2] mobx-state-tree also has a schema validation library that works to some extent statically: https://github.com/mobxjs/mobx-state-tree/ [3] https://github.com/gcanti/io-ts#branded-types--refinements [4] https://gist.github.com/AriaMinaei/2f1229178abad4363f5180db2...
In Designing the perfect TypeScript schema validation library
Yeah, this is something I had hoped for as well. Mobx-state-tree [1] also makes use of generators for asynchronous tasks and typescript's inability to infer types of values returned from a yield is a pain. But fortunately, atleast in this particular case the usage semantics are really close to async/await so I have had success using a babel macro [2][3] to transform async functions to generators which restores type-safety. This is of-course a hack but has proven to work fairly well in practice. [1] https://github.com/mobxjs/mobx-state-tree [2] https://github.com/kentcdodds/babel-plugin-macros [3] https://github.com/ts-delight/async-to-generator.macro
In TypeScript 3.6
Having experimented with and used proxies a decent amount, the MDN page is my goto reference when I need to use them: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe... The biggest pitfalls, in my experience are 1. Infinite recursion when implementing get and printing proxies with console.log in node.js (which attempts to access properties from the object prototype which can lead to infinite recursion problems). 2. Performance, which I would need to do more digging and benchmarking to comment on in more depth. Some libraries that use Proxies to great effect are the https://github.com/mobxjs/mobx-state-tree and https://github.com/mweststrate/immer libraries both by mweststrate
In Meta Programming in JavaScript with Proxies
I recently started looking at mobx-state-tree[1] and I feel like it solves a lot of the boilerplate needed with redux in a very nice opinionated way. In particular it has built in support for tracking action history (as list of patches and snapshot), building views of computed values (selectors), organizing async action flows, and colocating all of this logic in a single model class. It can be used on top of redux but it won't really look like redux code anymore. But since you're using immer in the starter, it wasn't going to look like redux anyway (e.g., ton of triple dots everywhere). Do you have any opinion on mobx-state-tree? Maybe you should just bless mobx-state-tree in the starter too? (immer is built by the same mobx guy) [1] https://github.com/mobxjs/mobx-state-tree (I have not actually use the library yet. Secretly hoping you'll
Read the rest
will tell me about all the cons so I don't have to do the research myself. Currently choosing a library based on which has the best saga-like support)
In Show HN: I Built a Metasearch Engine with React, Redux, Express and TypeScript
Performance was my main concern with MST, most notably if your data modelling involves A LOT of entities, things can get slow: https://github.com/mobxjs/mobx-state-tree/issues/440. Binding methods on every instance of an object is a lot of overhead. I really liked using MST when I spent a few days fiddling with it. However, I really don't want to get trapped with perf bottlenecks I can't easily fix. Whether I'd actually run into trouble - I have no idea, but vanilla MobX is excellent enough that I'm happy sticking with it. I'd love to use MST more though.
In Redux – Not Dead Yet

Showing the 15 most recent of 21 sources. Enable JavaScript to search and browse every indexed mention.

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.