---
title: "Installation"
description: "Install vue-convex in a Vue 3 app, register the plugin, and verify the setup with a first query."
canonical_url: "https://nuxt-convex.onmax.me/vue-guide/installation"
---
# Installation

> Install vue-convex in a Vue 3 app, register the plugin, and verify the setup with a first query.

Use this guide when you are wiring `vue-convex` directly into a standalone Vue 3 app.

## Before you begin

Make sure you already have:

- a Vue 3 app built with Vite (for example `pnpm create vite@latest my-app --template vue-ts`)
- a Convex account; `npx convex dev` below signs you in and creates the `convex/` directory and `VITE_CONVEX_URL` for you

## Install the packages

```bash [Terminal]
pnpm add vue-convex convex
```

## Register the plugin

```ts [src/main.ts]
import { createApp } from 'vue'
import { convexVue } from 'vue-convex'
import App from './App.vue'

createApp(App)
  .use(convexVue, { url: import.meta.env.VITE_CONVEX_URL })
  .mount('#app')
```

If you omit `url`, the plugin starts disconnected and you need the [controller](https://nuxt-convex.onmax.me/vue-guide/controller) to connect later.

## Generate the typed API

Run Convex once before you import generated types from the frontend.

```bash [Terminal]
npx convex dev
```

That command creates a development deployment, writes `VITE_CONVEX_URL` to `.env.local` (when your `package.json` lists `vite`), and generates `convex/_generated/`. Vite loads `.env.local` by itself. Keep it running while you work: it pushes every change to your functions.

## Verify the result

Add a table and a query for the component to read:

```ts [convex/schema.ts]
import { defineSchema, defineTable } from 'convex/server'
import { v } from 'convex/values'

export default defineSchema({
  tasks: defineTable({ title: v.string() }),
})
```

```ts [convex/tasks.ts]
import { query } from './_generated/server'

export const list = query({
  args: {},
  handler: async ctx => await ctx.db.query('tasks').collect(),
})
```

Then read it from a component:

```vue [src/components/TaskList.vue]
<script setup lang="ts">
import { useConvexQuery } from 'vue-convex'
import { api } from '../../convex/_generated/api'

const { data: tasks, status } = useConvexQuery(api.tasks.list)
</script>

<template>
  <p v-if="status === 'pending'">
    Loading…
  </p>
  <ul v-else>
    <li v-for="task in tasks" :key="task._id">
      {{ task.title }}
    </li>
  </ul>
</template>
```

The setup is working when the generated import resolves and the list renders. Add a row from the [dashboard](https://dashboard.convex.dev) or with `npx convex run` and it appears without a reload.

## Next steps

- Read [Queries](https://nuxt-convex.onmax.me/vue-guide/queries) to subscribe to data reactively
- Read [Convex Patterns](https://nuxt-convex.onmax.me/convex-patterns) for the backend model behind the generated API


## Sitemap

See the full [sitemap](https://nuxt-convex.onmax.me/sitemap.md) for all pages.
