Skip to content

0014: Run MIDOT as a Start SPA with a Node server route

Direct Michigan React components in the browser and a same-origin server data boundary

  • Status: Accepted
  • Date: 2026-10-06
  • Decision maker: Trevor Gerhardt

Context

MIDOT needs Michigan Digital Guidelines components and a private property value read. The Next.js integration required a local component wrapper and a vendored runtime. A reviewed Vite prototype showed that the upstream React components work with the workspace's React 19 installation. T4 defines the migration. Both existing pages and their data and accessibility behavior remain required.

Decision

MIDOT uses TanStack Start in SPA mode with file-based TanStack Router routes. The property value route owns a typed, uncached loader over the existing HTTP contract. It imports the upstream Michigan React package directly and serves assets from the matching core package. The MIDOT guide owns setup, component compatibility, and validation instructions.

Start server routes serve the existing property value API in the same Vercel project. They send each request to the handler for the MidotApi declaration. Nitro owns the combined client/server build and the Node and Vercel deployment outputs. The local development and production preview servers use the same handler. Rackspace configuration and the Effect runtime remain on the server. ADR 0011 continues to own Services and RSDB responsibilities.

Deployment protection controls access to the page and API until launch. Only known application routes receive the SPA shell. Unknown routes, API paths, and assets retain HTTP 404 responses.

Consequences

  • MIDOT no longer needs the local Michigan wrapper, vendor copy, or Next.js runtime.
  • Route content and metadata load in the browser. The server returns one static HTML shell.
  • Upstream component events and React compatibility require browser verification. Type checks alone do not prove parity.
  • The Node server route retains MySQL compatibility and the private, uncached HTTP contract.
  • The generated route tree is committed so standalone checks need no earlier build.
  • The Nitro preset participates in build caching. Its beta adapter requires production-output and preview verification.
  • Human preview and accessibility review remain required before production promotion.