docs(decisions): auth pages render in the browser

Record 0013: every (auth) page renders its steps only in the browser behind
GuestGuard, the server sends the frame, a same-size skeleton and noindex,
and the flow's state stays in memory.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Amiram_se 2026-10-05 20:06:42 +04:00
parent fbb3a59677
commit 7d381758ab
2 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,23 @@
# 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.

View File

@ -9,6 +9,7 @@
- 0001 Share one platform, `platforms/market`, between `apps/bull` and `apps/bear`; tag all three `scope:market`.
- 0012 Wrap each app's `next.config` in island's `withIconSprite` and `withFontCopy`; they write `symbol-defs.svg` and the fonts into `public/` unhashed, served immutable; link the sprite as `?v=<ICON_SPRITE_VERSION>`.
- 0013 Render every `(auth)` page's steps only in the browser behind `GuestGuard`: the server sends the frame, a same-size skeleton and `noindex`; flow state stays in memory, never in the URL or storage.
## Proposed