Vue API Query (v1.11.0) provides an elegant way to build REST API requests in Vue/Nuxt applications by moving logic and backend requests to dedicated Model and Query classes. It is especially well-suited for Laravel backends using spatie/laravel-query-builder, as it mirrors its query syntax (e.g., filters, includes, sorts). The package ships TypeScript definitions, supports ESM and CJS, and has a stable release cadence. Unlike alternative packages that enforce JSON API specification, Vue API Query works with any REST API and offers a simple, builder-like interface. It is ideal for projects that need a structured, type-safe way to manage API calls.
npm install vue-api-queryNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows creating a Model class, configuring axios, and performing common CRUD operations with query building (filters, includes, pagination).
Change static resource() to instance method: resource() { return 'users'; } instead of static resource().Avoid reusing query objects: always call Model.query() each time you need a fresh query.
In your model class, add get primaryKey() { return 'uuid'; } or similar.Replace custom axios calls with Model.query() methods.
Run npm install vue-api-query (or yarn add) and ensure the import path is correct: import { Model } from 'vue-api-query'.Use import { Model } from 'vue-api-query' instead of import VueApiQuery from 'vue-api-query'.Ensure you have called Model.query() correctly and that axios is configured with baseURL. Verify that the resource() method returns a valid endpoint.