pnpm build produces a plain dist/ you can deploy anywhere. When you need API routes, server-side logic, or deployment adapters, opt in to Nitro with a single config flag. Nitro wraps your built HTML — it does not replace Aero’s page compiler.
Enable Nitro only when you need it. Static sites have no server to manage or pay for.
Enable Nitro
Setserver: true in your config:
aero.config.ts
nitro.config.ts at the project root:
nitro.config.ts
File conventions
Place server files underserver/:
API handlers
Files inserver/api/ are served at /api/.... The filename determines the route and HTTP method:
server/api/submit.post.ts
[param] in the filename:
server/api/users/[id].ts
Preview commands
| Command | What runs |
|---|---|
pnpm preview | Static files only — no Nitro APIs |
pnpm preview:api | Full Nitro server from .output/ |
HTMX and Alpine.js
Aero works naturally with HTMX and Alpine.js for adding interactivity. Because Aero outputs plain HTML with no framework runtime, these libraries integrate without conflicts. Include them via<script> tags — no special configuration needed.
When to use server vs static
| Need | Approach |
|---|---|
| Marketing site, blog, docs | Static only (server: false) |
| Form submissions, auth, API calls | Enable Nitro (server: true) |
| Database access, server caching | Enable Nitro + configure storage/DB |
| HTMX partial responses | Enable Nitro + server routes |