A tiny, type-safe state management library. Framework-agnostic core that works anywhere — Node, browser, vanilla JS. Zero dependencies.
npm install qortex-storeimport { createStore } from 'qortex-store';// Create a store with state and actionsconst counterStore = createStore((set, get) => ({count: 0,increment: () => set({ count: get().count + 1 }),decrement: () => set((s) => ({ count: s.count - 1 })),reset: () => set({ count: 0 }),}));// Read statecounterStore.get().count; // 0// Update statecounterStore.get().increment();counterStore.get().count; // 1// Subscribe to changesconst unsub = counterStore.subscribe((state, prev) => {console.log(prev.count, '→', state.count);});
Zero runtime dependencies, minimal overhead
Full TypeScript generics and inference
Works anywhere — Node, browser, vanilla JS
set shallow-merges by default, or replace entirely
Listen for state changes with cleanup
Define actions alongside state in the initializer
| Method | Description |
|---|---|
createStore(init) | Create a new store with initial state and actions |
get() | Read the current state snapshot |
set(partial, replace?) | Update state (merge or replace) |
subscribe(listener) | Listen for changes, returns unsubscribe fn |
destroy() | Clear listeners and reset to initial state |
Lightweight and optimized for performance.
0.5KB / 10KB Performance Budget