pinia-plugin-unstorage

The best persistence plugin for pinia.
7,927
Install
npm install pinia-plugin-unstorage@0.2.2
Latest Version:0.2.2
Vue:3
License:MIT
Last Updated:Mar 24, 2026
Links: npm
Maintainer: litingyes

pinia-plugin-unstorage

The best persistence plugin for pinia.

[!TIP] The persistence logic of this plugin is implemented based on unstorage, which provide unified key-value storage API. Based on this, you can even persist the data to the database

Install

pnpm add pinia-plugin-unstorage

Usage

Vue app

import { createPinia } from 'pinia'
import { createPiniaUnstorage } from 'pinia-plugin-unstorage'

const pinia = createPinia()
pinia.use(
    createPiniaUnstorage({
        // UnstorageOptions
    }),
)

Nuxt app

export default defineNuxtConfig({
    modules: ['@pinia/nuxt', 'pinia-plugin-unstorage/nuxt'],
    piniaUnstorage: {
        // UnstorageOptions
    },
})

Options

Plugin options

interface UnstorageOptions {
    namespace: string // prefix str to as storage key
    driver: Driver // the storage instance in unstorage
}

Store options

export const useStore = defineStore(
    'store',
    () => {
        // ...
    },
    {
        unstorage: {
            pick: [], // string[], state keys picked to storage
            omit: [], // string[], state keys omitted fot storage
        },
    },
)

Related Packages

pinia-persists

a pinia plugin for state persist.

792 16
pinia-plugin-store

pinia plugin store

15,186 10
vue-persistedstate

state management

9,163
pinia-simple-persist

Simple pinia persistence without using $patch

1,346 0
pinia-plugin-unistorage

uniapp 下 pinia 的本地数据缓存插件

12,081 23

Version History

Version Released License
0.2.2 MIT
0.2.1 MIT
0.2.0 MIT
0.1.0 MIT
0.0.0
Pre-releases (1)
Version Released License
1.0.0-beta.1 MIT