# pinia-plugin-store

> pinia plugin store

Latest version **4.0.1** (published 2026-07-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install pinia-plugin-store
pnpm add pinia-plugin-store
yarn add pinia-plugin-store
bun add pinia-plugin-store
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 4.0.1 |
| Published | 2026-07-16 |
| First published | 2023-07-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 8.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 10 |
| Author | mivui |
| Maintainers | mivui |
| Keywords | vue, pinia, persist, typescript |

## Links

- npm: https://www.npmjs.com/package/pinia-plugin-store
- Repository: https://github.com/mivui/pinia-plugin-store
- Homepage: https://github.com/mivui/pinia-plugin-store#readme
- Issues: https://github.com/mivui/pinia-plugin-store/issues
- npm.io page: https://npm.io/package/pinia-plugin-store

## Dependencies (1)

- [pinia](https://npm.io/package/pinia.md) ^4.0.2

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 4.0.1 (latest) — 2026-07-16
- 4.0.0 — 2026-07-16
- 3.0.9 — 2026-04-30
- 3.0.8 — 2026-02-27
- 3.0.7 — 2025-12-05
- 3.0.6 — 2025-11-01
- 3.0.5 — 2025-08-24
- 3.0.4 — 2025-08-24
- 3.0.3 — 2025-07-27
- 3.0.2 — 2025-05-30
- 3.0.1 — 2025-04-12
- 3.0.0 — 2025-02-28
- 2.3.3 — 2025-01-07
- 2.3.2 — 2025-01-04
- 2.3.1 — 2024-12-20
- … 19 more at https://npm.io/package/pinia-plugin-store/versions

## README

# pinia-plugin-store

### pinia tools plugin
[![npm version](https://img.shields.io/npm/v/pinia-plugin-store.svg?style=flat-square)](https://www.npmjs.com/package/pinia-plugin-store)
[![Alt](https://img.shields.io/npm/dt/pinia-plugin-store?style=flat-square)](https://npmcharts.com/compare/pinia-plugin-store?minimal=true)
![Alt](https://img.shields.io/github/license/mivui/pinia-plugin-store?style=flat-square)

### install

```shell
npm i pinia-plugin-store
```

### API

| property |              type              |                          description                          |    default     |                                                       
|:--------:|:------------------------------:|:-------------------------------------------------------------:|:--------------:|
|  stores  | (string &Iota; StoreOptions)[] | pinia store keys(specify the store that needs to be persiste) |   undefined    |
| storage  |            storage             |                      persistent strategy                      |  localStorage  |
| encrypt  |   (value: string) => string    |                     persistent encryption                     |   undefined    |
| decrypt  |   (value: string) => string    |                     persistent decryption                     |   undefined    |

### Example

##### theme.ts

```ts
import { defineStore } from 'pinia';

export const useThemeStore = defineStore('theme_store', {
  state: () => {
    return {
      theme: 'dark',
    };
  },
  actions: {
    setTheme(theme: string) {
      this.theme = theme;
    },
  },
});

```
##### store.ts

> simple configuration

```ts
import { createPinia } from 'pinia';
import { storePlugin } from 'pinia-plugin-store';

const store = createPinia();

const plugin = storePlugin({
  stores: ['theme_store'],
});

store.use(plugin);

export default store;

```

> specify a storage alone

```ts
import { createPinia } from 'pinia';
import { storePlugin } from 'pinia-plugin-store';

const store = createPinia();

const plugin = storePlugin({
  stores: [{ name: 'theme_store', storage: sessionStorage }, 'user_store'],
  storage: localStorage,
});
store.use(plugin);

export default store;

```

> encryption

```ts
import { createPinia } from 'pinia';
import { storePlugin } from 'pinia-plugin-store';
import Utf8 from 'crypto-js/enc-utf8';
import Base64 from 'crypto-js/enc-base64';

const store = createPinia();

function encrypt(value: string): string {
  return Base64.stringify(Utf8.parse(value));
}

function decrypt(value: string): string {
  return Base64.parse(value).toString(Utf8);
}

const plugin = storePlugin({
  stores: [{ name: 'theme_store' }],
  encrypt,
  decrypt,
});

store.use(plugin);

export default store;

```

> disable encryption

```ts
import { createPinia } from 'pinia';
import { storePlugin } from 'pinia-plugin-store';
import Utf8 from 'crypto-js/enc-utf8';
import Base64 from 'crypto-js/enc-base64';

const store = createPinia();

function encrypt(value: string): string {
  return Base64.stringify(Utf8.parse(value));
}

function decrypt(value: string): string {
  return Base64.parse(value).toString(Utf8);
}

const plugin = storePlugin({
  stores: [{ name: 'theme_store', ciphertext: false }],
  storage: localStorage,
  encrypt,
  decrypt,
});

store.use(plugin);

export default store;

```

##### main.ts

```ts
import { createApp } from 'vue';
import store from './store';
import App from './App.vue';

const app = createApp(App);
app.use(store);
app.mount('#app');

```

---
_Source: https://npm.io/package/pinia-plugin-store · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
