Nuxt
The eve/nuxt module runs a Nuxt frontend and an eve agent as one project, with one dev server and one Vercel deploy. The auto-imported useEveAgent composable finds the mounted routes on its own, so you configure no CORS or URL env vars.
Prerequisites
- The
evepackage installed in your project (npm install eve@latest). - An existing eve agent directory. If you don't have one, start from Getting started.
- A Nuxt app to mount the agent in.
Register the module
The module looks for an agent/ folder in the Nuxt project root, mounted at /eve/v1/*. An agents/ workspace mounts each member at /eve/<name>/v1/* instead. Pass eveRoot when the agent lives elsewhere:
eve/nuxt options
All fields are optional.
| Option | Type | Default | Purpose |
|---|---|---|---|
eveRoot | string | Nuxt project root | eve project root, relative to the Nuxt project root unless absolute. |
eveBuildCommand | string | generated | Build command for the generated eve Vercel service. |
devServerTimeoutMs | number | 180000 | Maximum time to wait for the eve development server to start, including when another Nuxt process is starting it. |
For slow cold starts, increase the development timeout:
Call the composable
useEveAgent (eve/vue) is auto-imported, so a component calls it without an explicit import and without passing baseUrl:
The browser still needs a production authentication policy. See Authenticate browser requests for the default policy, which rejects unverified requests, and for channel configuration.
Dev vs deploy topology
-
Local dev.
npm run devstarts an eve dev server for each agent besidenuxt devand proxies the eve routes to it. The browser talks only to the Nuxt origin. SetEVE_BASE_URLto proxy to an eve dev server you already run instead. -
Vercel. The web app and the eve runtime deploy as a single project. On Vercel builds, the module adds an eve service per agent and routes its transport requests to it before filesystem routing. The Nuxt app serves everything else, and no
vercel.jsonis required. Whenvercel.jsondeclares services, or avercel.tscomposes them withwithEvefromeve/vercel, the module generates nothing and that configuration controls routing. By default, each generated service runs the installed eve binary from its agent root, so agent directories don't need their ownpackage.json. When the agents need their own build step, seteveBuildCommand: -
Non-Vercel hosts. The module doesn't start eve in production; run the eve service yourself.
nuxt buildwrites proxy rules that send the eve routes toEVE_NUXT_PRODUCTION_ORIGIN, or tohttp://127.0.0.1:4274when that variable is unset. WithEVE_NUXT_PRODUCTION_ORIGIN, eachagents/workspace member keeps its own path on that host (/eve/<name>/v1). Without it, each member runs as its own server serving/eve/v1, on consecutive ports from4274in alphabetical order of member name (4274,4275, ...). Override the first port withEVE_NUXT_PRODUCTION_PORT. Set these variables when you runnuxt build, because the destination is fixed in the build output:eve buildandnuxt buildboth write.output/. When the agent lives in the Nuxt project root, the two outputs overwrite each other. Build and serve eve from a separate directory instead, and seteveRootto it. See Self-host eve for running the eve service.
Managing vercel.json yourself
When vercel.json declares services, the module generates nothing, and your configuration controls routing. It must include the eve service (framework: "eve") and a rewrite that sends /eve/v1/* requests to it, or the module fails the build:
Remove experimentalServices
Vercel doesn't route the experimentalServices field in vercel.json: both services build, but every /eve/v1/* request returns NOT_FOUND. The module ignores the field and warns that vercel.json defines experimentalServices. Remove it in one of two ways:
- Generated (default). Delete
vercel.json(or itsexperimentalServicesblock) and set the project's Framework Preset to Nuxt.js. The module generates the eve service and its routing on every Vercel build. - Hand-maintained. Replace
experimentalServiceswith theservicesandrewritesshown above, and keep the "Services" Framework Preset.
What to read next
useEveAgent(Vue): the composable API- Auth & route protection
- Deployment