Skip to main content

API Surface

Generated reference of auto-imported composables, server helpers, and global auth components.

This page is generated from module entrypoints and runtime component files.

Source of truth:

This reference answers:

  • Which APIs are auto-imported?
  • Which Nuxt aliases are registered?
  • What is each API for?
  • Where is the best guide for examples and deeper usage?

Regenerate this page with:

bash
node scripts/generate-api-surface.mjs

Nuxt Aliases

AliasPoints ToSupported Contexts
#convex/apiYour app's convex/_generated/apiVue components, composables, route middleware, Nitro server routes, tests
#convex/serverbetter-convex-nuxt server exportsNitro server routes and Convex-adjacent server utilities

Use #convex/api for generated Convex functions:

ts
import { api } from '#convex/api'

Before Convex codegen creates convex/_generated/api, this alias points to a typed placeholder that keeps imports working and fails with a codegen message if accessed.

Published Package Entries

Import SpecifierRuntime ExportsType Exports
better-convex-nuxtdefaultBaseAuthClient, ConvexAuthMode, ConvexAuthOptions, ConvexAuthClientRegistry, ConvexAuthStatus, ConvexCallErrorKind, ConvexClientHandle, ConvexRuntimeConfig, InferRegisteredConvexAuthClient, ModuleOptions, ServerConvexOptions, UseConvexAuthReturn, UseConvexMutationOptions, UseConvexPaginatedQueryOptions, UseConvexQueryOptions
better-convex-nuxt/errorsConvexCallError, normalizeConvexError, isSerializedConvexCallErrorCallResult, ConvexCallErrorKind, ConvexCallErrorInput, SerializedConvexCallError
better-convex-nuxt/auth-clientdefineConvexAuthClientBaseAuthClient, ConvexAuthClientDefinition, ConvexAuthClientRegistry, InferRegisteredConvexAuthClient
better-convex-nuxt/serverserverConvex, createClassifiedConvexFetch, normalizeServerConvexBoundaryError, exchangeConvexToken, normalizeSiteUrlServerConvexCaller, ServerConvexOptions, ConvexCredential, ConvexTokenExchangeResult
better-convex-nuxt/server/createUserSyncTriggerscreateUserSyncTriggersBetterAuthUserDocLike, CreateUserSyncTriggersOptions, UserSyncRebuildResult

Use #convex/server when an explicit server import is clearer than relying on Nuxt auto-imports, or for exports that are intentionally not auto-imported:

ts
import { serverConvex } from '#convex/server'

createUserSyncTriggers runs inside your convex/ functions, where Nuxt aliases do not exist. Import it from its dedicated subpath instead:

ts
import { createUserSyncTriggers } from 'better-convex-nuxt/server/createUserSyncTriggers'

Composable Auto-Imports

useConvexAuth, useConvexUser, and the global auth components are always available. With auth: false, they expose the documented disabled-auth state without loading Better Auth. The typed Better Auth client for an enabled build is defined with defineConvexAuthClient from better-convex-nuxt/auth-client and read through useConvexAuth().client.

NameKindPurposeLearn More
defineSharedConvexQueryHelperDefines a reusable shared query contract for multiple consumers.Guide
deleteFromPaginatedQueryHelperOptimistically removes an item from a paginated query cache.Guide
deleteFromQueryHelperOptimistically removes an item from a regular query cache.Guide
insertAtBottomIfLoadedHelperOptimistically inserts an item at the end of paginated data when loaded.Guide
insertAtPositionHelperOptimistically inserts an item at a custom position in paginated data.Guide
insertAtTopHelperOptimistically inserts an item at the top of paginated data.Guide
setQueryDataHelperReplaces cached query data with a new value.Guide
updateAllQueriesHelperApplies an updater across multiple cached query results.Guide
updateInPaginatedQueryHelperOptimistically updates matching items across paginated query pages.Guide
updateQueryHelperApplies an updater to one cached query result.Guide
useConvexComposableReturns the stable replacement-safe handle for imperative Convex calls.Guide
useConvexActionComposableRuns Convex actions with reactive status and error handling.Guide
useConvexAuthComposableTracks auth state and user/session information in Nuxt.Guide
useConvexConfigComposableAuto-imported runtime API provided by this module.Guide
useConvexConnectionStateComposableObserves live WebSocket connection state to Convex.Guide
useConvexFileUploadComposableUploads files to Convex storage with progress tracking.Guide
useConvexMutationComposableRuns Convex mutations with status, errors, and optimistic hooks.Guide
useConvexPaginatedQueryComposableFetches and paginates query results with real-time updates.Guide
useConvexQueryComposableFetches reactive query data with SSR and subscription support.Guide
useConvexStorageUrlComposableResolves Convex file storage IDs to usable URLs.Guide
useConvexUploadQueueComposableQueues and coordinates concurrent file uploads.Guide
useConvexUserComposableSeeds from session user, then upgrades to canonical user/profile data.Guide

Server Auto-Imports

NameKindPurposeLearn More
exchangeConvexTokenServer helperExchanges a cookie/bearer credential for a Convex JWT (never-throwing outcome).Guide
serverConvexServer helperCreates a request-scoped server caller with query/mutation/action for server routes and handlers.Guide

Global Auth Components

NameKindPurposeLearn More
<ConvexAuthenticated>ComponentRenders slot content only for authenticated users.Guide
<ConvexAuthError>ComponentRenders slot content when auth resolves with an error.Guide
<ConvexAuthLoading>ComponentRenders slot content while auth state is still loading.Guide
<ConvexUnauthenticated>ComponentRenders slot content only for signed-out users.Guide