Pinia

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

Library
npm
v4.0.3
14,728 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
91 /100 Excellent
Development Activity 96
Maintenance 100
Community 68
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
91 /100 Excellent
Architecture 92
Code Quality 90
Innovation 90
Learning Curve 85

Pinia is the official state management library for Vue, designed around the Composition API to provide a store that is intuitive, fully type-safe, and modular by design. It replaces Vuex as the recommended solution for sharing state across components, letting you define independent stores that are automatically inferred by TypeScript without any extra typing boilerplate.

Stores in Pinia are extremely lightweight and tree-shakeable, expose state, getters, and actions through a flat API, and integrate directly with Vue Devtools for time-travel debugging, hot module replacement, and plugin extensibility. It works seamlessly with both Vue 3 and server-side rendering setups such as Nuxt.

What You Get

  • A createPinia() root store you install once and share across the whole application, including SSR-safe state hydration.
  • The defineStore API for declaring modular stores using either an options object or a Composition-API setup function.
  • Automatic, boilerplate-free TypeScript inference for state, getters, and actions across every store.
  • First-class Vue Devtools integration with time-travel debugging, action tracking, and hot module replacement support.
  • An extensible plugin system plus helpers like storeToRefs, mapStores, and mapState for both Composition and Options API components.

Common Use Cases

  • Sharing authentication, user, or session state across many components in a Vue 3 single-page application.
  • Managing server-fetched data and cart or form state in Nuxt applications with proper SSR hydration.
  • Migrating an existing Vuex-based codebase to a lighter, fully type-safe store without dynamic module complexity.
  • Composing multiple focused stores that reference one another instead of a single monolithic global state tree.

Under The Hood

Architecture

Pinia is built as a thin, reactivity-driven layer over Vue’s core primitives. createPinia() (in src/createPinia.ts) creates an effectScope and a root ref holding a record of every store’s state, then returns a markRaw Pinia object whose install method provides the instance via app.provide(piniaSymbol, ...) and registers devtools. defineStore (in src/store.ts, the largest module at ~29KB) returns a useStore composable that lazily instantiates the store on first call, caching instances in the Pinia _s map; both options-style stores (state/getters/actions) and setup-style stores collapse into the same reactive store object via reactive, computed, and per-store effectScope. Subscriptions (src/subscriptions.ts), HMR patching (src/hmr.ts), and storeToRefs (src/storeToRefs.ts) layer additional behavior on top of this reactive core.

Tech Stack

The library is written entirely in TypeScript and targets Vue 3.5+ as a peer dependency, pulling in @vue/devtools-api for its devtools bridge. It ships as a pnpm monorepo (packages/pinia, packages/nuxt, packages/testing, packages/docs) and is bundled with tsdown/Rollup into ESM and IIFE outputs, using compile-time __DEV__, __TEST__, and __USE_DEVTOOLS__ flags to strip development-only code from production builds. It is marked sideEffects: false for full tree-shaking.

Code Quality

The codebase is mature and well-tested, with 17 dedicated spec files under packages/pinia/__tests__ covering actions, getters, subscriptions, SSR, HMR, plugins, state patching, and store setup, run under Vitest with v8 coverage. Internal-only types are consistently prefixed with an underscore and marked @internal, public functions carry JSDoc, and the strict TypeScript configuration plus dedicated test-dts type tests guard the public type surface. Naming is precise and the separation between reactivity plumbing and public API is clear.

API Design

Pinia’s public surface is deliberately small and ergonomic: createPinia, defineStore, storeToRefs, the mapX helpers, and acceptHMRUpdate cover nearly all usage. Getting started requires almost no boilerplate — a single store definition is immediately type-safe with no manual generics — and the flat store shape (accessing state and actions directly on the instance) reads naturally. Documentation at pinia.vuejs.org is thorough, and the dual options/setup store styles let teams pick the ergonomics that fit their existing Vue patterns.

Used by 31 apps in this directory

Go
73%
GPL 3.0

1Panel

Devops · Hosting Control Panel · Monitoring

37,044

The only open-source VPS control panel with native AI agent runtime — deploy websites, Docker stacks, and local LLMs from one web interface.

View details
91
Repo Health
76
Technical
67
Dependency
Built with
Go 73%
Vue 27%
Updated 4 days ago
Vue
43%
MIT

Alexandrie

Collaboration · Knowledge Management · Note Taking

2,777

The open-source, offline-first Notion, Obsidian & Confluence alternative with multi-tenant teams, OIDC/SSO, and one-command Docker deployment.

View details
86
Repo Health
73
Technical
74
Dependency
Built with
Vue 43%
TypeScript 41%
Go 13%
Updated 1 weeks ago
Python
59%
Apache 2.0

argilla

AI Development · Data Engineering

5,125

Collaborate on high-quality AI training data with a self-hosted annotation platform built for LLMs, NLP, and multimodal models.

View details
65
Repo Health
81
Technical
61
Dependency
Built with
Python 59%
Jupyter Notebook 21%
Updated 1 weeks ago
PHP
63%
Other

BillaBear

Ecommerce · Invoicing Finance

761

Self-hostable subscription management and billing platform with Stripe integration, tax automation, configurable workflows, and Twig-based document generation.

View details
76
Repo Health
66
Technical
65
Dependency
Built with
PHP 63%
Vue 18%
Gherkin 13%
Updated 2 weeks ago
Go
92%
AGPL 3.0

BillionMail

Marketing

15,695

Self-hosted email server and marketing platform that gives you unlimited sending, full deliverability control, and AI-assisted campaigns without monthly fees.

View details
52
Repo Health
74
Technical
70
Dependency
Built with
Go 92%
Updated 3 months ago
Ruby
50%
Other

Chatwoot

Customer Support

37,254

Open-source omnichannel customer support platform with AI-powered agents, live chat, and self-hosting — a full Intercom and Zendesk alternative.

View details
95
Repo Health
78
Technical
69
Dependency
Built with
Ruby 50%
Vue 25%
JavaScript 22%
Updated 5 days ago
PHP
48%
AGPL 3.0

Crater

Invoicing Finance

8,349

Open source invoicing and billing platform for freelancers and small businesses — create estimates, track expenses, accept Stripe payments, and run recurring invoices from your own server.

View details
54
Repo Health
68
Technical
68
Dependency
Built with
PHP 48%
Vue 40%
Updated 2 years ago
Java
70%
GPL 3.0

DataEase

AI Assistants · Analytics · Data Engineering

24,558

Open-source BI tool with drag-and-drop dashboards, 20+ data source connectors, and AI-powered natural language queries — a self-hosted alternative to Tableau.

View details
94
Repo Health
71
Technical
65
Dependency
Built with
Java 70%
Vue 29%
Updated 4 days ago
TypeScript
79%
Other

Directus

CMS · Low Code Platforms

37,987

Connect any SQL database and get instant REST and GraphQL APIs, a visual management Studio, and a native MCP server for AI agents — free for most organizations.

View details
92
Repo Health
82
Technical
76
Dependency
Built with
TypeScript 79%
Vue 19%
Updated 1 weeks ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers