API surface
Reference of auto-imported composables, server helpers, aliases, and package entries.
This page lists the auto-imported composables, server helpers, aliases, and
package entries. The source of truth is
src/module-api-surface.ts
for auto-imports, each package's exports in package.json, and the type
declarations that ship with each package. Update this page in the same pull
request that changes one of them.
Nuxt aliases
| Alias | Points to | Use it in |
|---|---|---|
#convex/api | Your app's convex/_generated/api | Vue components, composables, route middleware, Nitro server routes, tests |
#convex/server | The @lupinum/better-convex-nuxt/server exports | Nitro server routes and server utilities |
#convex/auth-client | The Better Auth client definition from convex.auth.client | Auth-enabled builds only |
Use #convex/api for generated Convex functions:
import { api } from '#convex/api'Before Convex creates convex/_generated/api, this alias points to a placeholder. Imports still compile. Reading a function from it throws an error that tells you to run Convex codegen.
Published package entries
| Import | Runtime exports | Type exports |
|---|---|---|
@lupinum/better-convex-nuxt | default | ConvexAuthMode, ConvexAuthOptions, ConvexAuthStatus, ConvexCallError, ConvexCallErrorCode, ConvexCallOutcome, ConvexCallStatus, ConvexClientHandle, ConvexFileUploadResult, ConvexFormError, ConvexFormErrorKind, ConvexFormErrorMapping, ConvexFormIssue, ConvexFormSubmitResult, ConvexOperation, ConvexOperationUploadOptions, ConvexOperationWork, ConvexQueryArgs, ConvexQueryBlockedBy, ConvexRuntimeConfig, ConvexUploadPhase, ConvexUser, ModuleOptions, NuxtConvexPaginatedQuery, NuxtConvexQuery, OptimisticUpdate, PaginatedQueryArgs, PaginatedQueryItem, UploadComplete, UploadCompleteContext, UploadProgressInfo, UploadUrlMutation, UseConvexActionReturn, UseConvexAuthReturn, UseConvexConnectionStateReturn, UseConvexFormReturn, UseConvexFileUploadOptions, UseConvexFileUploadReturn, UseConvexMutationOptions, UseConvexMutationReturn, UseConvexOperationReturn, UseConvexPaginatedQueryState, UseConvexQueryParameters, UseConvexQueryState, UseNuxtConvexPaginatedQueryOptions, UseNuxtConvexQueryOptions |
@lupinum/better-convex-nuxt/errors | ConvexCallError, ConvexFormError, isConvexCallError, normalizeConvexError, isSerializedConvexCallError | ConvexCallErrorCode, ConvexCallErrorKind, ConvexCallErrorInput, ConvexCallOutcome, ConvexFormErrorKind, ConvexFormIssue, ConvexUploadPhase, SerializedConvexCallError |
@lupinum/better-convex-nuxt/test | invalidCursorError, setupBetterConvexTest | BetterConvexTestAuth, BetterConvexTestAuthPreset, BetterConvexTestAuthResult, BetterConvexTestOperationControl, BetterConvexTestOptions, BetterConvexTestPaginatedQueryControl, BetterConvexTestQueryCall, BetterConvexTestQueryControl, BetterConvexTestRequest, BetterConvexTestRuntime, BetterConvexTestStorageControl, BetterConvexTestStorageRequest, BetterConvexTestUploadCall, BetterConvexTestUploadControl, BetterConvexTestUploadOptions |
@lupinum/better-convex-nuxt/better-auth/client | defineConvexAuthClient | BaseAuthClient, ConvexAuthClientDefinition, ConvexAuthClientRegistry, InferRegisteredConvexAuthClient, IntegratedAuthClient |
@lupinum/better-convex-nuxt/better-auth/server | createBetterConvexAuth, createUserProjectionTriggers, defineAuthAdapterFunctions, findAccountKeyCollisions, getConvexAuthProvider, mcpPrincipalValidator, requireAuthOrigin | AccountKeyCollision, AccountKeyCollisionReport, AuthComponentTriggers, AuthCtx, AuthFunctions, BetterAuthMcpAccessVerifierOptions, BetterAuthUserProjectionSource, BetterConvexAccountPolicy, BetterConvexAuth, BetterConvexAuthEmail, BetterConvexAuthEmailSender, BetterConvexAuthEmailType, BetterConvexAuthEmailUser, BetterConvexAuthInstance, BetterConvexAuthUser, BetterConvexHttpSession, BetterConvexMcp, BetterConvexMcpAccessVerifier, BetterConvexMcpHost, BetterConvexMcpOptions, BetterConvexMcpPrincipal, BetterConvexOAuthConnection, BetterConvexOAuthConnections, BetterConvexOAuthOperator, BetterConvexOrganizationAuthInstance, BetterConvexPublicOAuthClientInput, BetterConvexSessionHttpHandler, BetterConvexSessionPolicy, BetterConvexTeamOrganizationAuthInstance, CreateAuth, CreateBetterConvexAuthOptions, CreateUserProjectionTriggersOptions, FindAccountKeyCollisionsOptions, McpAccessErrorCode, VerifiedBetterConvexMcpAccess, WritableAuthCtx |
@lupinum/better-convex-nuxt/better-auth/convex.config | default | — |
@lupinum/better-convex-nuxt/better-auth/_generated/component.js | — | ComponentApi |
@lupinum/better-convex-nuxt/better-auth/test | createBetterConvexTestAuth, default, register, signInAs | BetterConvexTestAuthInstance, SignInAsOptions, SignInAsTestClient |
@lupinum/better-convex-nuxt/server | getConvexUser, requireConvexUser, serverConvex, ServerConvexValidationError, toConvexH3Error | ConvexCredential, ServerConvexCaller, ServerConvexOptions |
Import from #convex/server when you want an explicit import instead of a Nitro auto-import, or when the export is not auto-imported:
import { requireConvexUser, serverConvex } from '#convex/server'Code in your convex/ folder imports the Better Auth helpers, such as createUserProjectionTriggers, from the better-auth/server entry:
import { createUserProjectionTriggers } from '@lupinum/better-convex-nuxt/better-auth/server'Core composable auto-imports
Every build auto-imports these composables. When you omit convex.auth, the module does not install Better Auth, the auth proxy, the auth route middleware, the convexAuth page metadata, or useConvexAuth.
| Name | Kind | Purpose | Guide |
|---|---|---|---|
useConvex | Composable | Returns one stable handle with query, mutation, action, and onUpdate for direct Convex calls. | Guide |
useConvexAction | Composable | Runs a Convex action. Returns run(), data, status, pending, error, and reset(). | Guide |
useConvexAttachment | Composable | Returns the browser attachment that an embedded Vue application passes to createBetterConvex. It contains no credentials. | Guide |
useConvexConfig | Composable | Returns the readonly public Convex deployment URLs. | Guide |
useConvexConnectionState | Composable | Returns the live Convex connection state and the pending mutation and action counts. | Guide |
useConvexFileUpload | Composable | Uploads one file at a time to Convex storage with progress, an optional complete step, cancel(), and reset(). | Guide |
useConvexForm | Composable | Validates form values with a Standard Schema and submits them to one Convex mutation. | Guide |
useConvexMutation | Composable | Runs a Convex mutation. Returns mutate(), data, status, pending, error, and reset(). | Guide |
useConvexOperation | Composable | Runs several Convex calls and uploads as one operation for the signed-in user who started it. Returns run(), data, status, pending, error, and reset(). | Guide |
useConvexPaginatedQuery | Composable | Loads a paginated Convex query. The server renders the first page, and the browser loads more pages and keeps them live. | Guide |
useConvexQuery | Composable | Loads a Convex query. The server renders it, and the browser keeps it live. | Guide |
useConvexQuery options: auth, keepPreviousData, immediate, server, and lazy. It returns data, status, pending, error, isStale, blockedBy, execute(), and refresh().
useConvexPaginatedQuery options: initialNumItems, initialCursor, auth, keepPreviousData, immediate, server, and lazy. initialNumItems is required and must be a positive integer. It returns data, status, pending, error, isStale, blockedBy, canLoadMore, isLoadingMore, isExhausted, loadMore(), execute(), refresh(), and reset(). status and pending describe the first page only. loadMore() returns a Promise that never rejects.
In plain Vue, the query options do not include server or lazy.
useConvexMutation returns mutate(), data, status, pending, error, and reset(). useConvexAction returns run(), data, status, pending, error, and reset(). Destructure the result: const { mutate, pending, error } = useConvexMutation(api.notes.create).
Auth-enabled auto-imports
Authentication is off until you add a convex.auth object:
export default defineNuxtConfig({
modules: ['@lupinum/better-convex-nuxt'],
convex: {
auth: {
origin: process.env.SITE_URL ?? 'http://localhost:3000',
trustedClientIpHeader: process.env.BCN_AUTH_TRUSTED_CLIENT_IP_HEADER,
},
},
})Only an auth-enabled build auto-imports the API below. To add Better Auth client plugins, define the client with defineConvexAuthClient from @lupinum/better-convex-nuxt/better-auth/client and set convex.auth.client to that file. Use the client through useConvexAuth().client.
| Name | Kind | Purpose | Guide |
|---|---|---|---|
normalizeLocalRedirectPath | Helper | Returns a safe local application path, or null for any other value. | Guide |
useConvexAuth | Composable | Returns auth status, pending, user, error, the Better Auth client, and ready(). | Guide |
useConvexAuthReturnTo | Composable | Returns the validated local return path from the sign-in redirect query. | Guide |
Render auth UI with ordinary Vue conditionals on status, pending, and error. The module does not register auth UI components.
Server auto-imports
| Name | Kind | Purpose | Guide |
|---|---|---|---|
getConvexUser | Server helper | Reads the signed-in user for the request, or null when it is anonymous. | Guide |
requireConvexUser | Server helper | Reads the signed-in user for the request, or throws an H3 401 error. | Guide |
serverConvex | Server helper | Creates a caller for one Nitro request. It has getToken(), query(), mutation(), and action(). | Guide |
toConvexH3Error | Server helper | Maps any thrown value to an H3 error whose data is the serialized ConvexCallError. | Guide |