Installation
Add the package to a Nuxt app with one command, then start it once. nuxt-backend is one Nuxt module: it goes in modules, never in extends (Principles). For a new app, create it from the starter instead: the module is installed and the files are written.
Before you start
- Nuxt 4.7.0 or later, not Nuxt 5 yet: the server code is written against
nuxt/server, a 4.6 API, and Nuxt 4.6 no longer builds with Vite 8.4 (Roadmap). - Node 24.11 or later, the package's
enginesfloor. - No Convex account: the first run can create a local deployment, and Run the dev loop says how to move to a cloud one. The Service map lists the accounts each later step asks for.
Install
Paste this prompt into Claude Code, Cursor, Codex or any agent that can run commands in your project:
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.
Or open it in your agent with the prompt typed in. Nothing runs until you press send.
The agent installs the package's core skill, then follows its install guide. The guide adds the package to an existing app (or creates one from the starter), starts it on a local deployment that needs no account, and checks that the app serves /login. It asks before it logs in to Convex or touches your accounts, and it never prints or replaces AUTH_SECRET. The skill stays in the project for later tasks, and the install adds the task skills of the installed version beside it.
npx nuxt module add nuxt-backend
pnpm nuxt module add nuxt-backend
yarn nuxt module add nuxt-backend
bunx nuxt module add nuxt-backend
nuxt module add installs the package, adds 'nuxt-backend' to modules, then runs the module's install step. That step:
- installs
convex, the one peer an app lists itself, sincenpx convex devrefuses to start until the app's ownpackage.jsonnames it (Nuxt bringsvue; optional peers such asaior@sentry/nuxtwait until a feature needs them); - writes the backend files into
backend/(or the functions folderconvex.jsonnames), never over a file that exists; - writes
.env.example, grouped by purpose; - points the
devscript atnuxt-backend dev; - swaps
<NuxtWelcome />for<NuxtPage />in an untouchedapp/app.vue, so the module's pages render; - writes a home page,
app/pages/index.vue, when no page answers/and the app extends no layer, which may serve/itself: the app's name and a link to sign in, or to the account once signed in; - writes an
AGENTS.mdsection, the agent skills and the onenuxt-backendentry in.mcp.jsonfor the developer MCP server, and under pnpm 12 tells pnpm not to link a second copy of the skills (Using strict pnpm); - asks the few questions it needs, such as whether to write the agent files, in the terminal.
npx nuxt-backend init runs the same setup again later, and restores a file that went missing. init lists every flag, and Project files every file it writes.
Install the two packages, then add the module:
npm install nuxt-backend convex
pnpm add nuxt-backend convex
yarn add nuxt-backend convex
bun add nuxt-backend convex
export default defineNuxtConfig({
modules: ['nuxt-backend'],
})
Then write the backend files with npx nuxt-backend init --no-agents, which never touches a file that exists. If you skip init entirely, make its two edits yourself: render <NuxtPage /> in app/app.vue instead of <NuxtWelcome />, and point the dev script at nuxt-backend dev, which Run the dev loop explains. Give the app a page at / too, if it has none: the module's pages turn on the router, and / answers 404 without one.
An app on nuxt-convex-module already: keep its entry in modules and its options. nuxt-backend installs and configures that module itself, and forces the few options it depends on (nuxt-backend and nuxt-convex-module). Your convex/ folder stays where it is: the files go there beside yours, and an existing convex.config.ts, http.ts, schema.ts or auth.config.ts is kept, so merge the package's parts into them as Auth setup shows.
Start it
npm run dev
pnpm dev
yarn dev
bun run dev
The first run sets up a dev deployment when none is configured: log in to Convex when it asks, or pick Start without an account for a local one. npx nuxt-backend dev --anonymous picks the local one without asking, on every OS. It writes CONVEX_DEPLOYMENT to .env.local, gives the deployment its AUTH_SECRET, SITE_URL and BACKEND_ENVIRONMENT, then runs Convex and Nuxt in this terminal. Nothing goes in .env by hand: the backend's URL derives from the deployment's name.
Check it works
Open /login and sign in: with no email provider connected, the code prints in the terminal. npx nuxt-backend doctor checks the project and the deployment and names whatever is missing (Diagnose your setup).
Using strict pnpm
A flat node_modules (npm, Yarn, or pnpm with nodeLinker: hoisted) exposes the bundled Convex components to Convex's bundler. pnpm's default isolated layout hides them, so let them reach the project root from pnpm-workspace.yaml (pnpm 11 and later read their settings there, not from .npmrc):
publicHoistPattern:
- '@convex-dev/*'
Without it, the first convex dev push fails to resolve the component definitions. The Nuxt side needs nothing: the module installs nuxt-convex-module and nuxt-security from its own dependencies. Apps made from the templates carry this setting in a .pnpmfile.mjs.
pnpm 11 and later hold back a version published less than a day ago (minimumReleaseAge). An install takes an older version that fits the range, and the new one only when nothing older fits. A project that sets minimumReleaseAge itself fails the install in that case. pnpm also stops an install until each dependency build script is approved or denied (pnpm approve-builds, or pnpm approve on pnpm 12). esbuild comes in through Nuxt and works without its script, so denying it is safe. Both are pnpm's own supply-chain defaults.
pnpm 12 links the agent skills a dependency ships once you approve them, and lists nuxt-backend under "Agent skills awaiting approval" until then. init already installs those skills in .agents/skills and keeps them on the version you have installed, so a second copy would show your agent each skill twice. Under pnpm 12.11 or later, init denies that copy itself: it adds skills: false for nuxt-backend under permissions in pnpm-workspace.yaml, the entry pnpm approve '!nuxt-backend' records, creating the file when the project has none and keeping every other key and comment. A skills entry nuxt-backend has there already stays as it is, an approval included: set it to false yourself to deny the copy. pnpm 11 doesn't read permissions and warns about the key on every install, so under pnpm 11 init leaves the file alone. After a move to pnpm 12, npx nuxt-backend init --agents adds the entry, or pnpm approve '!nuxt-backend' records it.
If it fails
| Symptom | Fix |
|---|---|
convex dev can't resolve @convex-dev/…/convex.config | Hoist the components: Using strict pnpm. |
npx convex dev says to add convex to your dependencies | Install convex in the app itself (Troubleshooting). |
/login shows the Nuxt welcome page | Render <NuxtPage /> in app/app.vue (Troubleshooting). |
/ answers 404, and the dev log says No match found for location with path "/" | The app has no page at /: run npx nuxt-backend init, which writes one unless the app extends a layer, or add app/pages/index.vue yourself (Troubleshooting). |
npm run dev stops at "Preparing Convex functions" | The dev script is convex dev --start "nuxt dev": run npx nuxt-backend doctor --fix (Troubleshooting). |
nuxt module add wrote no backend/ folder | The install step runs only in an interactive terminal. Run npx nuxt-backend init. |
Related
- Quickstart: from here to a signed-in app and credits spent.
- Build a creative app: the tutorial, from here to an app in production.
- Environment variables: every name, what sets it and what its absence does.
- Upgrade: moving to a new release with
npx nuxt-backend upgrade.
Quickstart
A signed-in app in about three minutes with no account anywhere, then credits bought on Polar's sandbox and spent by a metered action in about five more.
What you got
The inventory after the first run, on one page, from the backend files and which of them are yours to the pages, routes, composables and components, the env it set and the maintenance now running.