Skip to content
Agents tracked: 506 Releases (7d): 634 Agent status: 3 with issuesSince last limit reset: Claude 15d · Codex 0d For AI agents: Markdown Updated Nov 26, 2026

Pinia

Intuitive, type-safe state management store for Vue applications.

State and data fetchingNPM

GitHubWebsite

1. License

License from npm.

github.com/vuejs/pinia

From the package registry and GitHub, checked daily. Tap a verdict to see its source.How we checkedReport an error

What Pinia does

Pinia is the Vue store the README names as the successor of Vuex: in place of dynamic modules, which the README calls not type safe, you write separate stores in separate files, and the website says their types are inferred even in plain JavaScript.

Pinia popularity

67 / 100
Gid Score, #544 overall
7.9M
downloads a week, npm
14.8K
GitHub stars
56
agent projects use it
Pinia: downloads per weeknpm, pinia 7,860,566
Pinia: GitHub starsvuejs/pinia 14,772

Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated

How Pinia is used

  • Pinia is a dependency in 56 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (1.2% of the 4,867 JavaScript/TypeScript ones), #4 of 53 in state and data fetching.
  • Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 105; those are left out of every share on this page.
  • The most used alternative in our scan is Zustand (366 projects).
  • Projects that use it most often also use Vue (98.2%), vue-tsc (69.6%), Vite (69.6%).

By coding agent

30 projects, 1.0%
28 projects, 0.9%
23 projects, 0.9%
7 projects, 2.0%
6 projects, 1.3%

Often used with

In 98.2% of its projects
In 69.6% of its projects
In 69.6% of its projects
In 53.6% of its projects
In 80.4% of its projects
In 33.9% of its projects
In 33.9% of its projects
In 66.1% of its projects

Pinia in practice

Strengths

Autocompletion without writing types

The website says store types are inferred. It claims this gives you autocompletion "even in JavaScript", not only in TypeScript.

One store per file, as many as you need

The README says you can create as many stores as you want. It says each one should live in a different file.

Store names show up in devtools

The first argument to <code>defineStore</code> is the store's name. The README says the name must be unique across the application and that it appears in devtools.

About 1.5kb, by the site's count

The website says Pinia weighs ~1.5kb. It does not say whether that figure is minified or gzipped.

Watch out for

Vue 2 lives on another branch

The README says the latest pinia works with Vue 3. For Vue 2, it points to the <code>v2</code> branch.

No dynamic modules

The README says dynamic modules are not type safe. Instead, the maintainers allow creating different stores that can be imported anywhere.

Install command names two packages

The README's install command adds <code>@vue/devtools-api</code> alongside <code>pinia</code>.

A store with state, getters and actions

import { defineStore } from 'pinia'

// main is the name of the store. It is unique across your application
// and will appear in devtools
export const useMainStore = defineStore('main', {
  // a function that returns a fresh state
  state: () => ({
    counter: 0,
    name: 'Eduardo',
  }),
  // optional getters
  getters: {
    // getters receive the state as first parameter
    doubleCounter: (state) => state.counter * 2,
    // use getters in other getters
    doubleCounterPlusOne(): number {
      return this.doubleCounter + 1
    },
  },
  // optional actions
  actions: {
    reset() {
      // `this` is the store instance
      this.counter = 0
    },
  },
})

More about Pinia

Funding
  • GitHub Sponsors: https://github.com/posva
  • Own page: https://www.paypal.me/posva
  • 42 GitHub sponsors

See all

Agent Skills for it
  • pinia: Pinia official Vue state management library, type-safe and extensible. Use when defining stores, working with state/getters/actions, or impl

See all

Packages around it
  • vue: UI framework
  • vue-tsc: Type checking for .vue files
  • vite: Build tool and dev server
  • @vueuse/core: Vue composition utilities
  • eslint: Linter
  • dayjs: Date library
More in State and data fetching

Alternatives

Pinia This page

MITGid 677.9M/wk

Zustand

Lightweight state management for React with minimal boilerplate.

MITGid 8896.9M/wk

Jotai

Minimal React state management with atoms as primitive building blocks for flexibility.

MITGid 7211M/wk

Compare Pinia with another tool

Get started

Install it.

npm install pinia

Rules for your agent

Paste into AGENTS.md or CLAUDE.md
## Pinia
- Install with the README's command: `npm install pinia @vue/devtools-api`. pnpm or yarn also work.
- Create a pinia (the root store) with `createPinia()` and pass it to the app with `app.use(pinia)`.
- Put each store in its own file. Define it with `defineStore('name', {...})`, and keep the name unique across the app, because it appears in devtools.
- Write `state` as a function that returns a fresh state. Getters and actions are optional. Getters receive the state as their first parameter, and inside actions `this` is the store instance.
- `defineStore` returns a function. Call it, for example `useMainStore()`, to get access to the store.
- To extract specific state or getters from a store, use `storeToRefs(store)`, as the README does.
- Do not reach for dynamic modules. Create separate stores and import them where needed. The latest version targets Vue 3; for Vue 2, use the `v2` branch.