Deployment
Deploy your Avalon site to any platform using Nitro presets.
Build
Run the production build:
bun run build
This outputs a Nitro server bundle to .output/. The exact format depends on your preset.
Presets
Avalon uses Nitro for the server. Set the preset in your vite.config.ts:
const plugins = await avalon({
nitro: {
preset: 'node_server', // default
},
});
Node.js
preset: 'node_server'
Start the server:
node .output/server/index.mjs
Bun
preset: 'bun'
bun .output/server/index.mjs
Cloudflare Workers
preset: 'cloudflare_module'
Deploy with Wrangler:
bunx wrangler deploy
Vercel
preset: 'vercel'
Vercel auto-detects the output format. Just push to your connected repo.
Netlify
preset: 'netlify'
Static
For fully static sites with no server-side logic:
preset: 'static'
This generates a dist/ directory of static HTML files.
Environment variables
Set runtime config in vite.config.ts:
nitro: {
runtimeConfig: {
apiSecret: process.env.API_SECRET,
public: {
apiBase: process.env.PUBLIC_API_BASE,
},
},
}
Access in server code:
import { useRuntimeConfig } from 'nitro/runtime';
const config = useRuntimeConfig();
Static assets
Assets in public/ are copied to the output directory and served with long-lived cache headers when you configure route rules:
nitro: {
routeRules: {
'/assets/**': {
headers: { 'Cache-Control': 'public, max-age=31536000, immutable' },
},
},
}