npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@runablejs/pinia

v0.1.0

Published

Readme

Runable Pinia

Official Pinia state management integration for Runable ⚡️

Description

@runablejs/pinia installs a fresh Pinia instance in every Runable Vue application. Stores work in components and composables with no application plugin to configure manually.

Features

  • 🍍 Pinia 3 support
  • ⚡️ Zero-configuration Runable integration
  • 📦 Automatic store and Pinia helper imports
  • 💾 Optional persistence powered by Unstorage
  • 🔌 Custom Unstorage driver support
  • 🔒 One isolated Pinia instance per application and SSR request
  • 💚 Vue 3 and TypeScript ready

Installation

pnpm add @runablejs/pinia pinia

Add the module to runable.config.ts:

import { defineConfig } from "runable";

export default defineConfig({
  modules: ["@runablejs/pinia"],
});

Usage

Create a store, for example in app/stores/counter.ts. defineStore is auto-imported:

export const useCounterStore = defineStore("counter", {
  state: () => ({ count: 0 }),
  actions: {
    increment() {
      this.count++;
    },
  },
});

Stores exported from app/stores are auto-imported too:

<script setup lang="ts">
const counter = useCounterStore();
</script>

<template>
  <button type="button" @click="counter.increment()">
    Count: {{ counter.count }}
  </button>
</template>

Pinia helpers such as storeToRefs are also available without imports:

const counter = useCounterStore();
const { count } = storeToRefs(counter);

Options

| Option | Type | Default | Description | | --- | --- | --- | --- | | storeDirs | string[] | ['{appDir}/stores'] | Directories containing stores to auto-import. | | persist | boolean | false | Persist every store by default. | | unstorage | UnstorageOptions | See below | Configure the persistence storage. |

Unstorage options

| Option | Type | Default | Description | | --- | --- | --- | --- | | namespace | string | 'runable:pinia:' | Prefix used to isolate persisted store keys. | | windowKey | 'localStorage' \| 'sessionStorage' | 'localStorage' | Browser storage backend. | | driver | Driver \| (() => Driver) | Browser local storage | Custom Unstorage driver or driver factory. |

Store directories

Stores exported from {appDir}/stores are auto-imported by default, so they can be used without an explicit import:

<script setup lang="ts">
const counter = useCounterStore();
</script>

Use storeDirs to scan additional directories. Paths are relative to the Runable project root:

import { defineConfig } from "runable";

export default defineConfig({
  modules: ["@runablejs/pinia"],
  pinia: {
    storeDirs: ["app/stores", "features/account/stores"],
  },
});

Setting storeDirs replaces the default list.

Store persistence

Persistence is powered by Unstorage. It uses localStorage in the browser and isolated memory during server rendering. Enable it per store:

export const usePreferencesStore = defineStore("preferences", {
  state: () => ({ theme: "light" }),
  persist: true,
});

A custom key can be configured per store:

export const usePreferencesStore = defineStore("preferences", {
  state: () => ({ theme: "light" }),
  persist: {
    key: "user-preferences",
  },
});

Hydration is asynchronous. Await $persistReady when code needs the restored state before continuing:

const preferences = usePreferencesStore();

await preferences.$persistReady;
await preferences.$persist(); // save immediately
await preferences.$hydrate(); // reload from storage

Persistence can also be enabled for every store from runable.config.ts and the Unstorage browser driver can be configured globally:

export default defineConfig({
  modules: ["@runablejs/pinia"],
  pinia: {
    persist: true,
    unstorage: {
      namespace: "my-app:pinia:",
      windowKey: "sessionStorage",
    },
  },
});

Set persist: false on an individual store to opt out when global persistence is enabled.

Custom Unstorage driver

Pass any Unstorage driver instance or a factory. A factory is useful when the driver should be created lazily:

import memoryDriver from "unstorage/drivers/memory";
import { defineConfig } from "runable";

export default defineConfig({
  modules: ["@runablejs/pinia"],
  pinia: {
    persist: true,
    unstorage: {
      namespace: "my-app:pinia:",
      driver: () => memoryDriver(),
    },
  },
});

When no custom driver is provided, the module uses localStorage or sessionStorage in the browser and an isolated in-memory storage during SSR.

Contributing

See CONTRIBUTING.md for local setup, tests, changesets, and the pull request checklist.

License

MIT