Getting Started
Installation
Install and configure Nuxt Convex in your project.
Add Nuxt Convex to your project with the required peer dependencies.
Setup
Install the module and Convex:
pnpm add nuxt-convex convex
npm install nuxt-convex convex
yarn add nuxt-convex convex
nuxt-convex ships with the recommended Vue integration (convex-vue), so you do not need to install it separately.Add the module to your Nuxt configuration:
nuxt.config.ts
export default defineNuxtConfig({
modules: ['nuxt-convex'],
convex: {
storage: true, // Enable file storage (optional)
},
})
Environment Variables
The module reads CONVEX_URL or NUXT_PUBLIC_CONVEX_URL automatically.
Running
npx convex dev starts the Convex development server and sets CONVEX_URL automatically.| Variable | Description |
|---|---|
CONVEX_URL | Convex deployment URL (set by npx convex dev) |
NUXT_PUBLIC_CONVEX_URL | Alternative, follows Nuxt convention |
Virtual Modules
The module provides three virtual imports:
| Import | Purpose |
|---|---|
#convex | Core composables and client |
#convex/api | Generated Convex API types |
#convex/storage | Storage operations (when enabled) |
import { useConvexQuery } from '#convex'
import { api } from '#convex/api'
Next Steps
With the module installed, you can: