README.md

February 13, 2026 ยท View on GitHub

StateLoom

Universal state management SDK for JavaScript and TypeScript

npm version CI status License Coverage


One reactive core. Three paradigms. Every framework.

StateLoom provides a signal-based reactive core with paradigm adapters (Store, Atom, Proxy) and framework adapters (React, Vue, Solid, Svelte, Angular). Pick the mental model you prefer, use it in any framework, and compose middleware for persistence, devtools, sync, and more.

Why StateLoom?

  • Signal-based core (~1.5 KB gzipped) -- push-pull hybrid reactivity aligned with the TC39 Signals proposal
  • Three paradigms, one core -- Store (Zustand-style), Atom (Jotai-style), Proxy (Valtio-style) all built on the same signal graph
  • Every major framework -- React, Vue, Solid, Svelte, Angular with thin, idiomatic adapters
  • SSR-first -- per-request scope isolation prevents state leakage between server requests
  • Composable middleware -- persistence, devtools, tab sync, history, telemetry as independent packages
  • TypeScript-first -- strict types with full inference, no any, no enums, named exports only
  • Tree-shakeable -- pay only for the packages you use

Paradigm Comparison

StoreAtomProxy
Mental modelSingle object with actionsBottom-up compositionMutable syntax, immutable snapshots
Inspired byZustand, Redux ToolkitJotai, RecoilValtio, MobX
Best forApp-wide state with actionsFine-grained, derived stateRapid prototyping, mutable APIs
MiddlewareYesNoNo
Package@stateloom/store@stateloom/atom@stateloom/proxy

Quick Start

Store (Zustand-style)

import { createStore } from '@stateloom/store';

const counterStore = createStore((set) => ({
  count: 0,
  increment: () => set((state) => ({ count: state.count + 1 })),
  reset: () => set({ count: 0 }),
}));

counterStore.getState().increment();
console.log(counterStore.getState().count); // 1

Atom (Jotai-style)

import { atom, derived } from '@stateloom/atom';

const countAtom = atom(0);
const doubledAtom = derived((get) => get(countAtom) * 2);

countAtom.set(5);
console.log(doubledAtom.get()); // 10

Proxy (Valtio-style)

import { observable, snapshot } from '@stateloom/proxy';

const state = observable({ count: 0, text: 'hello' });
state.count++;

const snap = snapshot(state);
console.log(snap.count); // 1

Core Signals (Low-level)

import { signal, computed, effect } from '@stateloom/core';

const count = signal(0);
const doubled = computed(() => count.get() * 2);

effect(() => {
  console.log(`Count is ${count.get()}, doubled is ${doubled.get()}`);
});

count.set(5); // logs: "Count is 5, doubled is 10"

Framework Support

FrameworkPackageAdapter Pattern
React@stateloom/reactuseSignal(), useStore(), ScopeProvider
Vue@stateloom/vueuseSignal(), useStore(), stateloomPlugin
Solid@stateloom/soliduseSignal(), useStore(), ScopeProvider
Svelte@stateloom/sveltetoReadable(), toWritable()
Angular@stateloom/angulartoAngularSignal(), injectStore(), toObservable()
Vanilla JS@stateloom/coreDirect signal/computed/effect API

Packages

Core

PackageDescription
@stateloom/coreSignal-based reactive primitives (signal, computed, effect, batch, scope)

Paradigm Adapters

PackageDescription
@stateloom/storeZustand-style store with actions and middleware support
@stateloom/atomJotai-style atomic state with derived atoms and atom families
@stateloom/proxyValtio-style proxy objects with structural sharing snapshots

Framework Adapters

PackageDescription
@stateloom/reactReact hooks and SSR scope provider
@stateloom/vueVue composables and plugin
@stateloom/solidSolidJS primitives and scope context
@stateloom/svelteSvelte readable/writable store adapters
@stateloom/angularAngular signals, observables, and DI integration

Middleware and Ecosystem

PackageDescription
@stateloom/devtoolsBrowser DevTools integration and logging middleware
@stateloom/persistState persistence (localStorage, sessionStorage, IndexedDB, cookies)
@stateloom/persist-redisRedis storage backend for @stateloom/persist
@stateloom/historyUndo/redo history middleware
@stateloom/tab-syncCross-tab state synchronization via BroadcastChannel
@stateloom/immerImmer integration for immutable updates with mutable syntax
@stateloom/telemetryState change telemetry and error tracking middleware
@stateloom/serverServer-side scope management with LRU caching
@stateloom/testingTest utilities (mock stores, test scopes, value collectors)

Installation

Install the core and the packages you need:

# Core + Store + React (most common setup)
pnpm add @stateloom/core @stateloom/store @stateloom/react

# Core + Atom (bottom-up composition)
pnpm add @stateloom/core @stateloom/atom

# Core + Proxy (mutable syntax)
pnpm add @stateloom/core @stateloom/proxy

# Add middleware as needed
pnpm add @stateloom/persist @stateloom/devtools

Documentation

Examples

ExampleFrameworkSource
Vanilla JSNoneexamples/vanilla-js
React + ViteReact 19examples/react-vite
Vue + ViteVue 3examples/vue-vite
Solid + ViteSolidJSexamples/solid-vite
Svelte + ViteSvelte 5examples/svelte-vite
AngularAngular 19examples/angular
Next.js SSRNext.js 15examples/nextjs-ssr

Contributing

We welcome contributions! See CONTRIBUTING.md for how to get started.

For detailed contributor documentation, see the Contributing Guide.

License

MIT