MobX

Simple, scalable state management that reactively tracks observable state so derivations update only when what they actually read changes.

Library
npm
v7.0.0
28,203stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
87/100Excellent
Development Activity84
Maintenance88
Community76
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
87/100Excellent
Architecture90
Code Quality85
Innovation87
Learning Curve85

MobX is a battle-tested reactive state management library that makes application state observable and automatically tracks which values a computation reads, so derivations (computed values, autorun, reactions, and React observer components) update themselves only when the values they actually depend on change. There is no manual subscription list, selector, or memoization boundary to maintain by hand.

Originally built for React but usable with any UI layer or none at all, MobX ships as a zero-runtime-dependency TypeScript library with companion packages (mobx-react, mobx-react-lite) providing React bindings. It supports both a functional API (observable(), computed(), action()) and a class-based API via decorators or makeObservable()/makeAutoObservable(), and has remained actively maintained and API-stable across years of production use.

What You Get

  • The core mobx package (observable, computed, action, autorun, reaction, when, makeObservable, makeAutoObservable) with zero runtime dependencies
  • React bindings via the companion mobx-react and mobx-react-lite packages, including the observer() wrapper for automatic component re-rendering
  • A codemod package (mobx-undecorate) for migrating decorator-based code to the plain makeObservable API
  • An eslint-plugin-mobx package that enforces MobX-specific best practices, such as correct action wrapping and avoiding unintentional derivation side effects
  • CJS, ESM, and UMD builds plus hand-written TypeScript type definitions for direct browser, bundler, or Node usage

Common Use Cases

  • Managing shared application state in a React or React Native app without a Redux-style reducer/selector layer
  • Building deeply nested, frequently mutated UI state (spreadsheets, editors, admin dashboards) where fine-grained updates matter for performance
  • Wrapping async workflows (data fetching, polling, cancellable operations) in flow() so observable state stays consistent across await boundaries
  • Incrementally introducing reactivity into an existing class-based or imperative codebase via makeObservable() rather than rewriting state management wholesale

Under The Hood

Architecture MobX’s core algorithm lives in packages/mobx/src/core/ (atom.ts, derivation.ts, computedvalue.ts, reaction.ts, observable.ts, globalstate.ts). The central abstraction is the derivation (autorun/reaction/computed), which tracks which observables it read during its last run via an explicit dependency-state machine (NOT_TRACKING_/UP_TO_DATE_/POSSIBLY_STALE_/STALE_ in core/derivation.ts), letting MobX skip recomputation unless a shallow dependency actually changed value rather than merely because some parent changed. Observable state (types/observablearray.ts, observablemap.ts, observableobject.ts, observableset.ts, observablevalue.ts) wraps native JS structures behind Proxies or getter/setter pairs that call the same reportObserved/propagateChanged primitives atoms use, so any read inside a tracked function is registered as a dependency automatically. Actions (core/action.ts) batch mutations into a single transaction so reactions run once per logical update instead of once per field write. The public surface in api/ (observable.ts, computed.ts, autorun.ts, reaction.ts, action.ts, makeObservable.ts, flow.ts) is a thin layer of factory functions and decorators wiring together these core primitives, re-exported from a curated internal barrel (internal.ts) that also verifies globals like Map/Set/Symbol exist before the module initializes.

Tech Stack The package is written entirely in TypeScript and has zero runtime dependencies (packages/mobx/package.json declares an empty dependencies object), and it ships multiple build targets — CJS (dist/index.js), ESM (dist/mobx.esm.js), and a UMD bundle for direct browser use — plus hand-written .d.ts type definitions. It is built inside an npm-workspaces monorepo (the root package.json defines mobx, mobx-react, mobx-react-lite, mobx-undecorate, and eslint-plugin-mobx as sibling packages), using Jest 30 with ts-jest for tests, ESLint plus typescript-eslint and Prettier for style, Changesets for release/versioning, and Husky with lint-staged for pre-commit checks.

Code Quality Test coverage is substantial: packages/mobx/tests/base/ contains dozens of spec files covering the public surface (autorun.js, action.js, extendObservable.js, decorate.js, flow.js, strict-mode.js, spy.js, extras.js, and more), with dedicated suites for stage-3 decorators (tests/decorators_20223/) and a perf/ directory for microbenchmarks, run via jest/jest —coverage and tracked with a Coveralls badge in the README. Internal code uses an explicit naming convention — a trailing underscore on internal-only fields such as dependenciesState_ and observing_ — to visually separate private implementation state from the public API, and core files like derivation.ts and observable.ts are heavily commented, explaining the reasoning behind optimizations (for example, why the POSSIBLY_STALE state exists) rather than leaving the algorithm undocumented.

API Design MobX exposes a small number of composable primitives — observable, action, computed, autorun/reaction/when — that work as plain functions, ES decorators, or via makeObservable/makeAutoObservable for existing classes, so consumers can use class fields, plain object literals, or a functional style without changing the underlying reactivity model. React bindings are deliberately factored into separate mobx-react/mobx-react-lite packages rather than baked into core, keeping mobx itself framework-agnostic. Getting started requires very little boilerplate: makeAutoObservable(state) plus wrapping a render function in observer() is enough to get fully fine-grained reactivity, and the extensive documentation site (mobx.js.org) plus an interactive introductory tutorial keep the learning curve manageable.

Used by 14 apps in this directory

TypeScript
89%
Other

anytype-ts

Knowledge Management · Note Taking · Collaboration

8,665

A local-first, end-to-end encrypted knowledge OS that lets you build notes, tasks, wikis, and entire apps — with your data stored offline and synced peer-to-peer.

View details
88
Repo Health
78
Technical
67
Dependency
Built with
TypeScript89%
Updated yesterday
TypeScript
92%
GPL 3.0

Blinko

Knowledge Management · Note Taking

10,880

A self-hosted, AI-powered card note-taking tool that lets you capture fleeting thoughts instantly and retrieve them with natural language search.

View details
83
Repo Health
69
Technical
65
Dependency
Built with
TypeScript92%
Updated 2 weeks ago
JavaScript
90%
Other

CodeSandbox

Code Editors · Developer Tools

13,633

Instantly ready browser-based IDE that runs full npm dependency resolution and transpilation entirely client-side, with no server needed.

View details
65
Repo Health
76
Technical
63
Dependency
Built with
JavaScript90%
Updated 1 months ago
TypeScript
76%
MIT

faved

Knowledge Management · Bookmarks Archiving · Note Taking

1,267

A private, self-hosted bookmark manager built for large collections—nested tags, PWA support, and zero cloud dependency.

View details
71
Repo Health
60
Technical
78
Dependency
Built with
TypeScript76%
PHP22%
Updated 2 weeks ago
Go
68%
MIT

Gotify

Monitoring · Developer Tools

15,752

A lightweight, self-hosted push notification server that sends and receives messages in real time over WebSocket, with a sleek web UI and a native Go plugin system.

View details
89
Repo Health
74
Technical
71
Dependency
Built with
Go68%
TypeScript30%
Updated 3 days ago
TypeScript
38%
Apache 2.0

Label Studio

AI Development · Data Engineering

28,083

Label Studio is an open-source, multi-type data labeling platform that lets teams annotate images, text, audio, video, and time series data with a configurable XML-based UI and export annotations in formats ready for any ML framework.

View details
93
Repo Health
87
Technical
68
Dependency
Built with
TypeScript38%
JavaScript27%
Python25%
Updated today
TypeScript
55%
Other

OpenReplay

Analytics

12,525

Self-hosted session replay and product analytics suite that lets you see exactly what users do on your web app — without sending data to third parties.

View details
91
Repo Health
77
Technical
72
Dependency
Built with
TypeScript55%
Go12%
Python10%
Updated yesterday
TypeScript
97%
Other

Outline

Knowledge Management · Collaboration

40,236

A fast, real-time collaborative knowledge base for growing teams built on React, Node.js, and ProseMirror.

View details
91
Repo Health
87
Technical
69
Dependency
Built with
TypeScript97%
Updated yesterday
TypeScript
70%
AGPL 3.0

Plane

Productivity · Project Management · Collaboration

56,127

Open-source project management platform to replace Jira, Linear, and ClickUp — with built-in cycles, real-time collaborative docs, and full self-hosting.

View details
89
Repo Health
82
Technical
77
Dependency
Built with
TypeScript70%
Python26%
Updated 2 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search