What is Hummbit

hummbit is an immutable state manager with two public entrypoints:
hummbit(framework-agnostic API + typedinitStore)hummbit/react(React-specific API +useSelector, no Provider required)
The package supports two usage styles:
- Store instance mode via
initStore(...)(recommended for new code) - Global singleton mode via top-level
getState/setState/mergeState
How these modes work in practice:
-
Store instance mode (
initStore)- You create an explicit store instance (
const userStore = initStore(...)) with its owninitialState,actions,selectors, subscriptions, and state version. - Instances are isolated from each other: updates in
userStoredo not affectcartStore. - In
hummbit/react, an instance also exposesstore.useSelector, so components subscribe to that specific store instance only. - This is the best fit for modular architecture where each domain (auth, cart, profile) has its own typed store.
- You create an explicit store instance (
-
Global singleton mode (top-level API)
- The app uses one shared default store accessed through
getState,setState,mergeState,selector, and globaluseSelectorfromhummbit/react. - Typing is usually done via module augmentation:
declare module "hummbit" { interface RootState { ... } }. - This mode is useful when you intentionally want one global state container and no explicit store instances.
- Call
configureGlobalStore(...)during app bootstrap, before the first state updates.
- The app uses one shared default store accessed through
When to choose which:
- Choose Store instance mode for isolation, modularity, testability, and clear domain boundaries.
- Choose Global singleton mode for smaller apps that prefer a single shared state container.
Quick Checklist
- Need isolated domain store? Use
initStore. - Need React binding with no Provider? Use
hummbit/reactandstore.useSelector. - Need one global store? Use module augmentation + top-level API.
- Need DevTools/middleware? Configure at bootstrap.

