The Pinia plugin to enable Object-Relational Mapping access to the Pinia Store.

Pinia ORM banner

npm versionnpm downloadsGithub Actions CICoverageLicense

Welcome to pinia-orm

Intuitive, type safe and flexible ORM for Pinia based on Vuex ORM Next

Migration from vuex-orm

You want to migrate from vuex to pinia and with it vuex-orm to pinia-orm but you don't know yet? Well maybe this table will help you to decide. This comparison is just about facts and current state.

Bundle Size (Min + GZIP)9.9 KB16.7 KB12.6 KB
Relations (hasMany, belongsTo, morphOne, hasManyBy, hasOne, morphTo)
Relations (morphMany, belongsToMany, hasManyThrough)
Relations (morphToMany, morphedByMany)
Single Table Inheritance
Lifecycle Hooks
Query (orHas, doesntHave, orDoesntHave, whereHas, orWhereHas, groupBy)
Collection Helpers(✅) can use pinia-orm helpers too(✅) can use pinia-orm helpers too
Hidden Fields
Metadata field
Caching of queries with gc(✅) with plugin

If you decide to migrate then there are some breaking changes. A guide how to migrate will be written. Small overview:

  • Fields are by default null
  • Renamed some functions aligning more with laravel naming
  • Code is based on vuex-orm-next and not on vuex-orm !

Help me keep working on this project 💚

💻 Development

  • Clone this repository
  • Enable Corepack using corepack enable (use npm i -g corepack for Node.js < 16.10)
  • Install dependencies using pnpm install
  • Build normalizr package: pnpm build
  • Run interactive tests using cd packages/pinia-orm && pnpm test:ui



Made with ❤️

Published under MIT License.