Introducing Coinbase Open Source Fund

February 2018 Donations

For our first batch, we focused on supporting larger Javascript projects which we’re using across several Coinbase web products, including Coinbase.com and GDAX.com.

  1. Mobx — $1000
  2. Webpack — $500
  3. Babel — $500
  4. Styled-components — $500

Project highlight: MobX

MobX is designed to enable building web applications with a complex data model in an intuitive and very performant manner. Using React and MobX is currently the simplest way to build component based web applications.

Single page web application state management is notably a hard problem to solve in large projects. Unlike projects like Backbone and Vue, which included their own state management solutions, React ecosystem has gone through a lot of iterations when it comes to state libraries and patterns. While it’s easy to get started with React’s build-in setState, it doesn’t scale well for larger applications and it forces you to bundle your application logic with view logic.

MobX is a small but full-fledged state library for React applications. Together with its React sister library, mobx-react, it’s almost as easy to as setState to get started with, but it also scales easily to larger applications. Unlike Redux, another popular state management library, which usually is coupled with other libraries to better handle asynchronous API calls and memoized selectors, MobX is very much a “batteries included” solution with a minimal API.

Example code above includes a simple React component with separated state store, which fetches data from an external API, shows a loading indicator and handles errors. Thanks to observer, component is updated automatically after state values are updated and computed memorizes derived values automatically. While not part of the current Javascript spec, using decorators is a common pattern in MobX applications to reduce boilerplate and make the code more readable.

Both Coinbase and GDAX have been using MobX in production for over a year at this point and it has proven to be extremely stable and reliable. Thanks to its simplicity, getting new developers onboarded to the codebase is easy and fast.

MobX was created by Michel Weststrate, a Javascript developer living in The Netherlands, who still leads and maintains the project. Originally published in 2015, there has since been 149 releases to the project and its currently on v3. Next major release, v4, is currently under active development.

Michel still accounts for the majority of the code contributions to the core library but majority of the new development is done on mobx-state-tree package, which is a more opinionated state container build on top of core MobX library. If you’re looking for a simple state manager, it’s worth a look.

Thanks for all the hard work Michel and other contributors have put into MobX. It has helped us build products faster and help Coinbase scale. We can’t wait to share more project highlights in the coming months!

Be the first to comment

Leave a Reply

Your email address will not be published.


*