ADR 0001 — Nitro 3 + Bun + Vite/Vue as the foundation

Status: accepted; the front-end and build part is superseded by ADR 0017 (no Vite). Date: 2026-12-03.

Context

The plan requires proving the foundation before locking it in: Nitro 3 on Bun, a Vue pipeline, and route registration without duplicating the router.

Alternatives considered

  1. Routes in Nitro’s routes/ (filesystem routing).
  2. Nitro’s routes option (a path → handler object).
  3. Nitro’s handlers option (a list with route, method, handler), generated from the contracts.

Decision

  • defineRoute returns an h3 v2-compatible function that carries the contract in .contract. The route file is both the Nitro handler and the source of the contract.
  • fellowHandlers() discovers modules/*/routes and fills handlers. Option 2 was rejected because an object keyed by path cannot represent two methods on the same path; option 1 because routes belong to modules.
  • Frontend: Vite with @vitejs/plugin-vue and the nitro/vite plugin, bun preset. A single vite build produces .output/ with the server and assets.
  • The pipeline (executeRoute) takes a Request and returns a Response: it does not depend on Nitro, which allows testing routes without a server.

Evidence

Production build and development server verified on Bun 1.4.4 with nitro@3.0.261103-rc and Vite 8: API and SPA served by the same process.

Risks and consequences

  • nitro@3.0.0 on npm is an old release (2025-10) and fails to build with the Vite plugin. The range ^3.0.0-0 resolves to it, so the version is pinned to the tested RC.
  • The plugin’s configuration option changed between versions (nitro({ config }) in 3.0.0, top-level options in the RC).
  • Discovery happens when the configuration is loaded: new routes require restarting the dev server.

Conditions for reassessment

Stable Nitro 3 is released; SSR becomes necessary; or configuration-time discovery gets in the way of development (alternative: a Nitro module with a watcher).