Skip to main content

Introduction to SoulState

The Zero-Overhead State of Mind.

SoulState is a minimalist, high-performance state management library for modern web applications. It is designed from the ground up to be:

  • Fast: Automatic batching, selector-based subscriptions, and O(1) subscriber management ensure your app stays fast, no matter the scale.
  • Scalable: Built for complex applications, with first-class support for middleware and async operations.
  • Developer-Friendly: A simple, intuitive API that gets out of your way and lets you focus on building.
  • Tiny: A minimal footprint to keep your bundles small.
ℹ️

Core Philosophy

SoulState believes that components should only re-render when the exact data they need changes. By using selectors for data access, you get surgical precision in your updates, leading to optimal performance by default.

Key Features

  • Selector-driven useStore hook: Subscribe to the exact state you need.
  • Automatic batching with microtasks: Multiple updates, one render.
  • Middleware support: Extend the store with logging, persistence, and more.
  • useSyncExternalStore: Full React 18+ concurrent features compatibility.
  • Minimal API: createStore, get, set, subscribe. That's it.

Comparison to Other Libraries

LibraryArchitectureKey CharacteristicUse Case
SoulStateFlux-like (single store)Selector-based subscriptions, automatic batchingOptimal for apps where render performance is critical.
ZustandFlux-like (single store)Very similar to SoulState; SoulState aims for deeper performance optimizations.General-purpose state management; a great alternative.
Redux ToolkitFlux (single store)Boilerplate-heavy, explicit actions/reducersLarge-scale applications requiring strict, auditable update patterns.
Jotai / ValtioAtomic / Proxy-basedAutomatic dependency trackingSimpler state models where individual pieces of state are managed.
SignalsFine-grained reactivityTracks dependencies within functionsIdeal for environments where rendering isn't tied to a component tree (e.g., Solid.js).