Getting Started
Hono API Servers
Nitro API Servers
Generated Nitro exports are API-only Node.js apps. Use the scripts in the
exported package.json.
Build and start
pnpm install
pnpm typecheck
pnpm build
pnpm startpnpm start runs node .output/server/index.mjs after nitro build.
Environment variables
.env and .env.local are loaded only by nitro dev. In production, set
environment variables through your host (process env, platform secrets, etc.).
At minimum:
- pattern credentials from
.env.example(for exampleAI_GATEWAY_API_KEY) PORTβ default in the artifact is3001HOSTβ use0.0.0.0in containersCORS_ORIGINSβ comma-separated browser origins that may call the APICORS_ALLOW_CREDENTIALSβ settrueonly when cookies or credentialed fetches are required
Streaming and proxies
AI SDK UI message streams expose x-vercel-ai-ui-message-stream. The generated
CORS middleware allows that header. Disable response buffering on reverse
proxies in front of long-lived streams.
Native modules
Some patterns depend on native packages such as @resvg/resvg-js. If
pnpm build fails while pnpm dev works, add an externals entry in
nitro.config.ts for that package and rebuild.
Related
- Nitro overview
- Hono deploy notes for the parallel Hono export path
Join Today
Copy and Paste 126+
ai sdk templates.
ai sdk templates.
Get early access pricing and shape the future of the product.
Go to pricing