wealth/docs/decisions/0013-auth-pages-render-in-t...

1.5 KiB

0013 Auth pages render in the browser

Status: Accepted · Area: architecture · Date: 2026-10-05 · Decided by: user

Context

Login and registration are interactive, guest-only forms that hold the number, the code timing and the registration token in memory between steps. The user asked for every auth page to be fully client-side rendered.

Decision

  • Every page under the (auth) route group renders its steps only in the browser. The server sends the page frame (the logged-out header and, on desktop, the card) with a same-size form skeleton, and metadata with robots: { index: false }.
  • The page wraps its step in the platform's GuestGuard; the step's organism, its model and its form never render on the server. A visitor who is already signed in is sent on to ?redirect= or home.
  • The flow's state (number, code timing, registration token, the step-4 draft) lives in the in-memory auth-flow store, never in the URL, a cookie or local storage. A reload starts the flow again at its number step.

Alternatives

  • Server-render the form and hydrate it: not discussed; the form is useless before hydration and depends on the viewer being a guest.

Consequences

  • Search engines see only the frame and the skeleton, so auth pages are not indexed.
  • The step's JavaScript is part of the route's first load; keep auth organisms light.
  • The registration token sits in JavaScript memory, because the API returns it in the body. It never reaches storage; an HttpOnly cookie would need a back-end change.