Standard Store
Like Standard Schema, but for state management.
Overview
Section titled “Overview”Standard Store is a lightweight, type-safe state management library for JavaScript and TypeScript. It provides a simple API for creating stores, managing state, and persisting data with flexible storage adapters.
Inspired by Standard Schema, it brings the same philosophy of typed, interoperable interfaces to state management.
Quick Example
Section titled “Quick Example”import { createStore } from "@standard-store/store";
// Create a store with initial stateconst store = createStore({ count: 0, name: "Standard Store",});
// Get statestore.getState(); // { count: 0, name: 'Standard Store' }
// Update state (partial merge)store.setState({ count: 1 });
// Subscribe to changesconst unsubscribe = store.subscribe((state) => { console.log("State updated:", state);});Features
Section titled “Features”- Type-safe — Full TypeScript support with typed stores and validation
- Lightweight — Minimal core with zero runtime dependencies
- Flexible adapters — Persist state to localStorage, sessionStorage, cookies, memory, and more
- Middleware — Intercept and extend state operations with logging, validation, and side effects
- Framework agnostic — Works with React or any JavaScript framework
- Partial updates —
setStatemerges with existing state for granular updates
Get Started
Section titled “Get Started”InstallationInstall Standard Store and its packages.
Quick StartCreate your first store and start managing state.
Core ConceptsLearn about stores, state, actions, and subscriptions.
API ReferenceFull API reference for all functions and options.
Guides
Section titled “Guides”Creating a StoreCreate stores with different use cases and configurations.
Persistence & AdaptersPersist state with localStorage, cookies, and other adapters.
MiddlewareUse middleware for logging, validation, and side effects.
React IntegrationIntegrate Standard Store with React applications.
More Work
Section titled “More Work”Check out more of my work - Mamello Seboholi.