Supercharged $state() for Svelte
"Svelte 5's
$state()is fantastic for simple use cases. A login form? Easy. A settings toggle? Trivial.But what about real enterprise applications? With native Svelte 5, there is no automatic change detection for nested properties, no built-in validation that mirrors your data structure, no way to know which property changed and react to it, no undo/redo for complex editing workflows and no dirty tracking across the entire object tree.
svstate wraps your state in a deep reactive proxy that:
- ๐ Detects changes at any nesting level
- โ Validates with a structure that mirrors your data
- ๐ Async validation for server-side checks (username availability, email verification)
- โก Fires effects when any property changes (with full context)
- โช Snapshots & undo for complex editing workflows
- ๐ฏ Tracks dirty state automatically (per-field and aggregate)
- ๐ง Supports methods on state objects for computed values and formatting
- ๐ Plugin system for persistence, autosave, devtools, URL sync, cross-tab sync, undo/redo, and analytics
svstate works best for enterprise applications with complex forms, ERP, CRM and admin dashboards, multi-step wizards, applications needing undo/redo and any form beyond username/password."