ARM JS Library
ARM (API Resource Manager) centralizes data management and simplifies API interactions for JavaScript applications. It organizes fetched data into reactive collections, deduplicates in-flight requests automatically, and gives every record a consistent set of read/write/save methods - so components bind directly to live, observable data instead of hand-rolled loading/error state.
npm install arm-js-library --saveGet started · API reference · Guides
Core functionalities
- Centralized data storage - every fetched record lands in a named collection, acting as a single source of truth for that resource across your app.
- API interactions - one consistent set of methods (
query,queryRecord,findAll,findRecord) covers the common read patterns;ajaxdrops down to raw Axios when you need it. - Request deduplication - every request is hashed from its full config; a matching in-flight or resolved request is reused instead of re-fetched, unless you explicitly bypass it with
skipId. - Reactive records - collections are MobX
observablearrays, so bound components re-render automatically when a record’s data changes, loads, or errors. - Root scope - a small global key/value store for state that doesn’t belong to any one collection.
Key features
- Record lifecycle -
get/set/setPropertiesfor reads and writes,save/reload/destroyRecordfor server round-trips,rollbackAttributesto discard local edits - injected onto every record automatically. - Dirty tracking - every
setcall runs a deep-equality check against the record’s last-synced state to keepisDirty/isPristineaccurate, with no manual bookkeeping. autoResolveflag - request methods return a reactive, bindable object by default; passautoResolve: falsefor the raw AxiosPromiseinstead, when you’d ratherawaitand manage loading state yourself.- JSON:API-friendly - understands
includedpayloads and relationship data out of the box viasetPayloadIncludeReferenceandrecord.getCollection(). - Utility belt -
findBy,filterBy,groupBy,sortBy,sumBy, and the rest of a small Lodash-backed helper set, usable on any array - not just ARM collections.
Benefits
Centralizing data access removes the usual pile of duplicated useState/useEffect fetch
boilerplate: components read and write through the same collection, caching and
deduplication happen for free, and the dirty/pristine/loading state that’s normally
hand-rolled per component comes attached to every record already.
Last updated on