Convex-vue provides a seamless integration of Convex, the full-stack backend platform, with Vue.js applications. It is currently in version 0.1.5 and features real-time queries, support for Server-Side Rendering (SSR) and Static Site Generation (SSG) via Vue's Suspense, and optimistic updates for mutations. The library focuses on providing reactive composables like `useConvexQuery` and `useConvexMutation` to simplify data fetching and manipulation within Vue 3 components. While still in early development with minor version bumps, it shows an active release cadence addressing types, fixes, and enhancements, making it a viable option for Vue developers building applications with Convex. Key differentiators include its tight integration with Vue's reactivity system and built-in SSR capabilities.
npm install convex-vueVerified import paths — ran on the pinned version, not inferred.
Initializes the Convex Vue plugin and demonstrates fetching real-time data using `useConvexQuery` to display a list of messages.
Ensure your code handles `data.value` being `undefined` (e.g., `if (!data.value) { return 'Loading...'; }`).Refer to the documentation for `v0.1.2` or `v0.1.4` for the correct `initClient` options. It's recommended to stay on `v0.1.4` or newer for stability.
Be aware that server-rendered content will not be real-time until the client-side takes over. For SSR, ensure you `await suspense()` to wait for initial query completion.
Review type errors after upgrading and adjust type annotations or usage patterns accordingly, especially for custom Convex function definitions.
Ensure your Vue app is created with `createApp(App)` and `app.use(convexVue, ...)` is called on the result.
Verify your Convex project is correctly set up, `npx convex dev` is running (or deployment is active), and the import path for `api` is correct relative to your project structure.
Double-check the `api` path (e.g., `api.myModule.myQuery`) against your Convex function definitions and ensure your Convex deployment is healthy.
In your component setup, ensure you call `const { data, suspense } = useConvexQuery(...)` and then `await suspense()` before trying to access `data.value` for SSR.