From 7d381758aba570f936d2e9575f6c8933c8e49f4f Mon Sep 17 00:00:00 2001 From: Amiram_se Date: Mon, 5 Oct 2026 20:06:42 +0400 Subject: [PATCH] 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 --- .../0013-auth-pages-render-in-the-browser.md | 23 +++++++++++++++++++ docs/decisions/README.md | 1 + 2 files changed, 24 insertions(+) create mode 100644 docs/decisions/0013-auth-pages-render-in-the-browser.md diff --git a/docs/decisions/0013-auth-pages-render-in-the-browser.md b/docs/decisions/0013-auth-pages-render-in-the-browser.md new file mode 100644 index 0000000..c0a7a6f --- /dev/null +++ b/docs/decisions/0013-auth-pages-render-in-the-browser.md @@ -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. diff --git a/docs/decisions/README.md b/docs/decisions/README.md index 9ff2bf0..032c155 100644 --- a/docs/decisions/README.md +++ b/docs/decisions/README.md @@ -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=`. +- 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