I’m trying to deploy a Nuxt 4 full-stack app to Vercel, and while the frontend builds and loads correctly, all my backend API routes fail, and there is no response from the composables or server apis.
This project works locally using the vercel preset using nuxt build --preset vercel and nuxt dev --preset vercel and using a node server it runs perfectly on Render using node .output/server/index.mjs.
On vercel, it builds without errors and only serves the frontend part, but the composables and server apis aren't used at all. My code for reference.
I am using the vercel preset for nitro which generates two folders static and functions in .vercel/output, where static should be hosted on vercel, which is correctly done, but none of the apis in the functions folder are registered as serverless functions.
Settings tried on Vercel:
- Root directory: web
- Build command: npm run build:vercel, npm run build
- Output directory: .vercel/output, .output, .vercel (tried blank too)
- Install Command: npm install
- Development Command: npm run dev, npm run dev:vercel, (tried blank too)
package.json scripts
"scripts": {
"build": "nuxt build",
"build:vercel": "nuxt build --preset vercel",
"dev:vercel": "nuxt dev --preset vercel",
"dev": "nuxt dev --host 0.0.0.0 --port 3003",
"generate": "nuxt generate",
"preview": "nuxt preview",
"postinstall": "nuxt prepare"
},
in nuxt.config.ts, I have used
ssr: true,
nitro: {
experimental: {
websocket: true
},
preset: 'vercel'
},
and set environment variables in Vercel dashboard.
Expected behavior
Vercel should detect and serve the backend API routes (/server/api/*) through Nitro’s serverless function, just like it works on Render or local preview, and I want a serverless approach to prevent winding down fully like in render (which delays requests by a minute or so).
Environment
- Nuxt 4.1.3
- Vue 3.5.22
- Node v24
- Vercel
- SSR enabled
- Works fine on Render
Question
Why does my Nuxt 4 project on Vercel deploy only the frontend with a single __fallback.func, and not register or serve any /api routes? Is there an additional configuration step required for Nitro server routes to work on Vercel?
Or is an entire Nuxt project (using composables and server apis and plugins) not deployable solely through serverless approach and needs a dedicated node server, which would mean my only solution is using Render?