Api

Configuration

Module configuration options and environment variables.

Configure the Nuxt Convex module in your nuxt.config.ts.

Module Options

nuxt.config.ts
export default defineNuxtConfig({
  modules: ['nuxt-convex'],
  convex: {
    url: 'https://your-deployment.convex.cloud',
    storage: true,
  },
})
OptionTypeDefaultDescription
urlstringprocess.env.CONVEX_URLConvex deployment URL
storagebooleanfalseEnable file storage integration

Environment Variables

VariableDescription
CONVEX_URLConvex deployment URL (set by npx convex dev)
NUXT_PUBLIC_CONVEX_URLAlternative, follows Nuxt convention

The module reads CONVEX_URL first, then falls back to NUXT_PUBLIC_CONVEX_URL. Running npx convex dev sets these automatically.

Virtual Modules

The module provides these virtual imports:

ImportPurpose
#convexCore composables and client
#convex/apiGenerated Convex API types
#convex/storageStorage operations (when enabled)
import { useConvexMutation, useConvexQuery } from '#convex'
import { api } from '#convex/api'

Auto-Imports

These composables are auto-imported globally:

ComposableDescription
useConvexQuerySubscribe to reactive data
useConvexMutationExecute write operations
useConvexActionCall async actions
useConvexGet raw client

When storage is enabled:

ComposableDescription
useConvexStorageLow-level storage operations
useConvexUploadFile upload with progress

DevTools

In development, the module adds a Convex tab to Nuxt DevTools with an embedded Convex dashboard. Access your data, run functions, and view logs directly from DevTools.

TypeScript

The module generates types automatically. If you need to reference types in your code:

import type { Doc, Id } from '#convex/api'

// Document type
type Task = Doc<'tasks'>

// ID type
type TaskId = Id<'tasks'>