---
title: "Package entrypoints"
description: "The package exports map and the full import tree."
canonical_url: "https://nuxt-backend.dev/docs/reference/entrypoints"
---
# Package entrypoints

> The package exports map and the full import tree.

Two ways to consume the surface:

- **Explicit imports** — `import { … } from 'nuxt-backend/…'`, declared in the package `exports` map. The `nuxt-backend/auth*` subpaths run in your **Convex backend** (`backend/`), not the Vue app.
- **Auto-imports** — registered by the module, no `import` needed. Vue composables/components in app code; server utilities in `server/` (Nitro).

## Import tree

```text
nuxt-backend
├─ "nuxt-backend" ............................ Nuxt module (default) + type ModuleOptions
├─ "nuxt-backend/app" ............... backendEnv — the typed deployment env contract for convex.config.ts
├─ "nuxt-backend/auth" .................... setupAuth · APIError
│                                             + types SetupAuthOptions · AuthEmail · …
├─ "nuxt-backend/{billing,email,rate-limit,migrations,aggregate,search,workflows}" .. per-component setup helpers
├─ "nuxt-backend/ai" ................ setupAi — metered actions + persisted token streams over billing
├─ "nuxt-backend/http" .............. registerBackendRoutes — auth routes + /billing/events + /email/events
│                                             + /ai/stream + /mcp/exchange in one call
├─ "nuxt-backend/functions" ......... createFunctions — pre-authorized function builders
│                                             + backendError · getBackendError · BACKEND_ERRORS — the error catalog
├─ "nuxt-backend/authorization" ..... setupAuthorization — roles & permissions
├─ "nuxt-backend/mcp" ............... defineBackendMcpTool · useBackendMcp — custom agent tools (Nitro side)
├─ "nuxt-backend/convex.config" ... default: the all-in-one `backend` component
├─ "nuxt-backend/_generated/component" .. type ComponentApi  (types only)
├─ "nuxt-backend/auth.config" ....... defineBackendAuthConfig · default · type DefineBackendAuthConfigOptions
├─ "nuxt-backend/test" .............. defineBackendTestApp · asUser · seedWorkspace · register · default ({ register, schema, modules })
└─ "nuxt-backend/eslint" ............ backendEslint · BACKEND_ESLINT_RULES — the Convex lint rules for backend/

auto-imports (no import statement)
├─ Vue composables ......... useBackendClient · useQuery (+ useQuery_experimental)
│                            useQueries · useMutation · useAction
│                            usePaginatedQuery (+ usePaginatedQuery_experimental)
│                            usePreloadedQuery · usePreloadedAuthQuery · useConnectionState
│                            useUpload · useUploadQueue · useStorageUrl (+ uploadFile)
│                            useAuthState · useAuth · useLoginFlow
│                            usePasskeys · useSessions · describeUserAgent · unwrapAuth · getBackendError
│                            useOrganization · useSearch · useAggregate
│                            useBilling · useFeatures · useCredits · useOrders · useUsage · useGifts
│                            useBackendConfig · useEmailStatus · useSandboxInbox
│                            useWorkflowStatus · useAiStream
├─ Vue components .......... <Authenticated> · <Unauthenticated> · <AuthLoading>
│                            <AuthForm> · <RoleBoundary> · <FeatureBoundary> · <OrganizationBoundary>
│                            <AcceptInvitation> · <GiftClaimBanner> · <PricingTable>
│                            <BillingHistory> · <UsageHistory> · <CreditsLowBanner>
│                            <WorkspaceSettings> · <ProfileSettings> · <SecuritySettings>
│                            <StorageImage> · <BillingCheckoutLink> · <BillingPortalLink>
├─ Route middleware ........ auth — definePageMeta({ middleware: 'auth' }), opt-in per page
├─ Injection ............... useNuxtApp().$convex : ConvexVueClient
└─ Server utils (Nitro) .... fetchQuery · fetchMutation · fetchAction
                             preloadQuery · preloadedQueryResult · backendAuth
                             useBackendMcp · defineBackendMcpTool

aliases ...................... #backend · #backend/api · #backend/server
                             #backend/dataModel · #backend/_generated  (Vite + Nitro)
```

## Exports map

<table>
<thead>
  <tr>
    <th>
      Export
    </th>
    
    <th>
      Use for
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        nuxt-backend
      </code>
    </td>
    
    <td>
      The Nuxt module used in <code>
        modules: ['nuxt-backend']
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        nuxt-backend/app
      </code>
    </td>
    
    <td>
      <code>
        backendEnv
      </code>
      
       — the typed deployment env contract the scaffolded <code>
        convex.config.ts
      </code>
      
       passes to <code>
        defineApp
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        nuxt-backend/auth
      </code>
    </td>
    
    <td>
      <code>
        setupAuth
      </code>
      
      , the app's auth from one call, and <code>
        APIError
      </code>
      
       for hooks that refuse
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        nuxt-backend/http
      </code>
    </td>
    
    <td>
      <code>
        registerBackendRoutes(http, options)
      </code>
      
       — auth routes, the <a href="https://nuxt-backend.dev/docs/ship/production/webhooks">
        webhooks
      </a>
      
      , <code>
        /ai/stream
      </code>
      
      , and the <a href="https://nuxt-backend.dev/docs/agents/mcp/oauth-and-consent">
        agent token exchange
      </a>
      
       <code>
        /mcp/exchange
      </code>
      
       in one call
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        nuxt-backend/functions
      </code>
    </td>
    
    <td>
      <code>
        createFunctions(...)
      </code>
      
       — pre-authorized <code>
        authed
      </code>
      
       / <code>
        org
      </code>
      
       / <code>
        admin
      </code>
      
       / <code>
        withRole
      </code>
      
       builders
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        nuxt-backend/authorization
      </code>
    </td>
    
    <td>
      <code>
        setupAuthorization(...)
      </code>
      
       — roles & permissions over the admin plugin
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        nuxt-backend/ai
      </code>
    </td>
    
    <td>
      <code>
        setupAi(...)
      </code>
      
       — metered actions and persisted token streams: rate-limited, credit-metered (reserve → run → settle)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        nuxt-backend/mcp
      </code>
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/agents/mcp/custom-tools">
        <code>
          defineBackendMcpTool(...)
        </code>
        
         / <code>
          useBackendMcp(event)
        </code>
      </a>
      
       — custom tools on the <a href="https://nuxt-backend.dev/docs/agents/mcp">
        OAuth-protected agent endpoint
      </a>
      
       (Nitro)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        nuxt-backend/convex.config
      </code>
    </td>
    
    <td>
      Mounting the packaged all-in-one <code>
        backend
      </code>
      
       component
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        nuxt-backend/auth.config
      </code>
    </td>
    
    <td>
      Creating <code>
        auth.config.ts
      </code>
      
       with <code>
        defineBackendAuthConfig(...)
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        nuxt-backend/test
      </code>
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/ship/test">
        Testing
      </a>
      
       Convex functions in <code>
        convex-test
      </code>
      
       — <code>
        defineBackendTestApp(schema, modules)
      </code>
      
       with every scaffolded component mounted, <code>
        asUser(t, options)
      </code>
      
       for a caller signed in as a person or an agent, <code>
        seedWorkspace(t)
      </code>
      
      , and <code>
        register(t, name?)
      </code>
      
       for the <code>
        backend
      </code>
      
       component alone
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        nuxt-backend/eslint
      </code>
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/ship/test/linting">
        <code>
          backendEslint(...)
        </code>
      </a>
      
       — Convex's official lint rules for the functions directory, with its codegen ignored
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        nuxt-backend/billing
      </code>
    </td>
    
    <td>
      <code>
        setupBilling(...)
      </code>
      
       — subscriptions, discounts, prepaid credits & gifts
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        nuxt-backend/email
      </code>
    </td>
    
    <td>
      <code>
        setupEmail(...)
      </code>
      
       — transactional email over the <code>
        backend
      </code>
      
       component
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        nuxt-backend/rate-limit
      </code>
    </td>
    
    <td>
      <code>
        setupRateLimiter(...)
      </code>
      
       + <code>
        DEFAULT_LIMITS
      </code>
      
       (<code>
        emailOtp
      </code>
      
      , <code>
        emailOtpGlobal
      </code>
      
      , <code>
        billingSync
      </code>
      
      , <code>
        ai
      </code>
      
      , <code>
        aiBudget
      </code>
      
      , <code>
        mcp
      </code>
      
      )
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        nuxt-backend/migrations
      </code>
    </td>
    
    <td>
      <code>
        setupMigrations(...)
      </code>
      
       — online schema migrations
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        nuxt-backend/aggregate
      </code>
    </td>
    
    <td>
      <code>
        TableAggregate
      </code>
      
      , <code>
        withTriggers
      </code>
      
      , <code>
        Triggers
      </code>
      
       — denormalized counts/sums
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        nuxt-backend/workflows
      </code>
    </td>
    
    <td>
      <code>
        setupWorkflows(...)
      </code>
      
       — durable multi-step functions
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        nuxt-backend/search
      </code>
    </td>
    
    <td>
      <code>
        search(...)
      </code>
      
       (fluent) + <code>
        defineSearch(...)
      </code>
      
       over native full-text search
    </td>
  </tr>
</tbody>
</table>

## Selected entrypoint signatures

### `nuxt-backend/auth.config`

```ts
import defineBackendAuthConfig, {
  type DefineBackendAuthConfigOptions,
} from 'nuxt-backend/auth.config'

function defineBackendAuthConfig(options?: DefineBackendAuthConfigOptions): AuthConfig
interface DefineBackendAuthConfigOptions {
  basePath?: string  // default '/api/auth'
  jwks?: string
}
```

### `nuxt-backend/auth` — option types

```ts
interface SetupAuthOptions<DM> {
  authConfig?: AuthConfig          // override the default Convex auth config
  authOptions?: BetterAuthOptions  // merged with package defaults
  basePath?: string                // default '/api/auth'
  admin?: AdminPluginOptions                 // roles/ban/impersonation
  organization?: OrganizationPluginOptions   // workspaces, plus `invitationPath` (default '/accept-invitation')
  mcp?: McpAuthOptions                       // the agent OAuth provider
  // Cross-component wiring (AuthIntegrations):
  email: AuthEmail                           // the setupEmail instance every auth email goes through
  rateLimiter?: AuthRateLimiter              // setupRateLimiter(...) — code sends, privileged routes, the agent exchange
  canSignIn?: CanSignIn<DM>                  // who may sign in or sign up
  onUserCreated?: OnUserCreated<DM>
  onUserDeleted?: OnUserDeleted<DM>
}
```


## Sitemap

See the full [sitemap](https://nuxt-backend.dev/sitemap.md) for all pages.
