{"id":49683,"library":"vuex-rest-api","title":"vuex-rest-api","description":"A helper utility to simplify the use of REST APIs with Vuex 2.x, using axios for HTTP requests. The current stable version is 2.16.0. It provides a fluent API to define actions, mutations, and state for Vuex stores with minimal boilerplate. Key differentiators: integrates seamlessly with Vuex 2, supports dynamic path parameters via functions, and works with websanova/vue-auth. Does not support Vuex 3+ (Vue 3). Release cadence is low; no updates since 2019.","status":"maintenance","version":"2.16.0","language":"javascript","source_language":"en","source_url":"https://github.com/christianmalek/vuex-rest-api","tags":["javascript","typescript"],"install":[{"cmd":"npm install vuex-rest-api","lang":"bash","label":"npm"},{"cmd":"yarn add vuex-rest-api","lang":"bash","label":"yarn"},{"cmd":"pnpm add vuex-rest-api","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"HTTP client used for all API requests.","package":"axios","optional":false}],"imports":[{"note":"Default export; CommonJS require works but is not recommended. Only ESM style is shown in docs.","wrong":"const Vapi = require('vuex-rest-api')","symbol":"Vapi","correct":"import Vapi from 'vuex-rest-api'"},{"note":"The library exports only a default class; named destructuring from CommonJS is incorrect.","wrong":"const { Vapi } = require('vuex-rest-api')","symbol":"default","correct":"import Vapi from 'vuex-rest-api'"},{"note":"When using TypeScript, import the type via the default import pattern; named import for type is not available.","wrong":"import { Vapi } from 'vuex-rest-api'","symbol":"Vapi type","correct":"import type Vapi from 'vuex-rest-api'"}],"quickstart":{"code":"import Vuex from 'vuex'\nimport Vue from 'vue'\nimport Vapi from 'vuex-rest-api'\n\nVue.use(Vuex)\n\nconst posts = new Vapi({\n  baseURL: 'https://jsonplaceholder.typicode.com',\n  state: {\n    posts: []\n  }\n})\n.get({\n  action: 'listPosts',\n  property: 'posts',\n  path: '/posts'\n})\n.getStore()\n\nexport const store = new Vuex.Store(posts)","lang":"javascript","description":"Creates a Vuex store with a REST API endpoint using vuex-rest-api."},"warnings":[{"fix":"Use Vuex 2.x or migrate to alternative library like Pinia with vuex-rest-api replacements.","message":"Vuex 3+ (Vue 3) not supported; only works with Vuex 2.x","severity":"breaking","affected_versions":""},{"fix":"Evaluate alternatives like vuex-smart-module or Pinia for active development.","message":"No updates since 2019; considered feature-complete but unmaintained","severity":"deprecated","affected_versions":"2.x"},{"fix":"Use path: ({ id }) => '/posts/' + id instead of string interpolation with ES6 template literals (though they work too, but consistency matters).","message":"Path functions must return string; dynamic parameters require arrow function with parentheses around params","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Always define initial state for each property, e.g., state: { posts: [] }.","message":"Default state property must be defined; otherwise defaults to null which may cause mutations to set null","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Dispatch actions as store.dispatch('listPosts') or with mapActions.","message":"Actions must be called after store creation; dispatch is not automatically namespaced","severity":"gotcha","affected_versions":">=2.0.0"}],"env_vars":null,"search_vec":"'2':17,53 '2.16.0':29 '2019':78 '3':68,70 'action':37 'api':4,14,34 'axio':20 'boilerpl':46 'cadenc':72 'current':25 'defin':36 'differenti':48 'dynam':55 'fluent':33 'function':59 'helper':6 'http':22 'integr':49 'javascript':79 'key':47 'low':74 'minim':45 'mutat':38 'paramet':57 'path':56 'provid':31 'releas':71 'request':23 'rest':3,13 'seamless':50 'simplifi':9 'sinc':77 'stabl':26 'state':40 'store':43 'support':54,66 'typescript':80 'updat':76 'use':11,19 'util':7 'version':27 'via':58 'vue':69 'vuex':2,16,42,52,67 'vuex-rest-api':1 'websanova/vue-auth':63 'work':61 'x':18","created_at":"2026-06-07T17:03:04.123706+00:00","updated_at":"2026-06-07T17:03:04.123706+00:00","problems":[{"fix":"Ensure import: import Vapi from 'vuex-rest-api'. Then: const v = new Vapi({baseURL: '...'}).get({...})","cause":"Vapi instance not properly created or imported incorrectly.","error":"TypeError: Cannot read property 'get' of undefined"},{"fix":"Check that you called .get({action: 'listPosts', ...}) before .getStore() and dispatch exactly 'listPosts'.","cause":"Action not defined in the store or typo in dispatch name.","error":"Uncaught Error: [vuex] unknown action type: listPosts"},{"fix":"Run npm install vuex-rest-api","cause":"Package not installed or missing from package.json.","error":"Module not found: 'vuex-rest-api'"},{"fix":"Add state: { posts: [] } when creating new Vapi.","cause":"State not initialized properly; missing state definition in Vapi constructor.","error":"Cannot set property 'posts' of undefined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/christianmalek/vuex-rest-api#readme","github":"https://github.com/christianmalek/vuex-rest-api","docs":null,"changelog":null,"pypi":null,"npm":"vuex-rest-api","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}