Synapsev6.0.0

Install

One package — synapse-storage. The core pulls in no extra dependencies: rxjs and react are only needed if you use the matching layer.

Installing the package

bash
# npm
npm install synapse-storage

# yarn
yarn add synapse-storage

# pnpm
pnpm add synapse-storage

Optional peer dependencies

Install them as needed — only for the layers you actually use:

bash
# effects on RxJS (the synapse-storage/reactive layer)
npm install rxjs

# React hooks and SSR (the synapse-storage/react layer)
npm install react react-dom

Need only the reactive store (MemoryStorage, selectors, dispatcher)? A single synapse-storage is enough — no rxjs, no react.

Imports by layer (sub-entrypoints)

The library is split into sub-packages so that only what you need ends up in the bundle. Import from a specific layer, not from the root:

typescript
import { MemoryStorage, LocalStorage, Selectors } from 'synapse-storage/core'
import { Dispatcher, createEffect } from 'synapse-storage/reactive'
import { useStorageSubscribe, createSynapseCtx } from 'synapse-storage/react'
import { createSynapse, createEventBus } from 'synapse-storage/utils'
import { ApiClient } from 'synapse-storage/api'
EntrypointWhat's insideRequires
synapse-storage/coreStorages (MemoryStorage, LocalStorage, IndexedDBStorage), middleware, selectors
synapse-storage/reactiveDispatchers (Dispatcher) and Redux-Observable-style effectsrxjs
synapse-storage/reactReact hooks (useStorageSubscribe) and the SSR wrapper (createSynapseCtx)react, react-dom
synapse-storage/utilscreateSynapse, createEventBus, createSynapseAwaiter, dehydrateModule
synapse-storage/apiHTTP client with tag-based caching

The package is ESM-only ("type": "module"). CommonJS require is not supported.

See also

  • createSynapse (basic) — where to start assembling a module.

  • MemoryStorage · LocalStorage — your first storages.