Pinia ORM is a plugin for Pinia that provides Object-Relational Mapping (ORM) capabilities for Vue 3 applications. Version 1.10.2 is the latest stable release with active development. It allows defining models with relationships (hasOne, hasMany, belongsTo, etc.) and provides a query builder for fluent data access. Key differentiators: seamless integration with Pinia's state management, support for reactive data, and TypeScript-first design. Released with a cadence of minor updates roughly every 2-3 months.
npm install pinia-ormNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows setup of Pinia ORM with model definitions, relationships, and basic CRUD using useRepo.
Migrate from store.$orm() to useRepo() hook.
Define relations inside static fields() using 'this.hasMany()', etc.
Ensure fields() returns an object literal with key-value pairs.
Change all imports to 'pinia-orm'.
Run npm install pinia-orm pinia and ensure import is from 'pinia-orm'.
Change require to import or use dynamic import().
Ensure you call pinia.use(PiniaOrmPlugin) before any store or repo usage.
Import the model file at least once before using it (e.g., import './models/User').