Deployment
Agent-native apps use Nitro under the hood, which means you can deploy to any platform with zero config changes — just set a preset.
How It Works
When you run agent-native build, Nitro builds both the client SPA and the server API into .output/:
.output/
public/ # Built SPA (static assets)
server/
index.mjs # Server entry point
chunks/ # Server code chunksThe output is self-contained — copy .output/ to any environment and run it.
Setting the Preset
By default, Nitro builds for Node.js. To target a different platform, set the preset in your vite.config.ts:
import { defineConfig } from "@agent-native/core/vite";
export default defineConfig({
nitro: {
preset: "vercel",
},
});Or use the NITRO_PRESET environment variable at build time:
NITRO_PRESET=netlify agent-native buildNode.js (Default)
The default preset. Build and run:
agent-native build
node .output/server/index.mjsSet PORT to configure the listen port (default: 3000).
Docker
FROM node:20-slim AS build
WORKDIR /app
COPY package.json pnpm-lock.yaml ./
RUN corepack enable && pnpm install --frozen-lockfile
COPY . .
RUN pnpm build
FROM node:20-slim
WORKDIR /app
COPY --from=build /app/.output .output
COPY --from=build /app/data data
ENV PORT=3000
EXPOSE 3000
CMD ["node", ".output/server/index.mjs"]Vercel
// vite.config.ts
export default defineConfig({
nitro: { preset: "vercel" },
});Deploy via the Vercel CLI or git push:
vercel deployNetlify
// vite.config.ts
export default defineConfig({
nitro: { preset: "netlify" },
});Deploy via the Netlify CLI or git push:
netlify deploy --prodCloudflare Pages
// vite.config.ts
export default defineConfig({
nitro: { preset: "cloudflare_pages" },
});AWS Lambda
// vite.config.ts
export default defineConfig({
nitro: { preset: "aws_lambda" },
});Deno Deploy
// vite.config.ts
export default defineConfig({
nitro: { preset: "deno_deploy" },
});Environment Variables
| Variable | Description |
|---|---|
PORT | Server port (Node.js only) |
NITRO_PRESET | Override build preset at build time |
ACCESS_TOKEN | Enable auth gating for production mode |
ANTHROPIC_API_KEY | API key for embedded production agent |
FILE_SYNC_ENABLED | Enable file sync for multi-instance |
File Sync in Production
By default, agent-native apps store state in local files. For multi-instance deployments (e.g., serverless or load-balanced), enable file sync to keep instances in sync:
FILE_SYNC_ENABLED=trueSee File Sync for adapter configuration (Firestore, Supabase, Convex).