Skip to content

StatelyPinia-inspired state for Svelte 5 and SvelteKit

Direct-mutation stores with SSR-safe managers, explicit workflows, and opt-in plugins — from persistence to finite state machines.

Stately logo

What you get

Stately is a Svelte 5 state library for teams who want a small, composed core runtime with explicit plugin-based features. It is designed for package consumers who want predictable store behavior in both SPA and SSR flows, with enough structure to model real app workflows — without ceremony where none is warranted, and with full ceremony where it genuinely is.

The documentation is organized so you can move from learning the API to applying it in real apps:

  • The guide explains the recommended patterns.
  • The reference breaks the public API into focused topics.
  • The examples page shows persistence, history, sync, async orchestration, and store composition in practice.

Feature map

Stately includes:

  • option stores and setup stores through defineStore()
  • request-scoped managers for SSR-safe SvelteKit usage
  • persistence with storage adapters, migrations, TTL expiry, and optional compression
  • history and time travel with batch recording
  • finite state machines with send(), matches(), and can()
  • multi-tab sync with transport abstractions and deterministic conflict handling
  • async loading, cancellation, and concurrency policies
  • validation that can reject and roll back invalid patches
  • developer tooling such as the inspector drawer and Vite plugin

Start here

  • Read the guide for installation, store definitions, SSR patterns, plugins, and release workflows.
  • Jump to Define stores if you want the fastest route to your first useful store.
  • Read Plugins when you need persistence, history, FSMs, sync, validation, async orchestration, or the inspector.
  • Use SSR and SvelteKit and SvelteKit data loading if the app renders on the server.
  • Jump to the API reference for the exported runtime surface.
  • Browse the packaged examples under src/lib/examples/ and the examples page for consumer-facing patterns that match the public API.

Released under the MIT License.