Persist Pinia States Anywhere, Effortlessly
This project is a Pinia plugin designed to provide state persistence capabilities for Vue applications. It enables developers to persist store states across sessions using various storage options, including synchronous and asynchronous storage mechanisms. The plugin is configurable and supports advanced features like filtering mutations and custom serialization/deserialization.
- Universal Storage Support: Works with both synchronous and asynchronous storage mechanisms, including
localStorage
,cookies
, and libraries likelocalForage
or even customremote APIs
. - Customizable Persistence: Configure key names, mutation filters, and serialization/deserialization methods.
- Debugging Support: Includes a built-in logger to track plugin operations.
- State Overwriting: Optionally overwrite the store state during initialization.
- SSR Compatibility: Fully supports server-side rendering environments, addressing edge cases with seamless state handling.
- Zero Dependencies: This plugin is lightweight and has no external dependencies (other than Pinia itself), ensuring minimal impact on your application's bundle size.
- Compact Size: The bundle's minified gzip size is only 1 kB, making it highly efficient for production use.
- Async Storage Support: Unlike other plugins, this plugin natively supports asynchronous storage mechanisms such as
localForage
, making it ideal for modern applications. - Queueing Mechanism: Introduces a queueing mechanism to eliminate race condition issues during state persistence.
- Enhanced Flexibility: Offers advanced configuration options, including custom merge strategies, state filters, and serialization methods, ensuring it adapts to diverse use cases.
- Reliable State Management: Resolves common issues with state persistence in both client-side and SSR setups, providing a smoother developer experience.
- Developer-Centric Approach: Built with contributions and feedback in mind, ensuring issues are addressed promptly and features align with real-world needs.
This project is licensed under the MIT License. See the LICENSE
file for details.
For questions or support, please open an issue or start a discussion on GitHub.