---
title: "Installation"
description: "Install nuxt-convex or vue-convex, generate the Convex API, and verify the setup with a first query."
canonical_url: "https://nuxt-convex.onmax.me/getting-started/installation"
---
# Installation

> Install nuxt-convex or vue-convex, generate the Convex API, and verify the setup with a first query.

Choose the package that matches your app, run `npx convex dev`, and verify the setup with a first query.

## Before you begin

You need:

- a Nuxt app (Nuxt `>=4.6.0 <6.0.0`) or a Vue 3 app
- a `convex/` directory in the same project, or in a Nuxt layer your app extends
- `convex` 1.25 or later

You don't need a Convex account to try it: see [Local Development](https://nuxt-convex.onmax.me/getting-started/local-development#work-without-a-convex-account).

## Install the Nuxt package

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

```ts [nuxt.config.ts]
export default defineNuxtConfig({
  modules: ['nuxt-convex'],
})
```

## Install the Vue package

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

```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')
```

## Start Convex

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

It creates a development deployment, writes its URL to `.env.local`, and generates `convex/_generated/`. Keep it running while you work.

In Nuxt, the module reads the URL from `.env.local` during `nuxt dev`, and `#convex/api` points at the generated API. In Vue, Vite loads `.env.local` and the CLI names the variable `VITE_CONVEX_URL` when your `package.json` lists `vite`. See [Local Development](https://nuxt-convex.onmax.me/getting-started/local-development#environment-variables) for the full resolution order.

## Write a first query

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

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

In Nuxt, await it so it renders on the server:

```vue [app/pages/index.vue]
<script setup lang="ts">
import { api } from '#convex/api'

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

<template>
  <pre>{{ tasks }}</pre>
</template>
```

In Vue, it loads over the WebSocket:

```vue [src/App.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>
  <pre v-if="status === 'success'">{{ tasks }}</pre>
</template>
```

The setup works when the page shows `[]`, and a document you add to the `tasks` table in the Convex dashboard appears without a reload.

## Next steps

- [Nuxt](https://nuxt-convex.onmax.me/nuxt) or [Vue](https://nuxt-convex.onmax.me/vue) for the track that matches your app
- [SSR & Hydration](https://nuxt-convex.onmax.me/nuxt-module/ssr-and-hydration) to understand what `await` does
- [Convex Patterns](https://nuxt-convex.onmax.me/convex-patterns) for the backend model


## Sitemap

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