One Nuxt module that gives a client app its complete backend: sign-in, workspaces, plans and credits, email, notifications, metered AI and the pages that use them. Install it, and your app is a product people can sign in to, pay for and create things in, before you write your first feature.
It composes Convex, Better Auth, Polar, Resend, Vercel, Sentry and the Convex AI Gateway into twelve capabilities, named for what they give your app. Your code calls useCredits and reads BILLING_*, never a provider's API, and nothing needs wiring up. In development each provider runs in its own test mode: Polar's sandbox, Resend's test addresses, and sign-in codes in your terminal.
0.2.0 gives a client app these, capability by capability:
- Auth: sign-in by email code and passkey (no passwords), launch phases with invite codes, access links and a waitlist, workspaces with invitations, consents, a recent sign-in for sensitive actions, page and function guards, the admin console with impersonation, an activity trail, and an account export with deletion after a grace period.
- Data and jobs: the realtime database with live queries from Vue and Nuxt server routes, server rendering, typed errors, full-text search, checked uploads, share links, retention rules, durable workflows, and a backend that prunes its own tables.
- Billing: a catalog in code synced to Polar: monthly and yearly plans, a real free plan, prices in several currencies, a server-rendered pricing page, checkout and the customer portal, server-enforced feature gates and quotas, prepaid credits spent with reserve, run and settle, promotions, campaign links, gifts, plan passes and referrals. Stripe Managed Payments, Dodo Payments and Creem sell the same catalog through the same API (experimental), without the growth offers, which stay on Polar for now.
- Email and notifications: transactional and marketing email from one template registry, themed, in each recipient's language, with delivery tracking, preferences and one-click unsubscribe, sequences, announcements, inbound mail and contact forms; an in-app inbox and web push.
- AI: metered model calls and persisted streams through the Convex AI Gateway, generation jobs that hold credits until they run, chat and knowledge search, and moderation of prompts and uploads.
- Protection, monitoring, flags and analytics: bot checks (Vercel BotID, or a Turnstile challenge elsewhere) and rate limits; error reports, cron check-ins and a health endpoint; feature flags with targeting and kill switches; revenue metrics and growth funnels in the admin console.
- Hosting: one-command production on Vercel, a deploy template, and
doctor --prodbefore launch; any host that runs Nuxt keeps working. - The pages:
/login,/pricing,/settings,/profile,/security,/accept-invitationand/adminmount out of the box. They are headless components on a neutral stylesheet, customizable at every level (CSS tokens,app.configcontent, slots, your own page at the route) without ever ejecting. - Developer tools:
doctorandstatusfor every capability, a DevTools tab, a dev inbox,upgradefor every release, test utilities and lint rules, and for coding agents version-locked skills, a developer MCP server and a docs MCP.
Not all of it is built yet. The Feature map lists every feature, capability by capability, as available, experimental, changing (built, with an API 0.2.0 reshapes) or planned. API keys, outgoing webhooks, an MCP endpoint for your users' agents and deeper workspaces wait for the next release, as the Roadmap explains.
nuxt-backend ships two halves that work as one:
- a Nuxt module — the SaaS composables, scaffolding, env preflight, and
#backend/*aliases; and - a Convex backend — a scaffolded
convex.config.tsthat mounts the package's all-in-onebackendcomponent (auth tables + adapter, email with the provider component nested inside, the billing entitlement cache, gifts, and the activity trail) plus the upstream Polar, rate limiter, workflow, workpool, migrations, aggregate, sharded counter, action cache, and persistent-text-streaming components, with anuxt-backend/*setup helper for each.
The generic Convex ⇄ Nuxt integration underneath (live queries, mutations, SSR, auth plumbing, DevTools, Convex-aware CSP) comes from nuxt-convex-module — installed and configured automatically. Use that package directly if you only want Convex bindings without the SaaS layer. Ecosystem says which other Nuxt modules and Convex components ship with the package, work beside it, or are planned.
📖 Full documentation: nuxt-backend.dev (docs · playground) — start with the Introduction, then the Quickstart.
Requirements: Nuxt ≥ 4.7.0 (Nuxt 4; not yet Nuxt 5) and Node ≥ 24.11.
Stability: STABILITY.md — what the 0.x line promises, the experimental tier, and how upstream releases map to this package's versions. Release notes: CHANGELOG.md.
With an AI agent: paste this into Claude Code, Cursor, Codex or any agent that runs commands in your project. It installs the package's skill and follows its install guide, which starts the app on a local Convex deployment that needs no account; the agent asks before it logs in to Convex or touches your accounts.
Install nuxt-backend, the all-in-one SaaS backend for Nuxt on Convex, in this project:
run `npx -y [email protected] add https://nuxt-backend.dev --skill nuxt-backend -y`,
then follow .agents/skills/nuxt-backend/references/install.md.
By hand, with no account anywhere: create the app from the starter, then start it on a local deployment.
npm create nuxt@latest my-app -- -t gh:qruto/nuxt-backend/templates/starter
cd my-app
npx nuxt-backend dev --anonymous # or plain `npm run dev`, and pick "Start without an account"In an app you already have, the first two lines are this one. Its install step installs convex, writes
the backend files, points the dev script at nuxt-backend dev, swaps <NuxtWelcome /> for
<NuxtPage /> and adds a home page when the app has none (outside an interactive terminal,
npx nuxt-backend init does the same):
npx nuxt module add nuxt-backendThen open http://localhost:3000/login and sign in: with no email provider connected yet, the code
prints in the terminal. There is nothing to copy into .env: the first run generates AUTH_SECRET,
sets SITE_URL to localhost and BACKEND_ENVIRONMENT to development, and derives the backend's
URL from CONVEX_DEPLOYMENT. With a Polar sandbox token, npx nuxt-backend billing sync creates
the catalog in backend/billing.catalog.ts in Polar's sandbox: on the starter's /app,
Buy 500 credits pays with the test card and Spend 1 credit runs a metered action against the
balance. The Quickstart walks through it, with the
first-run fixes.
Using strict pnpm? Add
publicHoistPattern: ['@convex-dev/*']topnpm-workspace.yaml(or setnodeLinker: hoisted) so Convex can resolve the bundled component definitions. See the installation docs.
Connect services when you're ready. Put a provider key in .env.local and forward it to the
deployment with npx nuxt-backend env push: an email key sends codes to Resend's test addresses, and
a Polar sandbox token turns billing on, where npx nuxt-backend billing sync creates the catalog
(plans, credit packs, meters and promotions). Only AUTH_SECRET and SITE_URL are required to deploy; everything else is optional and
degrades in a designed way until configured, and npx nuxt-backend doctor names what is missing.
<script setup lang="ts">
import { api } from '#backend/api'
definePageMeta({ auth: true })
const { user, signOut } = useAuth()
const { isSubscribed, checkout } = useBilling()
const messages = useQuery(api.messages.list, {})
</script>Listing nuxt-backend in modules registers everything below — nothing needs importing or manual wiring.
SaaS layer (this package)
useAccessAdmin— 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, throughbackend/access.tsuseAccessPhase— 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 publicuseAccount— the account itself: its profile, its export and its deletionuseActivation— the activation checklist without its markup: the first tasksdefineActivationdeclares, which of them are done, the progress, and dismissing ituseAdmin— 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 accountuseAiLabel— 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 bindingsuseAiStream— drive a metered, persisted AI text stream (anai.stream(...)definition fromnuxt-backend/ai) (experimental)useAnnouncements— the announcements an administrator published that the signed-in person has not dismissed, live: what<BackendNotices>'announcementnotice showsuseAnnouncementsAdmin— the admin console's Announcements tab, as data: every announcement with its notice and its broadcast, and the changes an administrator makes, throughbackend/email.tsuseAppShell— the app shell without its markup: who is signed in, the links of the account menu, signing out, and the workspace switcheruseAuditLog— 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 administratorsuseAuth— who is signed in: the session, the app-wide role, whether an administrator is visiting, and signing outuseBackendConfig—appConfig.backendwith 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 destructureuseBackendPagePath— where a ready-made page lives, for a link to it: the path the module mounted it at (thepagesmodule option, else its default), in the active locale when the app uses@nuxtjs/i18n(through itslocalePath, so/pricingreads/fr/pricingunder a prefix strategy)useBilling— 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 useruseBillingSection— the billing section of/settingswithout 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 monthsuseCampaign— the campaign a visitor arrived with, read from the address: a campaign link's discount code and its UTM attribution, ready for checkoutuseChat— a chat with a model, live: the person's threads, the open thread's messages with the reply streaming into them, and sending (experimental)useConsents— what a signed-in person agreed to, and the consent manager for optional storageuseContactForm— 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 refusalsuseCredits— reactive prepaid-credit balance for the current user, plus atopUp()checkout and arefresh()re-syncuseEmailChange— the headless email change behind<ProfileSettings>: a code from the current address proves the person asking still holds it, a code from the new address proves they hold that one toouseEmailLink— 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-inuseEmailPreferences— 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 stepuseEmailStatus— reactive delivery status for a sent emailuseExperiment— the variant of an experiment, adefineFlagsflag withvariants, for whoever is lookinguseFeatures— reactive feature-gating for the current user — the SaaS access primitiveuseFlag— whether a feature flag is on for whoever is looking: their account, their active workspace and their plan, asbackend/flags.tsdeclares the flag and the admin console overrides ituseFlagAdmin— the admin console's Flags tab, as data: every flag with its default and its override, and the change an administrator makes, throughlistFlagsandsetFlagofbackend/flags.tsuseGiftForm— 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 overuseGifts().send(experimental)useGiftList— the gift lists without their markup: what a person received and sent, with names, dates and states in their language, and every action overuseGifts(), a cancel behind a recent sign-inuseGifts— gifts, from both sidesuseHumanCheck— proof that a person makes a call: the client half ofverifyHuman, 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)useInboxAdmin— 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, throughbackend/email.ts(experimental)useInstallPrompt— 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 dialoguseInvite— 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 codeuseJob— 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 (experimental)useLabels— the labels of one packaged component's group, resolved for the person reading themuseLoginFlow— the headless login flow behind<AuthForm>— bring your own markup and wire these refs/actions to ituseMemberTicket— a member's ticket (access.memberTickets), on markup of your own: the access link a member shares while the app is closed, admitting a few friends past the waitlistuseNotificationInbox—<NotificationInbox>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 popoveruseNotifications— the signed-in account's in-app notifications, live: newest first, paged withloadMore, with the unread count and the actions that mark them readuseOnboarding— the first run at/welcomewithout its markup: the steps in order, where the person is, moving between them, and the stamp that ends ituseOrders— the signed-in customer's billing history — past charges straight from the provider's orders API, plus the per-order invoice linkusePasskeys— passkey management over the auth client — list, register, rename, removeusePlanChange— 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 (proration: 'invoice'), so the words stay true whatever the organization's defaultusePricing— 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 scaffoldedgetPricing, in the visitor's currency where the catalog prices itusePushSubscription— 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 ituseReauthentication— asking the person to confirm it is them before a sensitive action: the client half ofrequireRecentSignInand of the routes that take a recent sign-inuseReferralAdmin— the admin console's Referrals tab, as data: the program's totals, the top referrers, the flagged queue and one referrer's history, throughbackend/referrals.ts, and the decision an administrator makes on a flagged referraluseReferralInvite— the state of the page a referral link (/r/<code>) opens, headless: what the link offers, the sign-in that returns to the page, and the claimuseReferrals— a person's referral code, link and rewards: the data behind<ReferralCard>, for a page of your ownuseReportAppeal— the appeal of a content decision, without its markup: the decision a#appeal=<token>link names, the appeal's state, and sending it onceuseReportForm— a report about content of the app's, without its markupuseReturnPath— where the person goes once a page that interrupted them is done: the page they were headed for, from the?redirect=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 (redirects.afterSignIn,/without it)useRoomPresence— who is here: keep the signed-in person in a room (a page, a document,workspace:<id>) while the page is open and visible, and list who else is there, live (experimental)useSandboxInbox— 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 (experimental)useSearch— reactive, debounced full-text searchuseSessions— device-session management: list, revoke one, revoke the restuseShareLink— 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, throughgetShareLink,enableShareLinkandrevokeShareLinkofbackend/storage.tsuseSignInAlerts— 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'suseTwoFactor— the authenticator app as a second step after a sign-in code (TOTP), for the signed-in account: turn it on (start, thenconfirmwith the app's first code), off, and new backup codesuseUploadField— the upload field without its markup: pick a file (by the button or by dropping it), run yourprepareon it, upload it with the base module'suseUploadQueuethrough the upload URLsetupStoragemints, then hand the storage id to yourclaim, where the deployment checks ituseUsage— consumption history for a credit meter, read from the provider's events API — the events your server ingested when it spent creditsuseWaitlist— join the waitlist, and read a place in it, on markup of your own: the steps<WaitlistForm>runsuseWaitlistAdmin— 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, throughbackend/waitlist.tsuseWithdrawal— 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<WithdrawalButton>is built on, for a section of your own around ituseWorkflowStatus— reactively track a durable Workflow's status (experimental)useWorkspace— workspace state and actions: the list, the switch, the members and the full invitation flow (invite / accept / decline / cancel — the packagedAcceptInvitationcomponent and/accept-invitationpage build on these)
Core (from nuxt-convex-module) — useQuery, useQueries, useMutation, useAction, usePaginatedQuery, usePreloadedQuery, useUpload, useUploadQueue, useStorageUrl, and friends, plus useBackendClient and useConnectionState, the neutral names of its brand-named composables. Those brand-named names are not auto-imported.
<AcceptInvitation>— Accept/decline UI for a workspace-invitation link (/accept-invitation?id=<invitationId>— the URL invitation emails point at)<AccessDenied>— what a signed-in person sees when a page is not open to them: the page guard's 403 (definePageMeta({ auth: { role, workspace, feature } })) on the module's error page or your app'serror.vue, or a refusal of your own<AccountData>— the account's data rights: download everything the app keeps of the account in one file, and delete the account, once the person typed their address to confirm it<ActivationChecklist>— the first tasks that lead to value, with progress, for a page of your app: the tasksdefineActivationdeclares, each ticked off when its event is recorded, "2 of 4 done", a link per open task and a Dismiss button<AdminUsers>— every account of the app, for its administrators: a search by address, a page at a time (AdminUsersTable), and a drawer with one account in full (AdminUserDrawer): its role, its ban, its device sessions and workspaces, and "Impersonate"<AdminWorkspaces>— every workspace of the app, read-only, for its administrators: a search by name, a page at a time (AdminWorkspacesTable), and a drawer with one workspace's members and open invitations (AdminWorkspaceDrawer)<AiLabel>— the visible "AI-generated" label the EU AI Act (Art. 50) asks for, beside an image or a text a model made<AppShell>— the frame of a signed-in app, for your layout: a header with your brand and links, the workspace switcher, the notification bell and the account menu, then the app-wide notices, then your page in the<main>landmark, with the consent dialog and the connection status closing it<AuditLog>— the activity trail as a list, a page at a time: the signed-in account's own (scope="mine", the default), the active workspace's for its owners and admins (scope="workspace"), or every event for administrators (scope="all")<AuthForm>— the complete passwordless sign-in flow (passkeys + email OTP) in one component: semantic markup where every element carries adata-authattribute, built from parts (AuthFormChoose,AuthFormCode, …) that a same-named component of the app's replaces, and a slot per step<BackendNotices>— one region for every notice that holds for the whole session, on every page: an administrator acting as the account, maintenance, a failed payment, a scheduled deletion, low credits, a gift to claim and announcements<BillingCheckoutLink>— a link that opens a checkout for the caller's billing entity<BillingHistory>— the customer's past charges with their invoice links — every row read live from the billing provider (this package stores no order ledger), so what renders is what the provider will show on the invoice<BillingPortalLink>— a link that opens the billing customer portal for the caller's billing entity, through the app'sgenerateCustomerPortalUrl, on click<CancelFlow>— cancelling takes one step; a save offer is one optional step<ConnectionStatus>— the live connection's state, in words, for a person: nothing while it is up; "Reconnecting…" once a drop has lasteddelay; "You're offline." as soon as the browser is; and how many changes wait to be sent meanwhile<ConsentPrompt>— asks for the consents a person has not given at their current version, and nothing else: the required kindssetupAccount({ consents })declares after a version rises (the page waits behind a dialog until they are accepted), the age of an account that never answered the minimum age, and, while the app uses optional storage, one question per browser with Allow and Decline of equal weight<ContactForm>— a contact form for visitors, and a feedback form for signed-in people: the same component<Gate>— renders its content only for the people every check it names admits: signed in (signed-in), an app-wide role (role), the active workspace or a role in it (workspace), a feature of the plan (feature), or room left on a quota (quota,amount)<GiftForm>— the gift form: a credit pack or a plan pass with its length (the lengths the plan is gifted for, at their live prices), the recipient's email, a note and a delivery day, then the purchaser's own checkout (useGifts().send)<GiftList>— the gifts a person received, each to claim into a workspace they manage, and the gifts they sent, each with what they can still do until it is claimed: resend its notice, address it to someone else, date it again, or cancel it for a refund behind a recent sign-in<HowDidYouHear>— one optional question after sign-up: "How did you hear about us?"<LegalContactPoints>— the single points of contact the EU Digital Services Act asks every host to name: one for the authorities of the member states, the Commission and the Board (Art. 11), one for the people who use the app (Art. 12,legal.contactunless you name another), and the languages you answer in, fromappConfig.backend.legal.contactPoints<LegalDetail>— one of the company detailsappConfig.backend.legalholds, inside a sentence of yours: the company, its address and phone, the contact, the data protection officer, the registration number, the share capital, the VAT line, the publication director, the host or the consumer mediator<LegalModeration>— how content is moderated, as the EU Digital Services Act asks a host's terms to say (Art. 14): a person on your team decides every report, every notice and every appeal, through the admin console's Reports tab; and the automated tools that check content (appConfig.backend.legal.moderation), each with what it checks and whether its verdict takes effect on its own or waits for a person<LegalProcessors>— the processors an app on the package hands personal data to, as a table: who, what each handles, where, and its agreement<LegalStorage>— every cookie and storage key the package writes for the capabilities the app uses, then the app's own (appConfig.backend.legal.storage), as a table: its name, where it lives, what it is for, how long it lasts, and whether it waits for the person's permission<LegalVersion>— the version of one of your documents, assetupAccount({ consents })declares it inbackend/account.ts: the version the consent ledger records when someone agrees, so the page and the record never disagree<NotificationInbox>— what the app told a person, in the app: a button whose accessible name carries the unread count, and the list it opens on the browser's own popover, newest first<OnboardingFlow>— the first run a new account sees once, at/welcome: a few short steps<PricingTable>— a complete pricing table, rendered on the server: plan cards from the live pricing (usePricing, the scaffoldedgetPricing), a monthly / yearly switch with what a year saves, subscribe / switch / cancel actions, credit packs compared credit for credit, a contact card, and a customer-portal link<ProfileSettings>— account profile: identity chrome (avatar initials, verification / role / workspace badges), display-name editing, the email change, by a code from each address, and, with@nuxtjs/i18nand two locales or more, the person's language, which their emails are written in<ReauthenticateDialog>— "Confirm it's you": the dialog a sensitive action opens when the server refuses it asreauthentication_required<ReferralCard>— a person's referral link, with copy and share buttons and the disclosure of the reward: the link is/r/<code>on this site, made the first time the card is read<SecuritySettings>— everything that guards the account: passkey management (add / inline rename / remove), active device sessions (revoke one / revoke others), the latest sign-ins from a new device (each signs its session out while it lasts), and signing this browser out<UpgradePrompt>— what someone whose plan lacks a feature sees: a sentence naming the plans on sale that include it, in pricing order, and a link to the first of them on the pricing page (/pricing?plan=<key>)<UploadField>— a labelled file field that uploads through the upload URLsetupStoragemints, then callsclaim, where the deployment checks the file<UsageHistory>— metered consumption, event by event, straight from the provider's events API — the same records that drew the credit balance down<WaitlistForm>— join the waitlist: the address, your questions, the launch-news box (unticked), then the sign-in code that proves the address, then the person's place, a link to share and a way to leave<WithdrawalButton>— the EU withdrawal button (Consumer Rights Directive Art. 11a, from 2026-06-19): "Withdraw from contract here", for a purchase inside its 14 days, then a confirm step, "Confirm withdrawal"<WorkspaceSettings>— workspace, plan, and credits management — the billing entity is the active workspace, so switching workspaces switches the subscription
From the base module, under neutral names: <Authenticated>, <Unauthenticated>, <AuthLoading> and <AuthBoundary> render by auth state, and <StorageImage> shows an image from file storage.
Every packaged component keeps one contract: typed slots and events, a data-* hook on each element, a deliberate loading, empty, failed, busy and refused state, and the accessibility guarantees: repeated controls in named groups, live regions, busy buttons that keep focus. An axe-core smoke checks the starter's sign-in and pricing pages in both colour schemes.
backendAuth(event)— an authenticated, request-scoped Convex clientfetchQuery/fetchMutation/fetchActionpreloadQuery/preloadedQueryResult
Plus the same-origin /api/auth/** Better Auth proxy and the opt-in auth route middleware.
An OAuth-protected /mcp endpoint (Better Auth's OIDC provider + @nuxtjs/mcp-toolkit): an agent signs in with PKCE, the person approves it on a consent page, and every tool call runs your Convex functions as that signed-in user — ctx.auth, workspace, and billing entity resolve exactly like a web session. Built-in tools cover profile, billing (reads and checkout links — never payments), and workspaces; defineBackendMcpTool adds your own. Experimental: the MCP authorization profile and the toolkit are still moving, so this surface may change shape in a 0.x minor (see STABILITY.md).
A Backend tab in Nuxt DevTools: a console of the capabilities, each lit by its state, the deployment you're talking to and every env name set here and on it, live checks with a copyable fix and doctor on demand, the signed-in account with its workspace, sessions and passkeys, the subscription, credits and catalog sync, email transport, delivery status and a preview of every email in each language, light and dark, the webhook delivery log, the agent endpoint, monitoring (the app's health and a local log of the errors it captured), and an activity log of sign-ins, plan changes, credit spend and webhook deliveries that also lands on the Vue DevTools timeline. File buttons open your backend functions in the editor.
Errors from the browser, the Nuxt server and the backend's actions go to Sentry once @sentry/nuxt (an optional peer) is installed and a DSN is set, each report about a failed backend call tagged with the function it ran and its error code; refusals from the error catalog never are. The backend's maintenance cron checks in to a cron monitor, checkIn checks your own jobs in, and GET /api/backend/health answers every app layer's state for uptime checks. In dev without a DSN, a local error log in DevTools stands in.
nuxt-backend/test runs your Convex functions in convex-test with every component mounted and callers signed in as a real session leaves them. nuxt-backend/test-utils puts a fake backend under the composables for page and component tests: createBackendMock({ user, queries }), with backendTestAliases() in the Vitest project, and no vi.mock; renderEmail renders an email the package sends, in a recipient's language, with no deployment. Experimental (see Testing).
nuxt-backend/eslint adds Convex's official lint rules for backend/ to the @nuxt/eslint config: export default withNuxt(backendEslint()).
#backend, #backend/api, #backend/server, #backend/dataModel, #backend/_generated — typed imports for your Convex functions dir (fallback types keep a fresh project compiling before the first convex dev).
On dev startup the module checks your environment — missing site URL, weak AUTH_SECRET, malformed SITE_URL — and prints actionable hints. The Convex deployment itself enforces the full env at push time: a deploy fails until every required variable is set.
nuxt-convex-module (the Convex integration, with Better Auth + Polar force-enabled and this package's passwordless auth client) and nuxt-security (Convex-aware CSP in production) are installed as true module dependencies — deduplicated if your app lists them too, configurable through their own convex / security keys.
The scaffolded backend/ files compose the backend from nuxt-backend/*:
convex.config.ts— the explicit app definition, scaffolded for you: declares the env contract (backendEnvfromnuxt-backend/app), mounts the all-in-onebackendcomponent (auth + email + billing cache + gifts, with the email provider nested inside) and the upstream components oneapp.useeach, and forwards the email and monitoring configsetupAuth— passwordless Better Auth (OTP + passkey plugins), workspaces with emailed invitations, its email sent throughsetupEmailsetupBilling— products, checkout, webhook handlers, entitlement cache, prepaid credits (spendCredits), and gift purchases (giftCheckout/claimGift)setupAi(nuxt-backend/ai) — metered actions and persisted token streams: rate-limited, prepaid-credit-metered with reserve → run → settle (a failed run costs nothing), usage ingested into the billing provider; models named asprovider/modelids reach the AI Gateway through the AI SDK (ai, an optional peer), each call charged at the cost it reports, through the Convex AI Gateway on a paid Convex plan or the Vercel AI Gateway withAI_GATEWAY_API_KEYregisterBackendRoutes— one call mounts every inbound route: auth routes,/billing/events,/email/events,/ai/stream, the agent token exchange at/mcp/exchange, and the backend's health at/backend/healthsetupEmail— transactional and marketing email, and the templates of every email the package sends (auth and billing send through it), in one layout with your brand and in each recipient's language (messages,user.locale)verifyHuman(nuxt-backend/functions) — checks that a person makes a call of your own (a waitlist join, a form): a proof the app's server signed after its bot check, or a challenge answer verified on the deploymentnuxt-backend/monitoring—reportError,reportingErrorsandcheckIn: error reports and cron check-ins from your own actions, posted withfetch(no SDK in the backend; experimental)setupRateLimiter,setupWorkflows,defineSearch. Counters, workpools, cached actions, aggregates, crons and migrations: import the Convex component directly
npx nuxt-backend <command> — init scaffolds the backend files, .env.example, the nuxt.config wiring and the agent files, AGENTS.md and .mcp.json (re-run to restore missing files); dev runs Convex and Nuxt together (--anonymous on an account-free local deployment); doctor checks the project and deployment configuration (--fix repairs what it can; --prod also reads production's switches and email, and probes its live site); status shows each capability (auth, data, jobs, billing, email, ai, protection, monitoring, flags and the rest) as live, test, missing or failing; upgrade moves an app to the installed version (it repairs the scaffold and runs the package's data migrations, and rewrites none of your code); env push syncs .env.local to the Convex deployment; billing sync pushes your billing.catalog.ts to the billing provider, writes the id map, and stores the webhook secret on the deployment; mcp runs the developer MCP server .mcp.json names, which gives your coding agent the project's state, the docs and the provider consoles, and asks you before any change.
Everything is on nuxt-backend.dev — the site (docs · playground) is the website/ app of this repository, and pnpm dev at the root serves it.
| Tab | What's inside |
|---|---|
| Start | Introduction, quickstart, the feature map, installation, templates, the playground, concepts (capabilities, principles, environments), developing locally, DevTools |
| Auth | Auth setup, sign-in, roles and permissions, workspaces and invitations |
| Billing | Catalog as code, subscriptions, feature gating, prepaid credits, gifts |
| Sending, templates, branding and languages, delivery tracking | |
| AI | Metered actions, streaming, models through the gateway |
| Agents | The OAuth-protected MCP endpoint, built-in and custom tools, consent, connecting a client, the agent skills |
| Data | Queries and mutations, server rendering, search, aggregates and counters, files, workflows, scheduled jobs, queues, cached actions, migrations |
| UI | The packaged pages and the customization ladder |
| Ship | Testing, deployment, the launch checklist, security, rate limits, webhooks, troubleshooting |
| Reference | Configuration, the Nuxt app, entrypoints, the CLI, the generated API reference |
Each one is created with create nuxt (pnpm create nuxt@latest my-app -t gh:qruto/nuxt-backend/<path>) and runs against a Convex deployment of your own — see Templates & Examples.
templates/starter— the app to build on: the exactnuxt-backend initscaffold, zero custom backend code: passwordless auth, workspace invitations, billing, credits, and gifts out of the boxtemplates/panels— Panels, the app the tutorial builds and the live playground runs: an idea and a photo become a three-panel comic strip, with credits, a generation queue, moderation, share links and notificationsexamples/advanced— every customization point in one app: a customizedconvex.config.ts(extra env, an unmounted component), custom email templates, a custom invitation page, explicit billing config, custom webhook paths and hooks, a hand-rolled signup workflow and explicit gift claimingexamples/convex-auth— Convex Auth mode (backend.auth: 'convex-auth'): a username and password sign-in through@convex-dev/auth, cookie sessions and a guarded page, with the Better Auth features off
- Clone this repository
- Install dependencies using
pnpm install - Prepare for development using
pnpm dev:prepare - Start development server using
pnpm dev, orpnpm tryfor every feature on a local deployment with seeded personas (Try everything)
We follow conventional commits (Dependabot PRs do too). See CONTRIBUTING.md and RELEASE.md for the full workflow.
Found a vulnerability? Report it privately via GitHub Security Advisories — not in a public issue. See SECURITY.md.