Stores

Sometic stores are small, framework-neutral external stores. They power shared application state, optional persistence, cross-tab sync, and theme preference hydration. Adapters bind with useSyncExternalStore, signals, or plain subscribe.

System standout: store kinds

Prefer @sometic/store/kinds: createUiStore (no persist), createPrefsStore (persist + profiles), createSessionStore (memory only; never tokens). Persistence profiles support denyKeys / optional encrypt. Wire bindAuthToStores so session stores reset on epoch bump.

Inventory

PagePackage / importRole
Store@sometic/store, @sometic/store/persistent, @sometic/store/cross-tabCore store, selectors, persistence, cross-tab
Immer adapter@sometic/store-immer (peer immer)Mutable draft updates via produce
Theme store@sometic/theme + @sometic/store/persistentHow theme preferences persist through the store layer

When to use

  • Shared app or engine state that must work across Vanilla, React, Vue, and other adapters
  • Persist preferences (including theme) with versioned migrations
  • Sync a slice of state across browser tabs

When not to use

NeedPrefer
Server lists / cached API data@sometic/query
Component-local controlled/uncontrolled props@sometic/core/controllable-state
Pub/sub events without retained state@sometic/events
Full Redux-style middleware ecosystemsKeep Redux/Zustand at the app boundary; Sometic store stays the adapter contract

Bundle targets (gzip goals)

SurfaceBudget
Store core (@sometic/store)≤ 1.5 KB
Persistent subpath≤ 3 KB
Cross-tab subpath≤ 2.5 KB
Immer adapter (without immer itself)≤ 1 KB