Registry / database / vuex-orm-lowdb

vuex-orm-lowdb

JSON →
library0.3.4jsnpmunverified

Vuex-ORM-Lowdb (v0.3.4) is a plugin for Vuex-ORM that synchronizes Vuex store data with Lowdb, a JSON file-based database. It provides Vuex actions ($fetch, $create, $update, $delete) that extend Vuex-ORM's model operations with automatic persistence to Lowdb. Key differentiators: simple local persistence without a backend, uses Lowdb for file storage. Release cadence is low; no updates since initial release. Use with Vuex-ORM 0.x.

npm install vuex-orm-lowdb
INSTALL
IMPORT
SIG · VUEX-ORM-LOWDB
V
vuex-orm-lowdb
databasejavascriptv0.3.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

VuexOrmLowdb
import VuexOrmLowdb from 'vuex-orm-lowdb'
import { VuexOrmLowdb } from 'vuex-orm-lowdb'
Default export only; named import will be undefined.
VuexOrmLowdb (require)
const VuexOrmLowdb = require('vuex-orm-lowdb')
const { VuexOrmLowdb } = require('vuex-orm-lowdb')
CommonJS pattern: use default require, not destructuring.
Plugin usage with VuexORM.use
VuexORM.use(VuexOrmLowdb, { database, dbPath: '/public/data' })
Vuex.use(VuexOrmLowdb)
Plugin is used with VuexORM, not Vue; second argument must include database and dbPath.

Shows plugin setup with Vuex-ORM, database registration, and usage of $fetch and $create actions.

import VuexORM from '@vuex-orm/core' import VuexOrmLowdb from 'vuex-orm-lowdb' const database = new VuexORM.Database() VuexORM.use(VuexOrmLowdb, { database, dbPath: '/public/data' // Path to JSON file for Lowdb }) // Assuming Vuex store is set up with VuexORM.install import Vue from 'vue' import Vuex from 'vuex' Vue.use(Vuex) const store = new Vuex.Store({ plugins: [VuexORM.install(database)] }) // Model definition class User extends VuexORM.Model { static entity = 'users' static fields () { return { id: this.attr(null), name: this.attr('') } } } database.register(User) // Usage in component async function fetchUsers () { await User.$fetch() } async function createUser () { await User.$create({ data: { id: 1, name: 'John' } }) }
Debug
Known issues
gotchaPlugin requires Vuex-ORM 0.x; not compatible with Vuex-ORM 1.x or later
fix
If using Vuex-ORM v1+, use the built-in persistence features or alternative plugins.
affects: >=0.3.4
gotchadbPath is relative to the project root; lowdb writes to a file in the filesystem (Node.js only)
fix
Ensure the path is writable in production (e.g., for Electron apps) and not used in browser-only mode.
affects: >=0.1.0
gotchaActions $create, $update, $delete expect the same payload format as Vuex-ORM Model.insert, Model.update, etc.
fix
Use { data: ... } for $create, { where: ..., data: ... } for $update, { where: ... } for $delete.
affects: >=0.1.0
deprecatedPackage has not been updated since 2018; lowdb dependency is outdated (likely lowdb@1.x)
fix
Consider using a more actively maintained solution like vuex-orm-localforage.
affects: 0.3.4
Errors
Common errors & fixes
Error: VuexORM.use is not a function
Missing or incorrect import of VuexORM from '@vuex-orm/core'
fix
Ensure VuexORM is imported correctly: import VuexORM from '@vuex-orm/core'
Cannot find module 'lowdb' or its corresponding type declarations
lowdb is a peer dependency; not installed automatically
fix
Run: npm install lowdb@^1.0.0
Uncaught TypeError: database is undefined
The database instance is not passed to the plugin or is not initialized
fix
Make sure to create a new VuexORM.Database() and pass it in the options object.
Upgrade
Version history
0.3.4latest on npm
Audit
Dependencies
@vuex-orm/corerequiredPeer dependency; plugin requires Vuex-ORM core to function
lowdbrequiredDirect dependency for database persistence
vuexrequiredPeer dependency; Vuex store is required
Agent activity
18 hits · last 30 days
node
14
Meta
2
OpenAI (training)
2
Resources
vuex-orm-lowdb — npm install vuex-orm-lowdb · libregistry