---
title: "Component API"
description: "The functions the all-in-one backend component exposes as components.backend, module by module, and the helper that wraps each one."
canonical_url: "https://nuxt-backend.dev/docs/reference/backend/component"
---
# Component API

> The functions the all-in-one backend component exposes as components.backend, module by module, and the helper that wraps each one.

The `backend` component is what `app.use(backend)` mounts in `backend/convex.config.ts`. Your app
reaches it as `components.backend.<module>.<function>` (from `./_generated/api`), typed by the
package's `ComponentApi`. Every module below has a helper in the app-side entrypoints that wraps it
with the right arguments and checks — use the helper. Call a component function directly only
where the helper's docs say so, such as sending from a mutation or a workflow step.

## `adapter`

The Better Auth database: the auth tables (users, sessions, accounts, verifications, passkeys,
workspaces and their members and invitations, agent OAuth clients and tokens) behind Better Auth's
adapter interface.

- Functions: `create`, `findOne`, `findMany`, `updateOne`, `updateMany`, `deleteOne`, `deleteMany`.
- Wrapped by `setupAuth` from [`nuxt-backend/auth`](https://nuxt-backend.dev/docs/reference/api/auth): Better Auth calls
the adapter, and the functions `setupAuth` returns (`getAuthUser`, `listWorkspaces`,
`listSessions`, …) read through it.

## `email`

Transactional email through the email provider's component, nested inside `backend`, plus the
sandbox inbox test mode keeps.

- Functions: `send`, `status`, `get`, `cancel`, `cleanup`, `cleanupAbandoned`, `handleWebhook`,
`inbox`.
- Wrapped by `setupEmail` from [`nuxt-backend/email`](https://nuxt-backend.dev/docs/reference/api/email). Call
`components.backend.email.send` directly from a mutation or a workflow step, which cannot run an
action: see [Sending email](https://nuxt-backend.dev/docs/email/sending).

## `billing`

The entitlement and credit cache the billing webhooks keep: each billing entity's active products,
benefits and meters, the reservations a metered call holds until it settles, and the count of
discount codes the provider refused, per billing entity, in a fixed one-hour window (the codes
themselves are not stored). A checkout counts its code before the provider sees it and gives the
count back when the code is accepted or never tried. `entityProfile` reads who stands behind a
workspace entity, for the provider customer it bills through: its name, its owner and the
workspaces that owner owns.

- Functions: `getByUser`, `userByCustomer`, `upsert`, `deleteByUser`, `getBenefitMetadata`,
`upsertBenefitMetadata`, `credit`, `debit`, `settle`, `release`, `finalize`,
`attachReleaseJob`, `clearPendingSpends`, `clear`, `reserveDiscountCode`,
`releaseDiscountCode`, `entityProfile`.
- Wrapped by `setupBilling` from [`nuxt-backend/billing`](https://nuxt-backend.dev/docs/reference/api/billing):
[credits](https://nuxt-backend.dev/docs/billing/credits) and [feature gating](https://nuxt-backend.dev/docs/billing/feature-gating) read and
spend through it.

## `gifts`

Gift purchases: who bought which pack for which address, on which billing entity, and whether it
has been paid, notified, claimed or refunded, with the claim discount.

- Functions: `create`, `get`, `listByEmail`, `countBought`, `personalEntity`, `markPaid`,
`setDiscount`, `markNotified`, `startClaim`, `markClaimed`, `markRefunded`.
- Wrapped by `setupBilling`'s gift functions: see [Gifts](https://nuxt-backend.dev/docs/billing/credits/gifts).

## `ai`

The records of metered AI calls: one per request, from reservation to settlement or release.

- Functions: `createRequest`, `getByStream`, `markSettled`, `markReleased`, `clear`.
- Wrapped by `ai.meteredAction` from [`nuxt-backend/ai`](https://nuxt-backend.dev/docs/reference/api/ai): see
[Metered actions](https://nuxt-backend.dev/docs/ai/metered-actions).

## `webhooks`

The delivery log of the billing and email webhooks, which also makes a replayed delivery a no-op.

- Functions: `record`, `find`, `listRecent`.
- Written by the routes `registerBackendRoutes` mounts from
[`nuxt-backend/http`](https://nuxt-backend.dev/docs/reference/api/http): see [Webhooks](https://nuxt-backend.dev/docs/ship/production/webhooks).

## Types

`ComponentApi` from `nuxt-backend/_generated/component` types every function above, so your editor
shows the arguments and the return type of `components.backend.<module>.<function>`.


## Sitemap

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