# Deploy Nuxt on forkrail

> Zero adapter setup: Nitro detects `VERCEL=1` at build time and emits its native Vercel preset, powering SSR, `routeRules` ISR/SWR, Nuxt Image, and static `/_nuxt/` delivery.

- Framework: Nuxt
- Category: Websites & full-stack
- Status: Production ready
- Adapter / Preset: Nitro built-in vercel preset (automatic)
- Runtime: Node.js 24 (arm64)
- Detection: package.json (nuxt)
- Memory: 1,024 MB recommended for SSR
- URL: https://www.forkrail.com/frameworks/nuxt

## Capabilities

| Capability | Support | Details |
| --- | --- | --- |
| SSR & Nitro routes | Supported | Zero-config Nitro vercel preset with routeRules |
| ISR & SWR caching | Supported | routeRules isr / swr cached directly by the router |
| Nuxt Image | Supported | Automatic /_vercel/image optimization |
| Skew protection | Supported | Supported via Nitro vercel preset cookie |

## 1. Configure routeRules & Nuxt Image

Nuxt needs no extra adapter package on forkrail. During the build, forkrail exports `VERCEL=1`, which tells Nitro to emit `.vercel/output/` automatically. Your `routeRules` (`isr`, `swr`, `redirect`, `headers`, `proxy`) execute at the regional router before Lambda wakes.

**nuxt.config.ts**

```ts
export default defineNuxtConfig({
  modules: ['@nuxt/image'],
  routeRules: {
    '/': { prerender: true },
    '/blog/**': { isr: 300 },
    '/products/**': { swr: 60 },
    '/old-docs/**': { redirect: '/docs' },
  },
})
```

> **Do not pin NITRO_PRESET=node-server:** Leave `nitro.preset` and `NITRO_PRESET` unset so Nitro selects its `vercel` preset. If a project explicitly pins `node-server`, forkrail runs `.output/server/index.mjs` as a single server, but router-level `isr`, `routeRules`, and `/_vercel/image` will not run at the router.

## 2. Deploy & set runtime secrets

Nuxt runtime config values (`NUXT_*` and `NUXT_PUBLIC_*`) are read from your project’s KMS-encrypted environment variables.

**Add secrets and deploy**

```bash
printf 'postgres://...' | forkrail env add my-nuxt-app NUXT_DATABASE_URL --target production
forkrail project my-nuxt-app --memory 1024
forkrail deploy --prod
```

## 3. Crons & function rules

Split heavy API endpoints with `nitro.vercel.functionRules` to grant them a longer `maxDuration`. For scheduled jobs in Nuxt (Nitro 2), define `crons` in `vercel.json` pointing to a server route in `server/api/cron/` and check `Authorization: Bearer $CRON_SECRET`.

## Related documentation

- [Cron schedules](https://www.forkrail.com/docs/cron-schedules.md)
- [Image optimization](https://www.forkrail.com/docs/image-optimization.md)
- [Environment variables](https://www.forkrail.com/docs/environment-variables.md)
