Skip to main content
Kweri supports two Vue usage patterns. If your backend has an OpenAPI spec, use path-based hooks with generated types. If you’re defining endpoints manually, use useQuery and useMutation directly.
After running kweri-gen, bind composables to the generated EndpointByMethod map. You get fully-typed useGet, usePost, usePut, usePatch, and useDelete composables without writing any endpoint definitions yourself.

Setup

Create the composables once and export them. Don’t call createVuePathHooks inside a component.

useGet

Mutation hooks

Full CRUD example

Path hooks resolve the endpoint schema at call time. If the path isn’t in the generated map, they throw [kweri] No endpoint registered for GET /unknown-path.

Without code generation

Use useQuery and useMutation when you’re defining endpoints manually with defineEndpoint.

Setup

Create the composables once and export them. Don’t call createVueQueryHooks inside a component.

useQuery

VueQueryOptions

VueQueryResult

Example

Reactive params

Pass a Ref as params and the query re-executes automatically when the ref changes:

Conditional fetching


useMutation

VueMutationResult

Example


Cleanup

useQuery automatically unsubscribes from the kweri cache when the component is unmounted (via onUnmounted). No manual cleanup needed.