---
title: "Composables"
description: "Signatures for every composable nuxt-backend registers, by area. The core data composables (useQuery, useMutation, …) are nuxt-convex-module's."
canonical_url: "https://nuxt-backend.dev/docs/reference/nuxt/composables"
---
# Composables

> Signatures for every composable nuxt-backend registers, by area. The core data composables (useQuery, useMutation, …) are nuxt-convex-module's.

Version: nuxt-backend 0.6.x · Tab: Reference · Kind: reference · Status: stable

Every page: [llms.txt](https://nuxt-backend.dev/llms.txt) · Skill for coding agents: [nuxt-backend](https://nuxt-backend.dev/.well-known/skills/nuxt-backend/SKILL.md)

Commands use npm; use your project's package manager.

- [Source](https://github.com/qruto/nuxt-backend/blob/main/src/nuxt/registry.ts)

This page gives the signature of every composable the module auto-imports in app code, with no `import` needed. Use it when you need the exact members a composable returns. [Composable conventions](https://nuxt-backend.dev/docs/reference/nuxt/conventions) gives the shape they all share: an options object, `isLoading` for a read, `isPending` for an action, and `error` as `BackendError | null` (`{ code, data, message }`). Generic helpers in the signatures (`FunctionReference`, `FunctionArgs`, `FunctionReturnType`, `OptionalRestArgs`, `ConnectionState`, `Value`) come from `convex` and its subpaths. Wherever a signature says `FunctionReference<…>`, Convex's newer `FunctionReference_future<…>` is accepted too.

The [Cheat sheet](https://nuxt-backend.dev/docs/reference/cheat-sheet#composables) lists them all on one screen.

## At a glance

Every composable and helper the module auto-imports, in the order it registers them, with the tab that covers it and the first line of its doc comment. It is generated from `src/nuxt/registry.ts`.

<table>
<thead>
  <tr>
    <th>
      Name
    </th>
    
    <th>
      Tab
    </th>
    
    <th>
      Tier
    </th>
    
    <th>
      What it is
    </th>
    
    <th>
      API
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        useAuth
      </code>
    </td>
    
    <td>
      Auth
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      Who is signed in: the session, the app-wide role, whether an administrator is visiting, and signing out.
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-auth">
        API
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useConnectionState
      </code>
    </td>
    
    <td>
      Data
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      The live connection to the deployment, under a neutral name for the base module's.
    </td>
    
    <td>
      none
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useBackendClient
      </code>
    </td>
    
    <td>
      Data
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      The imperative client, under a neutral name for the base module's.
    </td>
    
    <td>
      none
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useLoginFlow
      </code>
    </td>
    
    <td>
      Auth
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      The headless login flow behind <code>
        <AuthForm>
      </code>
      
       — bring your own markup and wire these refs/actions to it.
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-login-flow">
        API
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useEmailChange
      </code>
    </td>
    
    <td>
      Auth
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      The headless email change behind <code>
        <ProfileSettings>
      </code>
      
      : a code from the current address proves the person asking still holds it, a code from the new address proves they hold that one too.
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-email-change">
        API
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useWorkspace
      </code>
    </td>
    
    <td>
      Auth
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      Workspace state and actions: the list, the switch, the members and the full invitation flow (invite / accept / decline / cancel — the packaged <code>
        AcceptInvitation
      </code>
      
       component and <code>
        /accept-invitation
      </code>
      
       page build on these).
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-workspace">
        API
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useSearch
      </code>
    </td>
    
    <td>
      Data
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      Reactive, debounced full-text search.
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-search">
        API
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useBilling
      </code>
    </td>
    
    <td>
      Billing
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      Reactive billing state plus the full subscription lifecycle — checkout, portal, plan change and undoing a scheduled one, cancel (with its save offer) and uncancel, pause/resume — linked to your auth user.
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-billing">
        API
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useFeatures
      </code>
    </td>
    
    <td>
      Billing
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      Reactive feature-gating for the current user — the SaaS access primitive.
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-features">
        API
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useCredits
      </code>
    </td>
    
    <td>
      Billing
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      Reactive prepaid-credit balance for the current user, plus a <code>
        topUp()
      </code>
      
       checkout and a <code>
        refresh()
      </code>
      
       re-sync.
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-credits">
        API
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        usePricing
      </code>
    </td>
    
    <td>
      Billing
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      The app's plans and credit packs as a pricing page shows them — every plan with its monthly and yearly price, what a year saves, its trial and the credits it grants per cycle; every pack with its price per credit and which is the best value — read through the scaffolded <code>
        getPricing
      </code>
      
      , in the visitor's currency where the catalog prices it.
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-pricing">
        API
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        usePlanChange
      </code>
    </td>
    
    <td>
      Billing
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      A subscriber's switch to another plan or billing period, without its markup: the prices it can move to, in the subscription's own currency, and one confirmation that says what the switch does before it does it — the price, when it happens (a yearly price left for a monthly one waits for the paid year's end) and how the period's difference is settled, or, in a trial, what becomes of it — then the switch itself, settling that difference at once (<code>
        proration: 'invoice'
      </code>
      
      ), so the words stay true whatever the organization's default.
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-plan-change">
        API
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useBillingSection
      </code>
    </td>
    
    <td>
      Billing
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      The billing section of <code>
        /settings
      </code>
      
       without its markup: the state the plan is in, in the order the section tries them (a gifted plan, a failed payment, a pause, a cancellation or a plan change set for the period's end, a trial, else active), a read that failed as a failure rather than a plan, a return from checkout still finishing as busy, and what each state calls for, with the rules each offer follows: a switch only while nothing is scheduled, a pause only while none is, and its resume date counted the way the provider counts months.
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-billing-section">
        API
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useCampaign
      </code>
    </td>
    
    <td>
      Billing
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      The campaign a visitor arrived with, read from the address: a campaign link's discount code and its UTM attribution, ready for checkout.
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-campaign">
        API
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useOrders
      </code>
    </td>
    
    <td>
      Billing
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      The signed-in customer's billing history — past charges straight from the provider's orders API, plus the per-order invoice link.
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-orders">
        API
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useUsage
      </code>
    </td>
    
    <td>
      Billing
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      Consumption history for a credit meter, read from the provider's events API — the events your server ingested when it spent credits.
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-usage">
        API
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useGifts
      </code>
    </td>
    
    <td>
      Billing
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      Gifts, from both sides.
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-gifts">
        API
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useGiftList
      </code>
    </td>
    
    <td>
      Billing
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      The gift lists without their markup: what a person received and sent, with names, dates and states in their language, and every action over <code>
        useGifts()
      </code>
      
      , a cancel behind a recent sign-in.
    </td>
    
    <td>
      none
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useGiftForm
      </code>
    </td>
    
    <td>
      Billing
    </td>
    
    <td>
      experimental
    </td>
    
    <td>
      The gift form without its markup: a credit pack or a plan pass with its length (the lengths the plan is gifted for, at their live prices), the recipient, a note and a delivery day, and the send, which signs a visitor in and brings them back, then opens the purchaser's checkout over <code>
        useGifts().send
      </code>
      
      .
    </td>
    
    <td>
      none
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useWithdrawal
      </code>
    </td>
    
    <td>
      Billing
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      The EU withdrawal window: whether the signed-in billing manager's purchase is still inside the 14 days of the Consumer Rights Directive's Art. 9, until when, and the withdrawal itself, the withdrawal function of its Art. 11a — what <code>
        <WithdrawalButton>
      </code>
      
       is built on, for a section of your own around it.
    </td>
    
    <td>
      none
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useReferrals
      </code>
    </td>
    
    <td>
      Billing
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      A person's referral code, link and rewards: the data behind <code>
        <ReferralCard>
      </code>
      
      , for a page of your own.
    </td>
    
    <td>
      none
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useReferralInvite
      </code>
    </td>
    
    <td>
      Billing
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      The state of the page a referral link (<code>
        /r/<code>
      </code>
      
      ) opens, headless: what the link offers, the sign-in that returns to the page, and the claim.
    </td>
    
    <td>
      none
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useReferralAdmin
      </code>
    </td>
    
    <td>
      Auth
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      The admin console's Referrals tab, as data: the program's totals, the top referrers, the flagged queue and one referrer's history, through <code>
        backend/referrals.ts
      </code>
      
      , and the decision an administrator makes on a flagged referral.
    </td>
    
    <td>
      none
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        usePasskeys
      </code>
    </td>
    
    <td>
      Auth
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      Passkey management over the auth client — list, register, rename, remove.
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-passkeys">
        API
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useTwoFactor
      </code>
    </td>
    
    <td>
      Auth
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      The authenticator app as a second step after a sign-in code (TOTP), for the signed-in account: turn it on (<code>
        start
      </code>
      
      , then <code>
        confirm
      </code>
      
       with the app's first code), off, and new backup codes.
    </td>
    
    <td>
      none
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useRoomPresence
      </code>
    </td>
    
    <td>
      Data
    </td>
    
    <td>
      experimental
    </td>
    
    <td>
      Who is here: keep the signed-in person in a room (a page, a document, <code>
        workspace:<id>
      </code>
      
      ) while the page is open and visible, and list who else is there, live.
    </td>
    
    <td>
      none
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useSessions
      </code>
    </td>
    
    <td>
      Auth
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      Device-session management: list, revoke one, revoke the rest.
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-sessions">
        API
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useSignInAlerts
      </code>
    </td>
    
    <td>
      Auth
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      What an account shows around its sign-ins, without the markup: the latest sign-ins from a device it had not used before, and with its recovery code (the ones the person is also emailed about), each with its device and time, and a button that signs that session out while it is still signed in and is not this browser's.
    </td>
    
    <td>
      none
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useReauthentication
      </code>
    </td>
    
    <td>
      Auth
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      Asking the person to confirm it is them before a sensitive action: the client half of <code>
        requireRecentSignIn
      </code>
      
       and of the routes that take a recent sign-in.
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-reauthentication">
        API
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useAuditLog
      </code>
    </td>
    
    <td>
      Auth
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      The activity trail, a page at a time: the signed-in account's own (sign-ins, passkeys, email and session changes, workspaces joined, an administrator's actions on it), the active workspace's for its owners and admins, or every event for administrators.
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-audit-log">
        API
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useAccount
      </code>
    </td>
    
    <td>
      Auth
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      The account itself: its profile, its export and its deletion.
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-account">
        API
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useConsents
      </code>
    </td>
    
    <td>
      Auth
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      What a signed-in person agreed to, and the consent manager for optional storage.
    </td>
    
    <td>
      none
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useAdmin
      </code>
    </td>
    
    <td>
      Auth
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      The admin console's data and actions: a paged, searchable list of every account or every workspace, one account or workspace in full, and the administrator's actions on an account.
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-admin">
        API
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useFlag
      </code>
    </td>
    
    <td>
      Ship
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      Whether a feature flag is on for whoever is looking: their account, their active workspace and their plan, as <code>
        backend/flags.ts
      </code>
      
       declares the flag and the admin console overrides it.
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-flags">
        API
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useFlagAdmin
      </code>
    </td>
    
    <td>
      Ship
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      The admin console's Flags tab, as data: every flag with its default and its override, and the change an administrator makes, through <code>
        listFlags
      </code>
      
       and <code>
        setFlag
      </code>
      
       of <code>
        backend/flags.ts
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-flags">
        API
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useAccessPhase
      </code>
    </td>
    
    <td>
      Auth
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      The app's launch phase, so a page offers what a visitor can do now: join the waitlist in early access, bring an invite code while invite only, sign up once public.
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-access">
        API
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useInvite
      </code>
    </td>
    
    <td>
      Auth
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      Redeem an invite code or an access link on a page of your own: check it before anyone signs in, and keep it for the tab so the sign-in hands it over with the code.
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-access">
        API
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useMemberTicket
      </code>
    </td>
    
    <td>
      Auth
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      A member's ticket (<code>
        access.memberTickets
      </code>
      
      ), on markup of your own: the access link a member shares while the app is closed, admitting a few friends past the waitlist.
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-access">
        API
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useAccessAdmin
      </code>
    </td>
    
    <td>
      Auth
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      The admin console's Access tab, as data: the launch phase and its change, the invite codes and access links, the member tickets, and the invitations by address, through <code>
        backend/access.ts
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-access">
        API
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useWaitlist
      </code>
    </td>
    
    <td>
      Auth
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      Join the waitlist, and read a place in it, on markup of your own: the steps <code>
        <WaitlistForm>
      </code>
      
       runs.
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-waitlist">
        API
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useWaitlistAdmin
      </code>
    </td>
    
    <td>
      Auth
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      The admin console's Waitlist tab, as data: the waiting people (the oldest first, narrowed by a filter) with a count per status, and the changes an administrator makes, through <code>
        backend/waitlist.ts
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-waitlist-admin">
        API
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useShareLink
      </code>
    </td>
    
    <td>
      Data
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      One row's share link: whether it has a live one and since when, read live, and the actions that turn it on (or mint a new one) and off, through <code>
        getShareLink
      </code>
      
      , <code>
        enableShareLink
      </code>
      
       and <code>
        revokeShareLink
      </code>
      
       of <code>
        backend/storage.ts
      </code>
      
      .
    </td>
    
    <td>
      none
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useUploadField
      </code>
    </td>
    
    <td>
      Data
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      The upload field without its markup: pick a file (by the button or by dropping it), run your <code>
        prepare
      </code>
      
       on it, upload it with the base module's <code>
        useUploadQueue
      </code>
      
       through the upload URL <code>
        setupStorage
      </code>
      
       mints, then hand the storage id to your <code>
        claim
      </code>
      
      , where the deployment checks it.
    </td>
    
    <td>
      none
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        preparePhoto
      </code>
    </td>
    
    <td>
      Data
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      Make one photo ready to send, in the browser: decoded (a HEIC through <code>
        heic-to
      </code>
      
       when this browser can't open it, loaded only then), turned upright by its EXIF orientation, scaled down to <code>
        longEdge
      </code>
      
      , and re-encoded as <code>
        type
      </code>
      
       (JPEG by default) on a canvas, which keeps the pixels and drops every metadata tag, GPS included.
    </td>
    
    <td>
      none
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        isPhotoFile
      </code>
    </td>
    
    <td>
      Data
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      Whether a file picked, dropped or pasted is worth preparing as a photo: an image type other than SVG and GIF, or a HEIC the device left untyped.
    </td>
    
    <td>
      none
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        PhotoPrepError
      </code>
    </td>
    
    <td>
      Data
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      A photo <code>
        preparePhoto
      </code>
      
       could not make ready, as the refusal it is: <code>
        invalid_input
      </code>
      
       on <code>
        file
      </code>
      
      , with <code>
        reason
      </code>
      
      .
    </td>
    
    <td>
      none
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useNotifications
      </code>
    </td>
    
    <td>
      Email
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      The signed-in account's in-app notifications, live: newest first, paged with <code>
        loadMore
      </code>
      
      , with the unread count and the actions that mark them read.
    </td>
    
    <td>
      none
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useNotificationInbox
      </code>
    </td>
    
    <td>
      Email
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      <code>
        <NotificationInbox>
      </code>
      
       without its markup: the notifications, where the inbox is, the button's name with the unread count in it, and the bindings for a button and a list that open on the browser's own popover.
    </td>
    
    <td>
      none
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useEmailPreferences
      </code>
    </td>
    
    <td>
      Email
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      The email topics the signed-in person receives and their notification channels, kind by kind, live, and the actions that change them: the same choices as the profile's Email section, the unsubscribe page and the provider's own page, which all stay in step.
    </td>
    
    <td>
      none
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useEmailLink
      </code>
    </td>
    
    <td>
      Email
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      The unsubscribe page without its markup: what the link names, and one press that leaves the topic (or every topic), or confirms a double opt-in.
    </td>
    
    <td>
      none
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        usePushSubscription
      </code>
    </td>
    
    <td>
      Email
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      Web push on this device, for the signed-in person: whether the browser can take it, whether this device is subscribed, the permission, and the actions that subscribe and unsubscribe it.
    </td>
    
    <td>
      none
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useInstallPrompt
      </code>
    </td>
    
    <td>
      Email
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      Offer the install of the app from a button of its own: whether the browser handed over its install dialog, whether the app is installed, and the action that opens the dialog.
    </td>
    
    <td>
      none
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useAnnouncements
      </code>
    </td>
    
    <td>
      Email
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      The announcements an administrator published that the signed-in person has not dismissed, live: what <code>
        <BackendNotices>
      </code>
      
      ' <code>
        announcement
      </code>
      
       notice shows.
    </td>
    
    <td>
      none
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useAnnouncementsAdmin
      </code>
    </td>
    
    <td>
      Email
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      The admin console's Announcements tab, as data: every announcement with its notice and its broadcast, and the changes an administrator makes, through <code>
        backend/email.ts
      </code>
      
      .
    </td>
    
    <td>
      none
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useContactForm
      </code>
    </td>
    
    <td>
      Email
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      The contact form without its markup: a name and an address for a visitor, the message alone for a signed-in account (so the same form on a page behind sign-in is a feedback form), the bot check, a honeypot, and the deployment's refusals.
    </td>
    
    <td>
      none
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useReportForm
      </code>
    </td>
    
    <td>
      Ship
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      A report about content of the app's, without its markup.
    </td>
    
    <td>
      none
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useReportAppeal
      </code>
    </td>
    
    <td>
      Ship
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      The appeal of a content decision, without its markup: the decision a <code>
        #appeal=<token>
      </code>
      
       link names, the appeal's state, and sending it once.
    </td>
    
    <td>
      none
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useOnboarding
      </code>
    </td>
    
    <td>
      Auth
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      The first run at <code>
        /welcome
      </code>
      
       without its markup: the steps in order, where the person is, moving between them, and the stamp that ends it.
    </td>
    
    <td>
      none
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useActivation
      </code>
    </td>
    
    <td>
      Auth
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      The activation checklist without its markup: the first tasks <code>
        defineActivation
      </code>
      
       declares, which of them are done, the progress, and dismissing it.
    </td>
    
    <td>
      none
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useExperiment
      </code>
    </td>
    
    <td>
      Ship
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      The variant of an experiment, a <code>
        defineFlags
      </code>
      
       flag with <code>
        variants
      </code>
      
      , for whoever is looking.
    </td>
    
    <td>
      none
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useAppShell
      </code>
    </td>
    
    <td>
      UI
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      The app shell without its markup: who is signed in, the links of the account menu, signing out, and the workspace switcher.
    </td>
    
    <td>
      none
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useInboxAdmin
      </code>
    </td>
    
    <td>
      Email
    </td>
    
    <td>
      experimental
    </td>
    
    <td>
      The admin console's Inbox tab, as data: what people sent through the contact form and by email (reply addresses, workspace addresses, the support inbox), newest first, and the replies an administrator sends to the support inbox's threads, through <code>
        backend/email.ts
      </code>
      
      .
    </td>
    
    <td>
      none
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        getBackendError
      </code>
    </td>
    
    <td>
      Data
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      Read a refusal out of anything a call threw or resolved with: a <code>
        backendError()
      </code>
      
       from a Convex function, the rate limiter's own <code>
        RateLimited
      </code>
      
       error, an auth client's <code>
        { data, error }
      </code>
      
       result or its <code>
        error
      </code>
      
      , a Better Auth <code>
        APIError
      </code>
      
      , and any of these as an <code>
        Error
      </code>
      
      's <code>
        cause
      </code>
      
      .
    </td>
    
    <td>
      none
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        formatBillingAmount
      </code>
    </td>
    
    <td>
      Billing
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      Money the way the provider states it — a minor-unit integer plus an ISO currency code — rendered in <code>
        locale
      </code>
      
      , else the app's active <code>
        @nuxtjs/i18n
      </code>
      
       locale, else English: never the visitor's own, so a server render and the browser write it alike.
    </td>
    
    <td>
      none
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useBackendConfig
      </code>
    </td>
    
    <td>
      UI
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      <code>
        appConfig.backend
      </code>
      
       with the package defaults merged in — the shipped components read content (plan catalog, labels, brand) through this, so a partial user config is always safe to destructure.
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-backend-config">
        API
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useLabels
      </code>
    </td>
    
    <td>
      UI
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      The labels of one packaged component's group, resolved for the person reading them.
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-labels">
        API
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useBackendPagePath
      </code>
    </td>
    
    <td>
      UI
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      Where a ready-made page lives, for a link to it: the path the module mounted it at (the <code>
        pages
      </code>
      
       module option, else its default), in the active locale when the app uses <code>
        @nuxtjs/i18n
      </code>
      
       (through its <code>
        localePath
      </code>
      
      , so <code>
        /pricing
      </code>
      
       reads <code>
        /fr/pricing
      </code>
      
       under a prefix strategy).
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-backend-page-path">
        API
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useReturnPath
      </code>
    </td>
    
    <td>
      Auth
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      Where the person goes once a page that interrupted them is done: the page they were headed for, from the <code>
        ?redirect=
      </code>
      
       the sign-in and the first-run redirect carry (kept to a path on this site, so a link can never send them elsewhere, and never to the sign-in page, which would ask them to sign in again), else where sign-in lands (<code>
        redirects.afterSignIn
      </code>
      
      , <code>
        /
      </code>
      
       without it).
    </td>
    
    <td>
      none
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useEmailStatus
      </code>
    </td>
    
    <td>
      Email
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      Reactive delivery status for a sent email.
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-email-status">
        API
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useSandboxInbox
      </code>
    </td>
    
    <td>
      Email
    </td>
    
    <td>
      experimental
    </td>
    
    <td>
      The mail a test address received within the last hour, refreshed while the page is open — so a demo, a preview deployment or an e2e run can finish an email-code sign-in without a real mailbox.
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-sandbox-inbox">
        API
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useWorkflowStatus
      </code>
    </td>
    
    <td>
      Data
    </td>
    
    <td>
      experimental
    </td>
    
    <td>
      Reactively track a durable <a href="https://www.convex.dev/components/workflow" rel="nofollow">
        Workflow
      </a>
      
      's status.
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-workflow">
        API
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useAiStream
      </code>
    </td>
    
    <td>
      AI
    </td>
    
    <td>
      experimental
    </td>
    
    <td>
      Drive a metered, persisted AI text stream (an <code>
        ai.stream(...)
      </code>
      
       definition from <code>
        nuxt-backend/ai
      </code>
      
      ).
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-ai-stream">
        API
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useJob
      </code>
    </td>
    
    <td>
      AI
    </td>
    
    <td>
      experimental
    </td>
    
    <td>
      One queued job, live: its status, what holds it and its place in line while it waits, its progress while it runs, and its result or the reason it failed.
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-job">
        API
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useAiLabel
      </code>
    </td>
    
    <td>
      AI
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      The AI-generated label without its markup: its words, and with a provenance record the details it opens — the models, the date and a link to check the content credentials — as state and bindings.
    </td>
    
    <td>
      none
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useChat
      </code>
    </td>
    
    <td>
      AI
    </td>
    
    <td>
      experimental
    </td>
    
    <td>
      A chat with a model, live: the person's threads, the open thread's messages with the reply streaming into them, and sending.
    </td>
    
    <td>
      none
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useHumanCheck
      </code>
    </td>
    
    <td>
      Auth
    </td>
    
    <td>
      stable
    </td>
    
    <td>
      Proof that a person makes a call: the client half of <code>
        verifyHuman
      </code>
      
      , for the calls that reach the deployment over the live connection and never pass through the app's server (a waitlist join, a contact form, a referral claim).
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-human-check">
        API
      </a>
    </td>
  </tr>
</tbody>
</table>

The base module's composables an app gets under their own names. [The base module's composables](#the-base-modules-composables) below give the signatures of the ones you call most, and the [base module's docs](https://nuxt-convex-module.dev) the rest:

`useQuery`, `useQuery_experimental`, `useQueries`, `useMutation`, `useAction`, `useUpload`, `uploadFile`, `useUploadQueue`, `useStorageUrl`, `usePreloadedQuery`, `useAsyncQuery`, `usePaginatedQuery`, `usePaginatedQuery_experimental`, `useAsyncPaginatedQuery`, `loadAuthClient`, `usePreloadedAuthQuery`, `resolveAuthRedirect`.

## Auth and account

```ts
// The session, the role, impersonation and signing out, nothing else.
// isSignedIn and isLoading come from the session; isReady from the backend connection.
function useAuth(): {
  user: ComputedRef<BackendUser | null>  // with `banned`
  session: ComputedRef<BackendSession | null>
  role: ComputedRef<string>              // 'user' when signed out or unset
  hasRole: (role: string | string[]) => boolean
  isSignedIn: ComputedRef<boolean>
  isReady: ComputedRef<boolean>          // signed in, and the connection holds the token: gate signed-in reads on it
  isLoading: ComputedRef<boolean>        // the session is still resolving
  impersonating: ComputedRef<boolean>    // an administrator is visiting
  signOut: () => Promise<void>           // the app navigates after it
}

// The headless state machine behind <AuthForm>: choose → request-code →
// verify-code → passkey-offer (email OTP), choose → recover → passkey-offer
// (a passkey-only account's recovery code), or choose → signInWithPasskey.
// A step machine: its actions never reject; a failed step stays put.
function useLoginFlow(options?: {
  validateEmail?: (email: string) => boolean | string    // false = the default message, a string = your own
  onSuccess?: () => unknown | Promise<unknown>           // signed in and done (e.g. navigateTo)
  autofill?: boolean            // offer this browser's saved passkeys in the email field's autofill
  preferLastMethod?: boolean    // open on the step of the way this browser last signed in
}): {
  step: Ref<'choose' | 'request-code' | 'verify-code' | 'passkey-offer' | 'recover'
    | 'waitlisted' | 'invite-code' | 'age' | 'undeliverable'>
  lastMethod: ComputedRef<'passkey' | 'email-otp' | null>   // how this browser last signed in
  email: Ref<string>; otp: Ref<string>
  recoveryCode: Ref<string>           // typed on recover; the new code once recover() signed in
  inviteCode: Ref<string>             // typed on invite-code while the app is closed
  age: Ref<string>                    // typed on age, when the app sets a minimum age; never kept
  waitlist: Ref<{ position: number, total: number, token: string } | null>   // the place on waitlisted
  passkeyRequired: ComputedRef<boolean> // after a recovery: skipPasskey() does nothing
  isPending: ComputedRef<boolean>
  error: Ref<BackendError | null>     // why the last step failed; forbidden/banned for a banned account
  retryAfter: Ref<number | null>      // seconds to wait after a 429; null when unknown or no refusal
  emailValid: ComputedRef<boolean>
  signInWithPasskey: () => Promise<void>
  sendCode: () => Promise<void>       // → 'verify-code'
  verifyCode: () => Promise<void>     // signs in / signs up → 'passkey-offer', or done where no passkey can be saved
  redeemInviteCode: () => Promise<void>  // inviteCode and the code typed → 'passkey-offer'
  submitAge: () => Promise<void>      // the same code again, with the age → 'passkey-offer'
  addPasskey: () => Promise<void>     // → done
  skipPasskey: () => Promise<void>    // → done (not while passkeyRequired)
  recover: () => Promise<void>        // email + recoveryCode → 'passkey-offer', passkeyRequired
  goTo: (step: LoginStep) => void
  bind: LoginBindings                 // emailInput, codeInput, submit, passkeyButton, back, status
  reset: () => void
}

// The email change, by a code from each address. Like useLoginFlow, it never
// rejects: a failed step stays put with the reason in `error`.
function useEmailChange(options?: {
  validateEmail?: (email: string) => boolean | string    // gates the new address before any code is sent
  onChanged?: (newEmail: string) => unknown | Promise<unknown>
}): {
  step: Ref<'enter-email' | 'confirm-current' | 'verify-new' | 'done'>
  newEmail: Ref<string>; otp: Ref<string>
  isPending: ComputedRef<boolean>
  error: Ref<BackendError | null>
  retryAfter: Ref<number | null>      // seconds to wait after a 429
  emailValid: ComputedRef<boolean>    // validateEmail passes and it isn't the current address
  start: () => Promise<void>          // a code to the current address → 'confirm-current'
  confirmCurrent: () => Promise<void> // checks it, a code to the new address → 'verify-new'
  verifyNew: () => Promise<void>      // checks it, the account moves → 'done'
  reset: () => void
}

// Passkey management over the auth client. The list loads in the browser
// only (`undefined` during SSR); a load never rejects, the actions reject.
// A passkey-only account refuses sign-in codes and recovers through a
// recovery code; the WebAuthn Signal API keeps the browser's passkey list in step.
function usePasskeys(options?: { immediate?: boolean }): {   // immediate: load on mount, default true
  passkeys: ComputedRef<Passkey[] | undefined>
  isLoading: ComputedRef<boolean>                   // the list is loading
  isPending: ComputedRef<boolean>                   // add, rename or remove is running
  error: ComputedRef<BackendError | null>           // the last action's failure, else the last load's
  refresh: () => Promise<void>
  add: (options?: RegisterPasskeyOptions) => Promise<Passkey>
  rename: (id: string, name: string) => Promise<void>
  remove: (id: string) => Promise<void>   // the last passkey of a passkey-only account is refused
  capabilities: ComputedRef<PasskeyCapabilities | null>   // the browser's getClientCapabilities()
  passkeyOnly: ComputedRef<boolean>                 // the account refuses sign-in codes
  setPasskeyOnly: (on: boolean) => Promise<{ recoveryCode: string | null }>   // takes a recent sign-in; on resolves the recovery code
}

// Device sessions — a live list (any session age), revoke one, revoke the
// rest. Reads `listSessions` and calls `revokeSession` from backend/auth.ts.
// The list never throws; the actions reject with what the call threw and
// mirror it into `error`.
function useSessions(options?: { api?: SessionsApi }): {
  sessions: ComputedRef<SessionInfo[] | undefined>  // unexpired, latest expiry first; [] when signed out
  current: ComputedRef<SessionInfo | undefined>     // the session belonging to this browser
  isLoading: ComputedRef<boolean>
  isPending: ComputedRef<boolean>                   // an action is running
  error: ComputedRef<BackendError | null>           // the last action's failure, else the list's
  listError: ComputedRef<BackendError | null>       // the list's own failure, never an action's
  revoke: (id: string) => Promise<void>
  revokeOthers: () => Promise<void>
}

// SessionInfo: { id, userAgent, createdAt, updatedAt, expiresAt, current } — epoch ms

// <SecuritySettings>' Alerts without its markup: the latest sign-ins from a new
// device or with the recovery code, and signing that session out.
function useSignInAlerts(options?: { api?, labels? }): {
  alerts: ComputedRef<SignInAlert[] | undefined>   // newest first; [] signed out
  isLoading, isPending, error,
  device: (alert) => string,       // 'Firefox · macOS'
  date: (alert) => string,         // in the person's language
  sentence: (alert) => string,     // the alert as one sentence
  sessionOf: (alert) => SessionInfo | undefined,  // while its session is signed in
  canSignOut: (alert) => boolean,  // signed in, and not this browser
  signOut: (alert) => Promise<void>,  // rejects on failure, into error
  status, labels,
  bind,   // root, status, error (computed refs); alert(alert), signOut(alert) (functions)
}

// SignInAlert: { at, browser?, os?, recovery, sessionId? } — at in epoch ms

// Confirm it is the person before a sensitive action, by passkey or a code:
// the client half of requireRecentSignIn and of the routes that need it.
function useReauthentication(options?: {
  prompt?: boolean   // this component asks the person (as <ReauthenticateDialog> does)
}): {
  isRequired, step, email, otp, isPending, error, retryAfter,
  withPasskey, sendCode, verifyCode,
  back: () => void, cancel: () => void,
  reauthenticate: () => Promise<void>,   // rejects when they cancel
  withReauthentication: <T>(action: () => Promise<T>) => Promise<T>,
}

// The account itself: its profile, its export and its deletion.
function useAccount(options?: { api? }): {
  latestExport, exportsLeft, confirmation, isLoading, isPending, error,
  updateProfile: (fields: { name?, image?, locale? }) => Promise<void>,
  exportData: () => Promise<AccountExport>,
  deleteAccount: (confirmation: string) => Promise<void>,
  deletion,         // { requestedAt, deletesAt } | null | undefined, live
  cancelDeletion,   // () => Promise<boolean>
}
```

An administrator ends a visit with `useAdmin().stopImpersonating()`, which the impersonation notice of [`<BackendNotices>`](https://nuxt-backend.dev/docs/reference/components/shell#backendnotices) calls.

Beside the code and passkey steps, `useLoginFlow` has `undeliverable` when the email provider stopped delivering to the address after a bounce or a complaint (the same step for new and existing accounts), `waitlisted` when sign-ups are closed and the waitlist is open (`waitlist` holds the place the code check answered), `invite-code` when the launch phase asks for an invite code (`inviteCode` and `redeemInviteCode()`), `age` when the app sets a minimum age (`age` and `submitAge()`), and `passkey-offer` after a code sign-in, where `<AuthForm>` offers to save a passkey. A code only works in the browser that asked for it. Its `lastMethod`, `'passkey'` or `'email-otp'`, is the one place to read how this browser last signed in. `useAccount().deleteAccount` schedules the deletion after a grace period, which `deletion` and `cancelDeletion()` read and undo.

<table>
<thead>
  <tr>
    <th>
      Composable
    </th>
    
    <th>
      Gives
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        useConsents
      </code>
    </td>
    
    <td>
      <code>
        { consents, missing, terms, minimumAge, asks, grant, withdraw, isPending, error, storage, allowStorage, isAsking }
      </code>
      
      : the consents a person gave, by kind and version, and the consent manager's choice of optional storage. Consents given before sign-up carry over to the account
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useOnboarding
      </code>
    </td>
    
    <td>
      <code>
        { steps, step, index, total, isFirst, isLast, onboardedAt, isOnboarded, isDone, isLoading, isPending, error, stepName, next, skip, back, goTo, finish, announcement, labels }
      </code>
      
      : the first run at <code>
        /welcome
      </code>
      
       without its markup, for a page of your own beside <code>
        <OnboardingFlow>
      </code>
    </td>
  </tr>
</tbody>
</table>

## Growth

<table>
<thead>
  <tr>
    <th>
      Composable
    </th>
    
    <th>
      Gives
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        useActivation
      </code>
    </td>
    
    <td>
      <code>
        { tasks, done, progress, dismiss, isLoading }
      </code>
      
      : the activation checklist <code>
        defineActivation
      </code>
      
       declares, for an <code>
        <ActivationChecklist>
      </code>
      
       of your own. Also <code>
        total
      </code>
      
      , <code>
        isComplete
      </code>
      
      , <code>
        isDismissed
      </code>
      
      , <code>
        readOnly
      </code>
      
      , <code>
        isVisible
      </code>
      
      , <code>
        isPending
      </code>
      
      , <code>
        error
      </code>
      
      , <code>
        labels
      </code>
      
       and <code>
        bind
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useExperiment(key)
      </code>
    </td>
    
    <td>
      <code>
        { variant, isLoading }
      </code>
      
      : the variant of a <code>
        defineFlags
      </code>
      
       experiment for whoever is looking. Exposure is recorded on the first read
    </td>
  </tr>
</tbody>
</table>

## Workspaces

```ts
// The state never throws; each action resolves with its data, or rejects
// and keeps the failure in `error`.
function useWorkspace(): {
  workspaces, current, member, role, members, invitations, isLoading,
  isPending,   // true while an action runs
  error,       // the last action's failure, else a failed read
  setActive: (workspaceId: string) => Promise<void>,
  create: (args: { name, slug, logo? }) => Promise<Workspace>,
  rename: (name: string, workspaceId?: string) => Promise<void>,   // owners and admins; the address stays
  invite: (args: { email, role?, workspaceId? }) => Promise<WorkspaceInvitation>,
  removeMember: (memberId: string) => Promise<void>,
  updateMemberRole: (memberId: string, role: 'owner' | 'admin' | 'member') => Promise<void>,
  leave: (workspaceId?: string) => Promise<void>,
  acceptInvitation: (invitationId: string, options?: { activate? }) => Promise<WorkspaceMember>,
  declineInvitation, cancelInvitation,   // (invitationId) => Promise<void>
  getInvitation: (invitationId: string) => Promise<InvitationDetails | null>,
  listReceivedInvitations: () => Promise<ReceivedInvitation[]>,
}
// Workspace: { id, slug, name, role }, the shape ctx.workspace has on the backend
```

Roles are the built-in `owner`, `admin` and `member`.

## Access

<table>
<thead>
  <tr>
    <th>
      Composable
    </th>
    
    <th>
      Gives
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        useAccessPhase
      </code>
    </td>
    
    <td>
      <code>
        { phase, isPublic, isLoading, error }
      </code>
      
      : the app's launch phase, <code>
        early-access
      </code>
      
      , <code>
        invite-only
      </code>
      
       or <code>
        public
      </code>
      
      , for a page that words itself by it
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useWaitlist
      </code>
    </td>
    
    <td>
      <code>
        { step, questions, email, answers, launchNews, code, ref, dropReferral, place, shareLink, isLoading, signedIn, join, verify, status, leave, back, isPending, error, retryAfter, bind }
      </code>
      
      : join the waitlist, verify the address by a code, read the place in line and the link to share, and leave
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useWaitlistAdmin
      </code>
    </td>
    
    <td>
      <code>
        { console, isLoading, isRefused, isPending, error, admit, decline, note, caps }
      </code>
      
      : the Waitlist tab as data
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useInvite
      </code>
    </td>
    
    <td>
      <code>
        { check, status, isPending, error, isKept, forget, referral, signInTo }
      </code>
      
      : check an access link or an invite code before signing up, keep a valid one for the tab's sign-in, and go on to sign in, back to the referral page that sent the visitor here (<code>
        ?ref=<code>
      </code>
      
      ), where they claim it
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useMemberTicket
      </code>
    </td>
    
    <td>
      <code>
        { ticket, link, issue, isLoading, isPending, error }
      </code>
      
      : a member's ticket while the app is closed, <code>
        none
      </code>
      
      , <code>
        issued
      </code>
      
       (its <code>
        token
      </code>
      
      , <code>
        uses
      </code>
      
      , <code>
        left
      </code>
      
       and <code>
        expiresAt
      </code>
      
      ), <code>
        open
      </code>
      
       or <code>
        off
      </code>
      
      , and the <code>
        /invite#<token>
      </code>
      
       link to share; <code>
        issue()
      </code>
      
       mints it or answers the one held
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useAccessAdmin
      </code>
    </td>
    
    <td>
      <code>
        { console, isLoading, isRefused, isPending, error, setPhase, createInvite, revoke, admit }
      </code>
      
      : the admin console's Access tab as data
    </td>
  </tr>
</tbody>
</table>

## Billing

The billing composables bind to the `api.billing` namespace of your scaffolded `backend/billing.ts`, and each one but `useCampaign` takes an `api` option to point at another.

```ts
// Billing. Every lifecycle action takes an optional `subscriptionId` — needed
// only once the backend runs with `multipleSubscriptions` and one account
// holds several. Every action rejects with the error the call threw and
// keeps it in `error`.
function useBilling(options?: { api? }): {
  products, subscription, subscriptions, isSubscribed, isFree, isLoading,
  productsError, // why the products could not be read — the products' own part of `error`
  plan,          // the current plan's catalog key, null without one, undefined while loading
  pass,          // { plan, months?, startedAt, endsAt } | null — a plan pass gifted for a time
  isPending,     // true while an action runs
  error,         // the last action's failure, else a failed read — BackendError | null
  canManage,     // whether the caller manages the workspace's billing: its owner and admins
  saveOffers,    // whether the cancel flow has a save offer for some reason
  softOptIn,     // whether a paid checkout joins the soft opt-in topics, with a "Don't email me" box
  // Lifecycle state, read off the subscription row.
  status, cancelAtPeriodEnd, trialEnd, isTrialing, isPaused,
  isPastDue,     // a payment failed and the provider retries it: update the method in portal()
  isFinishingCheckout,   // true while the page syncs after the customer came back from checkout
  resumesAt,      // Date | null — when a paused subscription resumes by itself
  pendingChange,  // { productId, appliesAt: Date } | null — the plan change scheduled for the next period
  checkout,    // (productIds, { discountCode?, utm?, metadata?, successUrl?, emailOptOut?, … }): the trial is the plan's own
  portal,      // ({ returnUrl?, redirect? }) => Promise<string>
  changePlan,  // (productId, { proration?: 'invoice' | 'prorate', subscriptionId? })
  // ({ atPeriodEnd?, reason?, comment?, offer?: false, subscriptionId? }) =>
  //   { offer } — the save offer for that reason (a pause, a downgrade or a promotion) — or { canceled: true, endsAt }
  cancel,
  acceptOffer, // (offer) => Promise<void> — takes the save offer cancel answered with, once
  uncancel, cancelPendingChange, pause, resume,
}

// Feature gating off the webhook-synced entitlement cache.
function useFeatures(options?: { api? }): {
  plans,      // ComputedRef<string[] | undefined> — active product ids
  benefits,   // ComputedRef<EntitlementBenefit[] | undefined> — granted benefits
  isLoading,  // true until the cache has loaded — gate on it to avoid a first-paint flicker
  error,      // BackendError | null — while set, `has` and `hasPlan` say no
  quotas,     // ComputedRef<Record<string, QuotaUsage> | undefined> — every quota by key
  has: (feature: string) => boolean,       // its catalog key (the benefit's key metadata), else its benefit id — the match requireFeature makes
  hasPlan: (productId: string) => boolean,
  quota: (quota: string) => QuotaUsage | undefined,   // { limit, used }, as billing.getQuota reads it
  remaining: (quota: string) => number,    // Infinity when unlimited; 0 while loading or unreadable, so a gate fails closed
}

// Prepaid credits: the balance cache, the cycle it belongs to, and top-ups.
// `cycle` is `null` for credits bought as a one-time pack (they have no
// billing period); `expiresAtCycleEnd` is only `true` when the granting
// benefit is known not to roll over. `meter` is a catalog meter name or a raw
// meter id; omitted or blank, the entity's first configured meter.
function useCredits(options?: { meter?: MaybeRefOrGetter<string | null | undefined>, api? }): {
  balance, credited, consumed, overage, cycle, expiresAtCycleEnd,
  meterId,
  unit,       // what the meter counts, as the catalog's meters.<key>.unit names it
  isLoading,
  isPending,  // true while topUp or refresh runs
  error,      // the last action's failure, else a failed read — BackendError | null
  topUp, refresh,
}

// Past charges, read live from the provider (no local order table). Paged by
// provider page number. `invoice(orderId)` fetches the invoice link and opens
// it, resolving with the URL — `null` while the provider has no invoice PDF
// for that order yet; pass `{ open: false }` to get the URL without opening it.
// Loads never reject; `invoice` rejects on failure.
function useOrders(options?: { limit?, immediate?, api? }): {
  orders, page, total, pageCount, hasMore, hasPrevious, isLoading,
  isPending,  // true while invoice runs
  error,      // the last invoice's failure, else the last failed load — BackendError | null
  refresh, next, previous, goTo,
  invoice: (orderId: string, options?: { redirect?: boolean, open?: boolean }) => Promise<string | null>,
}

// Metered consumption for one credit meter, read live from the provider's
// events API — the events your server ingested when it spent credits.
function useUsage(options?: { meter?, limit?, immediate?, api? }): {
  events, page, total, pageCount, units, hasMore, hasPrevious,
  isLoading,
  error,      // the last failed load — BackendError | null; loads never reject
  refresh, next, previous, goTo,
}

// Gifts, from both sides. Nothing is claimed until the recipient asks.
function useGifts(options?: { api? }): {
  received,    // the delivered gifts addressed to the user's email, undefined while loading
  unclaimed,   // the waiting subset
  sent,        // the gifts the user sent: scheduled, delivered, claimed or refunded
  isLoading,   // true until the lists have loaded (always false when signed out)
  isPending,   // true while an action is in flight
  error,       // the last action's failure, else a failed read — BackendError | null
  // A credit pack by its catalog key, or a plan with its months as a pass.
  // Opens the purchaser's checkout and resolves with its URL.
  send: (item: string, options: { recipientEmail, message?, months?, deliverAt?, metadata?, currency?, successUrl?, redirect? }) => Promise<string>,
  // One gift into a workspace the user manages (their personal one by default):
  // true when the server confirmed it, false after opening the provider's $0
  // checkout. Rejects on failure.
  claim: (giftId: string, options?: { workspaceId?, successUrl?, redirect? }) => Promise<boolean>,
  resend, changeRecipient, reschedule,   // the purchaser's, until the gift is claimed
  cancel,      // refunds the purchase; needs a recent sign-in
}

// The plans and packs a pricing page shows, per currency and interval.
function usePricing(options?: {
  currency?, discount?,   // a currency over the visitor's; a public promotion to show
  server?,                // read on the server too, default true
  enabled?,               // false: not read, nor kept live
  actions?,               // build the actions bind.planAction runs, default true
  api?,
}): {
  plans, packs, intervals, currency, currencies, promotion,
  launched,               // false while billing is not launched on the deployment: "Plans open soon"
  welcome,                // the free plan's welcome credits, granted once
  isLoading, error,
  setCurrency, packFor, refresh,
  interval, setInterval,  // the interval the plans show: monthly first
  pending,                // the key of the plan whose action runs, else null
  bind,                   // periodSwitch, planCard(plan), planAction(plan), packCard(pack)
}

// The campaign a visitor arrived with, read from the address.
function useCampaign(): { discountCode, attribution, checkoutOptions }

// The page a referral link (/r/<code>) opens, headless: what the link offers,
// the sign-in that returns to the page, and the claim. Nothing is stored on the device.
function useReferralInvite(options?: { api? }): {
  code,        // the link's code, from the address
  state,       // 'checking' | 'invalid' | 'ready' | 'claimable' | 'claiming' | 'claimed' | 'ignored' | 'own'
  preview,     // the inviter's first name and what each side gets; null for a link that is none
  isLoading, isPending, error,
  signInTo,    // where the sign-in page sends the visitor, who comes back here to claim
  closed,      // true while the app is not public: a visitor needs a ticket before signing up
  claim: () => Promise<void>,   // never rejects: a code that cannot be used is 'ignored'
}
```

<table>
<thead>
  <tr>
    <th>
      Composable
    </th>
    
    <th>
      Gives
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        useReferrals
      </code>
    </td>
    
    <td>
      <code>
        { code, link, shareText, program, referrals, sharePages, isLoading, isPending, error, canShare, copied, copy, share, setSharePages }
      </code>
      
      : the person's referral code and link, the share text that discloses the reward, and the referrals it earned by state, read from <code>
        backend/referrals.ts
      </code>
    </td>
  </tr>
</tbody>
</table>

`<CancelFlow>` shows the save offers `cancel` answers with. Checkout records the auto-renew consent and forwards the customer's IP for local pricing.

## AI

```ts
// Drive a metered, persisted AI token stream (an `ai.stream(...)` definition
// from `nuxt-backend/ai`): `start` reserves credits + drives /ai/stream, the
// text also persists server-side — reload (or pass `streamId`) and it continues.
function useAiStream(
  stream: { start, body },
  options?: { streamId?, url?, headers? },
): { text, status, isStreaming, isPending, streamId, error, start: (args?) => Promise<string>, stop }
// isPending: true while the server has not yet accepted the start.
// error (BackendError | null): why the last start failed, else why its drive
// failed (the text keeps following the persisted body), else why the
// persisted body could not be read. A failed start ends in status 'error' and
// rejects with what the call threw.

// One queued job, live, through getJob and cancelJob of backend/jobs.ts. Pauses while the id is empty.
function useJob(jobId: MaybeRefOrGetter<string | null | undefined>, options?: { api? }): {
  status: ComputedRef<'queued' | 'running' | 'done' | 'failed' | 'canceled' | undefined>
  waitingOn: ComputedRef<'line' | 'owner' | 'paused' | undefined>  // what holds a waiting job
  position: ComputedRef<number | null | undefined>  // its place in the queue, 1 starts next
  estimatedWait: ComputedRef<number | undefined>    // ms until it should start
  progress: ComputedRef<{ done: number, total: number, label?: string } | undefined>  // as the job reports it
  result: ComputedRef<unknown>                      // what the handler returned, once done
  provenance: ComputedRef<JobProvenance | undefined>  // what made it, with setupAi({ provenance }): <AiLabel :provenance>
  error: ComputedRef<BackendError | null>           // why it failed, safe to show
  canCancel: ComputedRef<boolean>                   // whether the caller may cancel it now
  cancel: () => Promise<void>                       // a waiting job's hold is released; a running one stays charged
}

// A chat with a model, live: the threads, the open thread's messages with the
// reply streaming into them, and sending. Takes the functions ai.chat returns.
function useChat(chat: ChatApiRefs, options?: { threadId?: MaybeRefOrGetter<string | null | undefined> }): {
  threads: ComputedRef<ChatThread[]>        // the person's threads in the active workspace, newest first
  threadId: Ref<string | undefined>         // the open thread; set it to open another
  messages: ComputedRef<ChatMessage[]>      // oldest first; a reply being written has status 'streaming'
  send: (text: string) => Promise<string>   // to the open thread, or a new one; resolves the thread's id
  newThread: () => void
  remove: (threadId: string) => Promise<void>
  loadMore: () => void
  canLoadMore: ComputedRef<boolean>
  status: ComputedRef<'idle' | 'sending' | 'streaming' | 'error'>
  error: ComputedRef<BackendError | null>
}

// <AiLabel> without its markup: its words, and with a provenance record the
// details it opens — the models, the date and a link to the content credentials.
function useAiLabel(options?: {
  provenance?: MaybeRefOrGetter<JobProvenance | null | undefined>   // useJob().provenance, ai.provenanceOf
  src?: MaybeRefOrGetter<string | null | undefined>   // the image's public URL, for the verify link
  labels?,
}): {
  hasDetails, models, madeOn, verifyHref, labels,
  bind,   // root, trigger, details, heading, verify
}
```

## Files

Uploads use the base module's `useUpload`, with the upload URL `setupStorage` mints in your `backend/storage.ts`: `useUpload(api.storage.generateUploadUrl)` ([File storage](#file-storage)). Your mutation then claims the file with `storage.claim`, which checks its size and type. [`<UploadField>`](https://nuxt-backend.dev/docs/reference/components/forms#uploadfield) is the same flow as a field.

```ts
// One row's share link. Anyone with it reads what the table's
// shareable rule exposes, signed out. Pauses while the id is empty.
function useShareLink(table: string, id: MaybeRefOrGetter<string | null | undefined>): {
  shared: ComputedRef<boolean | undefined>
  sharedAt: ComputedRef<number | null | undefined>
  url: ComputedRef<string | null | undefined>   // null while sharing is off
  isPending: ComputedRef<boolean>
  error: ComputedRef<BackendError | null>
  enable: () => Promise<string>    // on an enabled row, rotates: the old link stops
  revoke: () => Promise<void>
}

// <UploadField> without its markup: pick a file (by the button or by dropping
// it), upload it, then hand the storage id to your claim. Never rejects.
function useUploadField(options: {
  claim: (storageId: string) => Promise<unknown>   // your mutation that keeps the file (storage.claim)
  accept?: MaybeRefOrGetter<string | undefined>   // the types the picker offers
  generateUploadUrl?,                              // default: generateUploadUrl of backend/storage.ts
  onClaimed?: (storageId: string) => void
  onError?: (error: BackendError) => void
  labels?,
}): {
  state: ComputedRef<'ready' | 'uploading' | 'claiming' | 'done' | 'refused' | 'error'>
  file, progress, storageId, error, announcement, labels,
  pick: (file: File) => Promise<string | null>   // the kept storage id, or null
  cancel: () => void
  open: () => void                                // the browser's file picker
  bind,   // root, label, input, button, progress, cancel, status, error
}
```

## Notifications

```ts
// The in-app inbox, live, newest first and paged. Each item is worded in
// the active language and carries the link it opens.
function useNotifications(options?: { limit?, api? }): {
  items, unreadCount, hasMoreUnread, isSignedIn,
  hasInbox,      // false signed out, and while an administrator acts as the account
  isLoading, isPending, isLoadingMore, canLoadMore, error,
  markRead,      // (ids) marks those notifications read
  markAllRead,   // marks every one read
  loadMore,      // the next page of older ones
}

// <NotificationInbox> without its markup: its state, the button's name with
// the unread count in it, and bindings for a button and a list on the
// browser's popover.
function useNotificationInbox(options?: { labels?, limit?, api? }): {
  notifications,   // useNotifications()'s return
  state, open, bellName, countText, follow, labels,
  bind,            // root, bell, count, panel, heading, list, item, markAll, more, loading, empty, error
}

// This browser's web push subscription.
function usePushSubscription(options?: { api? }): {
  isSupported, isSubscribed, permission,
  needsInstall,   // iOS: the app must be on the Home Screen first
  isPending, error,
  subscribe: () => Promise<boolean>,   // call it from a click; false when the person did not allow it
  unsubscribe: () => Promise<void>,
}

// The email topics and notification channels a person receives, live.
function useEmailPreferences(options?: { api?, channelsApi? }): {
  topics,           // each topic your app declares, with the person's choice
  channels,         // kind by kind, each channel it allows (in the app, by email, as push) on or off
  isLoading, isPending, error,
  set,              // (topic key or channel, on) — a double opt-in topic stays pending until confirmed
  unsubscribeAll,   // every topic off at once
}

// The unsubscribe page without its markup: what the link names, and one press
// that leaves the topic (or every topic), or confirms a double opt-in.
// Opening the page changes nothing.
function useEmailLink(query: MaybeRefOrGetter<{ token?: string, confirm?: string }>, options?: { labels?, api? }): {
  state,       // 'loading' | 'ready' | 'pending' | 'done' | 'done-all' | 'confirmed' | 'nothing' | 'invalid' | 'error' | 'no-token'
  link, topicName, isLoading, isPending, error, announcement, labels,
  leave: (all?: boolean) => Promise<void>,
  confirm: () => Promise<void>,
}

// The announcements the signed-in person has not dismissed, live: what
// <BackendNotices>' announcement notice shows.
function useAnnouncements(options?: { api? }): {
  announcements,   // newest first; [] signed out and without backend/email.ts
  isPending, error,
  dismiss: (id: string) => Promise<void>,
  linkOf: (announcement) => { href: string, external: boolean } | null,
}
```

## Admin

```ts
// The admin console's data and actions: every account or workspace, a page
// at a time, one in full, and the administrator's actions on an account.
function useAdmin(options?: {
  list?, search?, limit?,   // which list, a search term, the page size
  userId?, workspaceId?,    // one account or workspace in full
  api?,
}): {
  users, workspaces, page, hasMore, hasPrevious, user, workspace,
  isLoading, isRefused, isPending, error,
  next, previous, reset,
  setRole, ban, unban, revokeSessions,   // (userId, …) => Promise<void>
  allowSignInCodes: (userId: string) => Promise<void>,   // a passkey-only account's codes back on
  impersonate: (userId: string, options?: { workspaceId? }) => Promise<void>,
  stopImpersonating: () => Promise<void>,
}

// The activity trail, a page at a time.
function useAuditLog(options?: { scope?, limit?, api? }): {
  events, page, hasMore, hasPrevious, isLoading, isRefused, error,
  next, previous, reset,
}

// Whether a feature flag is on for whoever is looking.
function useFlag(key: MaybeRefOrGetter<string>, options?: { api? }): { isEnabled, isLoading, error }

// Every flag and its override, for an administrator.
function useFlagAdmin(options?: { api? }): { flags, isLoading, isRefused, isPending, error, setFlag }

// The Announcements tab, as data. Every change takes a recent sign-in.
function useAnnouncementsAdmin(options?: { api? }): {
  console, announcements, isLoading, isRefused, isPending, error,
  publish: (input) => Promise<string>,   // its notice shows at once; resolves its id
  end: (id: string) => Promise<boolean>,
  preview: (id: string) => Promise<void>,   // email yourself the broadcast
  send: (id: string, scheduledAt?: number) => Promise<number | null>,   // refused outside production
  cancel: (id: string) => Promise<boolean>,
}

// The Inbox tab, as data: what people sent through the contact form and by email.
function useInboxAdmin(options?: { api? }): {
  console, isLoading, isRefused, isPending, error,
  reply: (row: { id, kind }, text: string) => Promise<void>,   // from the support address; takes a recent sign-in
}

// The Referrals tab, as data: the totals, the top referrers, the flagged queue
// and one referrer's history.
function useReferralAdmin(options?: { referrerId?: MaybeRefOrGetter<string | undefined>, api? }): {
  console, isLoading, isRefused, isPending, error,
  resolve: (id: string, resolution: 'release' | 'void') => Promise<boolean>,   // takes a recent sign-in
}
```

## Data and utilities

```ts
// Debounced reactive full-text search over a `defineSearch` query (or any
// query taking `{ query: string }`); pauses while the term is blank.
function useSearch<Q extends FunctionReference<'query'>>(
  query: Q,
  options: {
    term: MaybeRefOrGetter<string | null | undefined>        // blank or whitespace-only pauses it
    debounce?: MaybeRefOrGetter<number | undefined>          // ms, default 200
    args?: MaybeRefOrGetter<Omit<FunctionArgs<Q>, 'query'>>  // merged with { query } — a limit, filter fields
  },
): {
  results: ComputedRef<FunctionReturnType<Q>>   // [] while loading, while the term is blank, after a failed read
  isLoading: ComputedRef<boolean>
  error: ComputedRef<BackendError | null>
  term: ComputedRef<string>                     // the debounced term driving the query
}

// Live email delivery status (advances as /email/events webhooks land);
// pauses while the id is undefined or empty.
function useEmailStatus(options: { emailId: MaybeRefOrGetter<string | null | undefined>, api? }): {
  data,       // the full status record — null if unknown, undefined while loading
  status,     // 'queued' | 'sent' | 'delivered' | 'bounced' | … | undefined
  isLoading,
  error,      // why the status could not be read — BackendError | null
  isDelivered,
  isFailed,   // bounced, marked as spam, or failed to send
}

// Experimental. The dev inbox: what this deployment sent to a Resend test
// address, read back through Resend's emails API, so a demo, a preview
// or an e2e run finishes an email-code sign-in with no mailbox. Needs
// `getSandboxInbox` re-exported from backend/email.ts; pauses while the
// address is empty.
function useSandboxInbox(options: { address: MaybeRefOrGetter<string | null | undefined>, api? }): {
  messages,   // newest first — undefined while loading or without an address
  latest,     // the newest message
  code,       // the first six-digit code in the newest message
  isLoading,
  error,      // BackendError | null
}

// Live durable-workflow status; pauses while the id is null/undefined.
function useWorkflowStatus<Q extends FunctionReference<'query'>>(
  query: Q,   // a query taking { workflowId } that wraps workflow.status
  options: { workflowId: MaybeRefOrGetter<string | null | undefined> },
): {
  data: ComputedRef<FunctionReturnType<Q> | undefined>
  isLoading: ComputedRef<boolean>
  error: ComputedRef<BackendError | null>
}

// A token that proves a person makes the next call: the client half of
// verifyHuman, for calls that never pass through the app's server.
function useHumanCheck(): {
  mode, isPending, error,
  token: (action: string, subject?: string) => Promise<string | null>,
}

// `appConfig.backend` with the package defaults merged in — safe to
// destructure even with a partial app.config; reactive, so HMR flows through.
function useBackendConfig(): {
  billing: { plans: PricingPlan[], packs: CreditPack[], lowCreditsThreshold: number }
  brand: { name?: string, logo?: string }
  labels: LabelOverrides<Omit<BackendLabels, 'email'>>   // labels.<group>.<key>
}

// One label group, resolved key by key: the component's `labels` prop, then
// appConfig.backend.labels, then the active @nuxtjs/i18n message
// (backend.<group>.<key>), then English. Reactive: it follows a locale switch.
// https://nuxt-backend.dev/docs/build/ui/customize/labels
function useLabels(group: LabelGroup, overrides?: MaybeRefOrGetter<LabelOverrides | undefined>): {
  t: (key: string, params?: Record<string, string | number>) => string
  rich: (key: string, params?: Record<string, string | number | VNodeChild>) => VNodeChild[]
  errorMessage: (error: unknown) => string   // a failure, worded through the `errors` group
  lookup: (key: string, params?) => string | null   // `group.key` of any group, or null when no source has it
  locale: ComputedRef<string | undefined>    // the active @nuxtjs/i18n locale
}

// Where a ready-made page lives (the `pages` module option, else its
// default), through @nuxtjs/i18n's localePath when the app has it.
function useBackendPagePath(page: MaybeRefOrGetter<BackendPageKey>): ComputedRef<string>

// Where the person goes once a page that interrupted them is done: the
// `?redirect=` the sign-in and the first-run redirect carry (a path on this
// site only), else redirects.afterSignIn.
function useReturnPath(): ComputedRef<string>

// Read a refusal's catalog code from anything a call threw or resolved with:
// a function's backendError(), the rate limiter's RateLimited error, an auth
// `{ data, error }` result, and any of them as an Error's cause. null otherwise.
// The codes: /docs/reference/backend/errors
function getBackendError(error: unknown): { code, data, message } | null

// The live connection to the deployment.
function useConnectionState(): ShallowRef<ConnectionState>

// The imperative client, for one-off calls (see Backend client).
function useBackendClient(): ConvexVueClient
```

The base module's brand-named spellings of these composables (`useConvex`, the `useConvex*` aliases, `provideConvexAuth`, `useBetterAuth`) are not auto-imported in an app that uses nuxt-backend. `useAuth().isSignedIn` and `isLoading` read the same auth state under a neutral name.

## Shell and forms

```ts
// <AppShell> without its markup: who is signed in, the account menu's links,
// signing out, and the workspace switcher.
function useAppShell(options?: {
  switcher?: MaybeRefOrGetter<boolean | undefined>   // default true; read once
  labels?,
}): {
  isSignedIn, isLoading,
  account,    // name, email, image, initials, isAdmin, impersonating, links, signOut, …
  login,      // where the sign-in page is; null when it is turned off
  switcher,   // the workspace switcher; null without one
  mainId,     // the id of the <main> landmark the skip link points to
  labels,
}

// A report about content of yours, without its markup. By default a notice
// (DSA Art. 16) anyone may send, through sendNotice: the page's address, the
// reason, why, the reporter (optional for child sexual abuse material), a
// signature for an intimate image and the good-faith statement, with a
// receipt and the decision by email. mode: 'quick' is a signed-in person's
// one-click report through reportContent instead.
// Needs sendNotice (or reportContent) re-exported from setupAdmin({ reports }).
function useReportForm(subject?: MaybeRefOrGetter<{ table: string, id: string } | null | undefined>, options?: {
  mode?: 'notice' | 'quick'                     // default 'notice'
  url?: MaybeRefOrGetter<string | undefined>     // the item's permalink; default: the report page's ?url=,
                                                 // else the page's own address, never the report page's
  reasons?: MaybeRefOrGetter<ReportReason[] | undefined>  // default every reason
  onSent?: () => void
  onError?: (error: BackendError) => void
  labels?, api?,
}): {
  mode, state: ComputedRef<'ready' | 'pending' | 'sent' | 'error' | 'refused'>
  isPending, signedIn, reasons,
  isLoading,  // the session is still read: render a quick report once false; a press waits
  reason, details, url, name, email, goodFaith, signature,  // refs
  website,                                // the honeypot: leave it empty
  contactRequired, signatureRequired,     // what a notice requires now
  error, errorField, retryAfter, announcement, labels,
  noticePath, // the report page with ?table=&id=&url=, which it fills its form from
  send: () => Promise<boolean>,   // true once filed; never rejects
  reset: () => void,
  bind,   // root, reasons, details, urlInput, nameInput, emailInput, goodFaithInput, signatureInput,
          // honeypot (its hidden wrapper), honeypotInput, submit, status, errorText (computed refs);
          // reason(reason) (a function)
}

// <ContactForm> without its markup: a name and an address for a visitor, the
// message alone for a signed-in account, the bot check and a honeypot.
// Needs submitContactMessage re-exported from email.api in backend/email.ts.
function useContactForm(options?: {
  onSent?: () => void
  onError?: (error: BackendError) => void
  labels?, api?,
}): {
  state: ComputedRef<'ready' | 'pending' | 'sent' | 'error' | 'refused'>
  isPending, signedIn,
  name, email, message,   // Ref<string>: a visitor's name and address, and the message (10 to 2,000 characters)
  website,                // the honeypot: leave it empty
  count, error, errorField, retryAfter, announcement, labels,
  send: () => Promise<boolean>,   // true once the deployment stored it; never rejects
  reset: () => void,
  bind,   // root, nameInput, emailInput, messageInput, hint, honeypotInput, submit, status, errorText
}
```

## Headless bindings

The composables behind the packaged UI return `bind`, so your own markup gets the same behaviour and accessibility as the packaged parts. Each binding is attributes and handlers to spread with `v-bind`:

```vue [app/components/AuthFormCode.vue]
<script setup lang="ts">
const flow = useLoginFlow()
</script>

<template>
  <label>Code <input v-bind="flow.bind.codeInput"></label>
  <button v-bind="flow.bind.submit">Sign in</button>
  <button v-bind="flow.bind.passkeyButton">Use a passkey</button>
</template>
```

How a template reads a binding depends on its shape, and the table says which shape each one has. A computed ref is spread with its `.value`: a template unwraps only a top-level ref, never one nested in `bind` (`v-bind="form.bind.root.value"`). A plain object is spread as it is (`v-bind="flow.bind.submit"`). A function of an item returns a plain object for it (`v-bind="report.bind.reason('spam')"`).

<table>
<thead>
  <tr>
    <th>
      Composable
    </th>
    
    <th>
      Computed refs: spread <code>
        .value
      </code>
    </th>
    
    <th>
      Plain objects: spread as they are
    </th>
    
    <th>
      Functions of an item: spread what they return
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        useLoginFlow
      </code>
    </td>
    
    <td>
      
    </td>
    
    <td>
      <code>
        bind.emailInput
      </code>
      
      , <code>
        bind.codeInput
      </code>
      
      , <code>
        bind.submit
      </code>
      
      , <code>
        bind.passkeyButton
      </code>
      
      , <code>
        bind.back
      </code>
      
      , <code>
        bind.status
      </code>
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        usePricing
      </code>
    </td>
    
    <td>
      
    </td>
    
    <td>
      <code>
        bind.periodSwitch
      </code>
    </td>
    
    <td>
      <code>
        bind.planCard(…)
      </code>
      
      , <code>
        bind.planAction(…)
      </code>
      
      , <code>
        bind.packCard(…)
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useSignInAlerts
      </code>
    </td>
    
    <td>
      <code>
        bind.root.value
      </code>
      
      , <code>
        bind.status.value
      </code>
      
      , <code>
        bind.error.value
      </code>
    </td>
    
    <td>
      
    </td>
    
    <td>
      <code>
        bind.alert(…)
      </code>
      
      , <code>
        bind.signOut(…)
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useWaitlist
      </code>
    </td>
    
    <td>
      
    </td>
    
    <td>
      <code>
        bind.emailInput
      </code>
      
      , <code>
        bind.codeInput
      </code>
      
      , <code>
        bind.launchNewsInput
      </code>
    </td>
    
    <td>
      <code>
        bind.answerInput(…)
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useUploadField
      </code>
    </td>
    
    <td>
      <code>
        bind.root.value
      </code>
      
      , <code>
        bind.label.value
      </code>
      
      , <code>
        bind.input.value
      </code>
      
      , <code>
        bind.button.value
      </code>
      
      , <code>
        bind.progress.value
      </code>
      
      , <code>
        bind.cancel.value
      </code>
      
      , <code>
        bind.retry.value
      </code>
      
      , <code>
        bind.status.value
      </code>
      
      , <code>
        bind.error.value
      </code>
    </td>
    
    <td>
      
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useNotificationInbox
      </code>
    </td>
    
    <td>
      <code>
        bind.root.value
      </code>
      
      , <code>
        bind.bell.value
      </code>
      
      , <code>
        bind.count.value
      </code>
      
      , <code>
        bind.panel.value
      </code>
      
      , <code>
        bind.heading.value
      </code>
      
      , <code>
        bind.list.value
      </code>
      
      , <code>
        bind.markAll.value
      </code>
      
      , <code>
        bind.more.value
      </code>
      
      , <code>
        bind.loading.value
      </code>
      
      , <code>
        bind.empty.value
      </code>
      
      , <code>
        bind.error.value
      </code>
    </td>
    
    <td>
      
    </td>
    
    <td>
      <code>
        bind.item(…)
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useContactForm
      </code>
    </td>
    
    <td>
      <code>
        bind.root.value
      </code>
      
      , <code>
        bind.nameInput.value
      </code>
      
      , <code>
        bind.emailInput.value
      </code>
      
      , <code>
        bind.messageInput.value
      </code>
      
      , <code>
        bind.hint.value
      </code>
      
      , <code>
        bind.honeypotInput.value
      </code>
      
      , <code>
        bind.submit.value
      </code>
      
      , <code>
        bind.status.value
      </code>
      
      , <code>
        bind.errorText.value
      </code>
    </td>
    
    <td>
      
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useReportForm
      </code>
    </td>
    
    <td>
      <code>
        bind.root.value
      </code>
      
      , <code>
        bind.reasons.value
      </code>
      
      , <code>
        bind.details.value
      </code>
      
      , <code>
        bind.urlInput.value
      </code>
      
      , <code>
        bind.nameInput.value
      </code>
      
      , <code>
        bind.emailInput.value
      </code>
      
      , <code>
        bind.goodFaithInput.value
      </code>
      
      , <code>
        bind.signatureInput.value
      </code>
      
      , <code>
        bind.honeypot.value
      </code>
      
      , <code>
        bind.honeypotInput.value
      </code>
      
      , <code>
        bind.submit.value
      </code>
      
      , <code>
        bind.status.value
      </code>
      
      , <code>
        bind.errorText.value
      </code>
    </td>
    
    <td>
      
    </td>
    
    <td>
      <code>
        bind.reason(…)
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useActivation
      </code>
    </td>
    
    <td>
      <code>
        bind.root.value
      </code>
      
      , <code>
        bind.progress.value
      </code>
      
      , <code>
        bind.dismiss.value
      </code>
    </td>
    
    <td>
      
    </td>
    
    <td>
      <code>
        bind.task(…)
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useAiLabel
      </code>
    </td>
    
    <td>
      <code>
        bind.root.value
      </code>
      
      , <code>
        bind.trigger.value
      </code>
      
      , <code>
        bind.details.value
      </code>
      
      , <code>
        bind.heading.value
      </code>
      
      , <code>
        bind.verify.value
      </code>
    </td>
    
    <td>
      
    </td>
    
    <td>
      
    </td>
  </tr>
</tbody>
</table>

The helpers the bindings are built on are exported from `#backend/a11y` for markup of your own:

- `useActionState(action)`: the busy, refused and failed states of an action, with `aria-busy` and `aria-disabled` set while it runs;
- `useFocusReturn()`: returns focus to the control that opened a dialog or a step;
- `useLiveRegion()`: announces a status or an error politely, or as an alert.

[Build on the composables](https://nuxt-backend.dev/docs/build/ui/customize/headless) walks through one.

## The base module's composables

These come from `nuxt-convex-module` under their own names.

### Queries

```ts
// Returns undefined while loading; throws query errors.
function useQuery<Q extends FunctionReference<'query'>>(
  query: Q,
  ...args: OptionalRestArgsOrSkip<Q>   // reactive args; pass 'skip' to pause
): ShallowRef<FunctionReturnType<Q> | undefined>

// Experimental object form — errors returned in result unless throwOnError.
function useQuery_experimental<Q extends FunctionReference<'query'>, ThrowOnError extends boolean = false>(
  options: { query: Q, args: MaybeRefOrGetter<FunctionArgs<Q> | 'skip'>, throwOnError?: ThrowOnError },
): ShallowRef<UseQueryResult<FunctionReturnType<Q>, ThrowOnError>>
// → { status: 'pending' | 'success' | 'error', data?, error? }

// Dynamic set of queries.
function useQueries(queries: MaybeRefOrGetter<RequestForQueries>): ShallowRef<QueriesResults>
// RequestForQueries: Record<string, { query: FunctionReference<'query'>, args: Record<string, Value> }>
// QueriesResults:    Record<string, Value | undefined | Error>
```

### Mutations and actions

```ts
function useMutation<M extends FunctionReference<'mutation'>>(mutation: M): VueMutation<M>
interface VueMutation<M> {
  (...args: OptionalRestArgs<M>): Promise<FunctionReturnType<M>>
  withOptimisticUpdate(update: OptimisticUpdate<FunctionArgs<M>>): VueMutation<M>
}

function useAction<A extends FunctionReference<'action'>>(action: A): VueAction<A>
interface VueAction<A> {
  (...args: OptionalRestArgs<A>): Promise<FunctionReturnType<A>>
}
```

### Pagination

```ts
// Positional form, throws on error.
function usePaginatedQuery<Q extends PaginatedQueryReference>(
  query: Q,
  args: MaybeRefOrGetter<PaginatedQueryArgs<Q> | 'skip'>,
  options: { initialNumItems: number },
): ShallowRef<UsePaginatedQueryReturnType<Q>>
// → { results, status: 'LoadingFirstPage' | 'CanLoadMore' | 'LoadingMore' | 'Exhausted', isLoading, loadMore }

// Experimental — overloaded: positional (throws) OR object form (errors in result).
function usePaginatedQuery_experimental<Q extends PaginatedQueryReference>(
  query: Q, args: MaybeRefOrGetter<PaginatedQueryArgs<Q> | 'skip'>, options: { initialNumItems: number },
): ShallowRef<UsePaginatedQueryReturnType<Q>>
function usePaginatedQuery_experimental<Q extends PaginatedQueryReference, ThrowOnError extends boolean = false>(
  options: MaybeRefOrGetter<UsePaginatedQueryOptions<Q, ThrowOnError>>,
): ShallowRef<UsePaginatedQueryObjectReturnType<Q, ThrowOnError>>
// object form → { data, status: 'pending' | 'success' | 'error', error, canLoadMore, isLoading, loadMore }
```

### SSR hydration

```ts
function usePreloadedQuery<Q extends FunctionReference<'query'>>(preloaded: Preloaded<Q>): ShallowRef<FunctionReturnType<Q>>
function usePreloadedAuthQuery<Q extends FunctionReference<'query'>>(preloaded: Preloaded<Q>): ShallowRef<FunctionReturnType<Q> | null>
```

### File storage

```ts
function useUpload(generateUploadUrl: GenerateUploadUrl, options?: UseUploadOptions): VueUpload
interface VueUpload {
  upload: (file: Blob) => Promise<StorageId | null>   // null on failure; see `error`
  isUploading: Ref<boolean>; progress: Ref<number>    // progress 0–1
  error: Ref<Error | null>; storageId: Ref<StorageId | null>
  cancel: () => void; reset: () => void
}

function useUploadQueue(generateUploadUrl: GenerateUploadUrl, options?: UseUploadQueueOptions): VueUploadQueue
// → { items, enqueue, isUploading, progress, pendingCount, activeCount, cancel, remove, clear }

function useStorageUrl(getUrl: GetStorageUrl, storageId: MaybeRefOrGetter<StorageId | string | null | undefined>): ShallowRef<string | null | undefined>

function uploadFile(options: { url: string, file: Blob, onProgress?: (p: number) => void, signal?: AbortSignal }): Promise<StorageId>
```

## Components

The components the module registers are on [Components](https://nuxt-backend.dev/docs/reference/components), by area, with each one's props, slots and events. A component's `labels` prop overrides its [label group](https://nuxt-backend.dev/docs/build/ui/customize/labels#the-groups) for that placement, key by key.


## Sitemap

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