diff --git a/.github/workflows/kits.yml b/.github/workflows/kits.yml index 9d1d093..af9b215 100644 --- a/.github/workflows/kits.yml +++ b/.github/workflows/kits.yml @@ -24,7 +24,7 @@ jobs: outputs: kits: ${{ steps.list.outputs.kits }} steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0 # Each kit's repository comes from its kit.json, and the deploy key # for it from a secret named after the kit: @@ -67,14 +67,14 @@ jobs: DB_CONNECTION: sqlite CACHE_STORE: array steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0 - - uses: shivammathur/setup-php@v2 + - uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # 2.40.0 with: php-version: '8.5' coverage: none - - uses: actions/setup-node@v5 + - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 with: node-version: lts/* cache: npm @@ -86,8 +86,55 @@ jobs: run: node --test bin/ - run: npm run build - run: npm test + - name: TanStack Start kit + run: | + npm test -w kits/tanstack-start + npm run types:check -w kits/tanstack-start + npm run build -w kits/tanstack-start - run: composer ci:check + # The Playwright suite (tests/e2e), screenshots included, against each + # kit: the Inertia app Laravel serves, and the TanStack kit with Laravel + # headless behind its proxy. Both compare against the same screenshots, + # made in this same image (the README's "Screenshots"), so the browser, + # its fonts and its libraries render them pixel for pixel. Its version is + # the @playwright/test in package-lock.json. + browser: + name: Browser tests (${{ matrix.kit }}) + runs-on: ubuntu-latest + container: + image: mcr.microsoft.com/playwright:v1.65.0-noble + strategy: + fail-fast: false + matrix: + kit: [inertia-react, tanstack-start] + env: + E2E_KIT: ${{ matrix.kit }} + steps: + - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0 + + - uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # 2.40.0 + with: + php-version: '8.5' + coverage: none + + - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 + with: + node-version: lts/* + cache: npm + + - run: composer install --no-interaction --no-progress + - run: npm ci + # The image has the browsers already. + - run: npx playwright test + + - if: failure() + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + with: + name: browser-${{ matrix.kit }} + path: test-results/ + retention-days: 7 + kit: name: Kit (${{ matrix.kit.name }}) needs: list @@ -100,14 +147,14 @@ jobs: KIT: ${{ matrix.kit.name }} EXPORT: ${{ github.workspace }}/../starter-${{ matrix.kit.name }} steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0 - - uses: shivammathur/setup-php@v2 + - uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # 2.40.0 with: php-version: '8.5' coverage: none - - uses: actions/setup-node@v5 + - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 with: node-version: lts/* cache: npm @@ -120,14 +167,17 @@ jobs: node bin/export-kit.mjs "$KIT" "$EXPORT" tar -czf "$RUNNER_TEMP/export.tgz" -C "$EXPORT" . - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: starter-${{ matrix.kit.name }} path: ${{ runner.temp }}/export.tgz retention-days: 7 # What `laravel new --using` and `composer create-project` do, then - # the kit's own checks. + # the kit's own checks. A headless kit's frontend is its own npm + # package in frontend/, with its own lockfile: the installer's + # post-create-project hook installs it, and the root's scripts + # (build, test, check, types:check) run its. - name: Install working-directory: ${{ env.EXPORT }} run: | @@ -136,6 +186,9 @@ jobs: composer run post-root-package-install php artisan key:generate npm ci + if [ -f frontend/package.json ]; then + npm ci --prefix frontend + fi - name: Build working-directory: ${{ env.EXPORT }} @@ -149,7 +202,7 @@ jobs: release: name: Release (${{ matrix.kit.name }}) - needs: [list, monorepo, kit] + needs: [list, monorepo, browser, kit] if: >- github.event_name == 'release' && github.event.action == 'published' && @@ -194,7 +247,7 @@ jobs: fi - if: steps.target.outputs.skip == 'false' - uses: actions/download-artifact@v4 + uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 with: name: starter-${{ matrix.kit.name }} path: ${{ runner.temp }} diff --git a/.gitignore b/.gitignore index 23b02fb..b93ab36 100644 --- a/.gitignore +++ b/.gitignore @@ -44,8 +44,10 @@ yarn-error.log /boost.json /opencode.json /opencode.jsonc +# @monorepo-only:start (the browser tests') /test-results /playwright-report +# @monorepo-only:end **/caddy frankenphp diff --git a/README.md b/README.md index 1a1022f..9de4f9d 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,11 @@ Laravel starter kits with [Keyring](https://github.com/keyringphp/keyring) for sign in, passkeys, second factors, sessions and security emails. Every kit shares one Laravel backend, the app at the root of this repository, and each is also published on its own, ready for `laravel new`. -| Kit | Frontend | Install | -| ---------------- | ----------------------------------------------------------------- | ------------------------------------------------------------- | -| `inertia-react` | Inertia and React, the app in this repository (`resources/js`) | `laravel new my-app --using=keyringphp/starter-inertia-react` | -| `tanstack-start` | TanStack Start, talking to the backend headless (coming, `kits/`) | | -| `nuxt` | Nuxt, talking to the backend headless (coming, `kits/`) | | +| Kit | Frontend | Install | +| ---------------- | ----------------------------------------------------------------------- | -------------------------------------------------------------- | +| `inertia-react` | Inertia and React, the app in this repository (`resources/js`) | `laravel new my-app --using=keyringphp/starter-inertia-react` | +| `tanstack-start` | TanStack Start, talking to the backend headless (`kits/tanstack-start`) | `laravel new my-app --using=keyringphp/starter-tanstack-start` | +| `nuxt` | Nuxt, talking to the backend headless (coming, `kits/`) | | ## Installing a kit @@ -18,11 +18,11 @@ cd my-app composer dev ``` -Without the installer, `composer create-project keyringphp/starter-inertia-react my-app` followed by `npm install && npm run build` does the same. Either way the new app gets its `.env` from `.env.example`, an app key and a migrated SQLite database, like Laravel's own starter kits. +Without the installer, `composer create-project keyringphp/starter-inertia-react my-app` followed by `npm install && npm run build` does the same (for the TanStack kit, `npm install && npm ci --prefix frontend && npm run build`). Either way the new app gets its `.env` from `.env.example`, an app key and a migrated SQLite database, like Laravel's own starter kits. A kit is a clean starter, not this repository's demo: a plain welcome page and dashboard, every auth page, the settings pages (profile, security, appearance) and Keyring's emails, under the app's own name. `php artisan db:seed` adds one test user, as Laravel's kits do. The demo stays here, for keyringphp.com and the browser tests (see [The demo](#the-demo)). -`APP_URL` in `.env` has to be the address the app is opened at, because Keyring builds the passkey origin and every emailed link from it. `laravel new my-app` sets it (to `http://my-app.test` under Herd or Valet, `http://localhost:8000` otherwise), and `composer create-project` sets `http://localhost:8000`, where `composer dev` serves. `laravel new .` leaves it at `http://localhost`, so set it yourself after that, or whenever you serve the app somewhere else. +`APP_URL` in `.env` has to be the address the app is opened at, because Keyring builds the passkey origin and every emailed link from it. For the Inertia kit, `laravel new my-app` sets it (to `http://my-app.test` under Herd or Valet, `http://localhost:8000` otherwise), and `composer create-project` sets `http://localhost:8000`, where `composer dev` serves. `laravel new .` leaves it at `http://localhost`, so set it yourself after that, or whenever you serve the app somewhere else. The TanStack kit's is the frontend's address, `http://localhost:3000`, where its `composer dev` serves. Each kit's repository (`keyringphp/starter-`) is read-only and built from this one on every release, so issues and pull requests come here. @@ -31,14 +31,16 @@ Each kit's repository (`keyringphp/starter-`) is read-only and built from t ``` app/, config/, routes/... # the Laravel backend every kit shares app/Demo/, routes/demo.php # the demo, which no kit gets (see "The demo") -resources/js/ # inertia-react's frontend: pages, layouts, Keyring's components +resources/js/ # inertia-react's frontend: its pages, and what only Inertia needs resources/css/app.css # inertia-react's stylesheet: the theme, then its @source lines packages/ ├── theme/ # @keyringjs/theme: Tailwind v4, the palette, shadcn tokens, dark mode, fonts -└── ui-react/ # @keyringjs/ui-react: the shadcn/ui primitives, cn() and useIsMobile() +└── ui-react/ # @keyringjs/ui-react: the shadcn/ui primitives, and the app components, + # layouts and Keyring's settings components both React kits share kits/ ├── inertia-react/ # kit.json (how to export it) and the README its repository gets -└── / # a headless kit: kit.json and its frontend app (coming) +├── tanstack-start/ # the TanStack Start frontend, headless: kit.json, its README and the app +└── / # a headless kit: kit.json and its frontend app bin/export-kit.mjs # builds one kit as a standalone Laravel app .github/workflows/kits.yml # checks the monorepo and every kit, and publishes them on release ``` @@ -52,33 +54,43 @@ The JavaScript side is one npm workspace (`packages/*` and `kits/*`), with one ` @source '../views'; ``` -It brings Tailwind and `tw-animate-css` with it. Dark mode follows a `dark` class on ``, and the font stack starts with Inter, which this app loads through `laravel-vite-plugin`'s Bunny fonts. A kit without that imports `@keyringjs/theme/fonts.css` first. +It brings Tailwind and `tw-animate-css` with it. Dark mode follows a `dark` class on ``, and the font stack starts with Inter, whose files come with the theme (`fonts/`, under the SIL Open Font License): every kit imports `@keyringjs/theme/fonts.css` first, so none of them asks another site for a font. -`@keyringjs/ui-react` has no router or Inertia imports, so any React kit can use it. Its files are imported one at a time, like shadcn's: +`@keyringjs/ui-react` is what both React kits share, written once so they look and work the same. Its files are imported one at a time, like shadcn's: ```tsx import { Button } from '@keyringjs/ui-react/button'; import { useIsMobile } from '@keyringjs/ui-react/hooks/use-mobile'; import { cn } from '@keyringjs/ui-react/utils'; +import InputError from '@keyringjs/ui-react/components/input-error'; +import AppLayout from '@keyringjs/ui-react/layouts/app-layout'; +import SignInMethods from '@keyringjs/ui-react/components/keyring/sign-in-methods'; ``` -Two things stay in the app because they need Inertia: the toaster (`resources/js/components/ui/sonner.tsx`, which shows Inertia's flashed toasts) and `toUrl()` (`resources/js/lib/url.ts`, which reads Inertia's link types). So do Keyring's own components, pages and layouts, until the TanStack kit gives them a router-free shape. `components.json` (and the `paths` in `tsconfig.json`) point shadcn's CLI at the package, so `npx shadcn add ` writes new primitives to `packages/ui-react/src/components/ui`. An exported kit gets the usual `components.json` back, pointing at its own `resources/js/components/ui`. +It has the primitives; the app's components (`app-shell`, `app-sidebar`, `nav-main`, `nav-footer`, `nav-user`, `user-menu-content`, `breadcrumbs`, `text-link`, `appearance-tabs`, `app-logo`, the inputs, the status note and the rest, under `components/`); the layouts (`layouts/app-layout`, `layouts/auth-layout`, the auth and settings layouts); Keyring's settings components (`components/keyring/`: sign-in methods, change password, recovery codes, devices, sessions, activity) and `keyring/actions` (`run()`, which shows Keyring's message or error and handles a `423`); the hooks (`use-appearance`, `use-clipboard`, `use-current-url`, `use-initials`, `use-mobile-navigation`); `keyring/factors` (the challenge's factor components, written against what Keyring's Inertia and headless hooks have in common) and `keyring/format` (`ago()`, places, factor names and the "was this you?" alerts' wording). + +The ones that link, post or read the page's props do it through `@keyringjs/ui-react/adapter`: `Link`, `Form`, `usePage()`, `router` and the `InertiaLinkProps` type, the part of Inertia's React API they use, which each app provides once with ``. The Inertia app passes Inertia's own (`resources/js/lib/adapter.tsx`, from `resources/js/app.tsx`), and the TanStack kit its router's and Keyring's headless forms (see [its README](kits/tanstack-start/README.md#shared-components)). They also link with Wayfinder-shaped routes from `@keyringjs/ui-react/routes` (`dashboard()`, `edit()`...) and use the types in `@keyringjs/ui-react/types`, and import Keyring's helpers from `@keyringjs/keyring/react`, which the TanStack kit points at its headless entry. + +An exported kit gets the package back in its own source, with the imports rewritten. The Inertia kit's export gets the files where they were before they were shared (`resources/js/components`, `layouts`, `hooks` and `keyring`), and imports the adapter from `@inertiajs/react`, the routes from Wayfinder's `@/routes` and the types from `@/types`, so it has no adapter and reads as if the files had never moved. The TanStack kit's gets them in `frontend/src`. + +What stays in the Inertia app: the pages, `pages.test.tsx`, the toaster (`resources/js/components/ui/sonner.tsx`, which shows Inertia's flashed toasts), `toUrl()` (`resources/js/lib/url.ts`), the header layout and its header, and the delete-account card. `components.json` (and the `paths` in `tsconfig.json`) point shadcn's CLI at the package, so `npx shadcn add ` writes new primitives to `packages/ui-react/src/components/ui`. An exported kit gets the usual `components.json` back, pointing at its own `resources/js/components/ui`. ## The demo The app here is also the demo keyringphp.com runs and the browser tests drive: a welcome page with two seeded accounts (one with an authenticator app, shown as a QR code), a dashboard of things to try, the login page's location picker (`KEYRING_LOCATOR=demo`), signed links into each state of the app (`php artisan example:links`), and an email gallery at `/emails`. None of it reaches an exported kit, and nothing in the app is kept twice, once with the demo and once without. Instead the demo lives in its own places, which the kit's manifest excludes: -| Where | What | -| ------------------------ | --------------------------------------------------------------------------------------------------------------------- | -| `app/Demo/` | `DemoServiceProvider`, the props it adds to pages (`DemoProps`), its locator, controllers, commands and email gallery | -| `routes/demo.php` | the location picker's route, and the local-only links and email gallery | -| `database/seeders/Demo/` | the two demo accounts and their month of history, seeded in place of `DatabaseSeeder`'s test user | -| `resources/js/demo/` | the demo's welcome page and dashboard, the login page's extras, and the header and sidebar links to this repository | -| `resources/views/demo/` | the email gallery | -| `tests/Feature/Demo/` | the demo's tests | -| `resources/emails/` | the Maizzle sources of the emails, which kits get built (see [Emails](#emails)) | +| Where | What | +| ----------------------------- | --------------------------------------------------------------------------------------------------------------------- | +| `app/Demo/` | `DemoServiceProvider`, the props it adds to pages (`DemoProps`), its locator, controllers, commands and email gallery | +| `routes/demo.php` | the location picker's route, and the local-only links and email gallery | +| `database/seeders/Demo/` | the two demo accounts and their month of history, seeded in place of `DatabaseSeeder`'s test user | +| `resources/js/demo/` | the demo's welcome page and dashboard, and the login page's extras | +| `packages/ui-react/src/demo/` | the header and sidebar links to this repository, which the shared sidebar imports | +| `resources/views/demo/` | the email gallery | +| `tests/Feature/Demo/` | the demo's tests | +| `resources/emails/` | the Maizzle sources of the emails, which kits get built (see [Emails](#emails)) | -The app reaches the demo only through lines tagged `@monorepo-only`, which the export strips: the provider in `bootstrap/providers.php`, `require __DIR__.'/demo.php'` in `routes/web.php`, the `demoAccounts`, `demoSettings` and `demoLocation` props in `WelcomeController`, `DashboardController` and `HandleInertiaRequests`, the `demo` locator in `config/keyring.php` and `.env.example`, the emailed codes `KeyringServiceProvider` registers for it, the demo's extras on the login page and in the header and sidebar, and the page resolver in `resources/js/app.tsx`. That resolver, `resources/js/demo/pages.ts`, takes a page in `resources/js/demo/pages` over the one of the same name in `resources/js/pages`. The demo's welcome page and dashboard render the plain ones with their own content inside (as `children`), and get the plain page's `layout` when they don't set one, so the header, the alerts and the layout are written once. `resources/js/pages.test.tsx` renders the plain ones, as a kit has them. +The browser tests build the app without the demo's pages, login extras and links (`VITE_DEMO=false`), so both kits show the same pages there. The app reaches the demo only through lines tagged `@monorepo-only`, which the export strips: the provider in `bootstrap/providers.php`, `require __DIR__.'/demo.php'` in `routes/web.php`, the `demoAccounts`, `demoSettings` and `demoLocation` props in `WelcomeController`, `DashboardController` and `HandleInertiaRequests`, the `demo` locator in `config/keyring.php` and `.env.example`, the emailed codes `KeyringServiceProvider` registers for it, the demo's extras on the login page and in the header and sidebar, and the page resolver in `resources/js/app.tsx`. That resolver, `resources/js/demo/pages.ts`, takes a page in `resources/js/demo/pages` over the one of the same name in `resources/js/pages`. The demo's welcome page and dashboard render the plain ones with their own content inside (as `children`), and get the plain page's `layout` when they don't set one, so the header, the alerts and the layout are written once. `resources/js/pages.test.tsx` renders the plain ones, as a kit has them. The manifest's `forbid` list then names `demo` and `Demo`, and the demo's classes, paths, routes and props, and the export stops if any exported file still has one in its text or its path. A new reference to the demo from shared code has to be tagged, or the export fails. @@ -112,70 +124,47 @@ node --test bin/ # the export script's own tests node bin/export-kit.mjs inertia-react /tmp/starter-inertia-react node bin/export-kit.mjs inertia-react /tmp/starter-inertia-react --force # empty it first node bin/export-kit.mjs inertia-react /tmp/starter-inertia-react --skip-lock # leave the lockfiles as copied +node bin/export-kit.mjs tanstack-start /tmp/starter-tanstack-start +node bin/export-kit.mjs tanstack-start /tmp/starter-tanstack-start --allow-dirty # with uncommitted changes ``` -The output is what the kit's repository gets: a complete Laravel app with no workspace in it. Run `composer install`, `npm ci`, `npm run build`, `npm test` and `composer ci:check` there to try it. The script needs git, npm and composer, and the monorepo's `node_modules` (for the formatter). It: +It refuses to run while a tracked file has changes that aren't committed, staged or not: it copies the working tree, so a Keyring checkout linked for local work (see [Working on Keyring Itself](#working-on-keyring-itself)), a path repository in `composer.json` and a `file:` dependency in `package.json`, would ship with the export. Export a clean worktree (`git worktree add /tmp/kit HEAD`), or pass `--allow-dirty` to take the working tree as it is. -1. Copies every file git tracks, as it is in the working tree (so uncommitted changes to tracked files come along, but untracked files never do), except `kits/`, `packages/`, `bin/`, `.github/` and the kit's `exclude` list. Symlinks stay symlinks. -2. Inlines the workspace packages the kit uses: copies their files into the app, rewrites imports of them (`@keyringjs/ui-react/button` becomes `@/components/ui/button` again), and adds their dependencies to `package.json`. +The output is what the kit's repository gets: a complete Laravel app with no workspace in it. Run `composer install`, `npm ci` (and for a headless kit `npm ci --prefix frontend`), `npm run build`, `npm test` and `composer ci:check` there to try it. The script needs git, npm and composer, and the monorepo's `node_modules` (for the formatter). It: + +1. Copies every file git tracks, as it is in the working tree (clean, unless `--allow-dirty`; untracked files never come along), except `kits/`, `packages/`, `bin/`, `.github/` and the kit's `exclude` list. Symlinks stay symlinks. +2. Inlines the workspace packages the kit uses: copies their files (minus the entry's `exclude`) into the app, rewrites imports of them (`@keyringjs/ui-react/button` becomes `@/components/ui/button` again), and adds their dependencies to the `package.json` of the app they're inlined into. 3. Copies the kit's own files over the result. -4. Leaves out text tagged monorepo-only: a line whose comment (`//`, `#`, `/*`, ` + +The TanStack Start kit in `kits/tanstack-start` is the first of them. `npm run dev:tanstack` runs it with this backend in headless mode, on `http://localhost:3765`: see [its README](kits/tanstack-start/README.md). + + + ## What changed from Laravel's starter kit The app started as Laravel's React starter kit, with Fortify taken out and Keyring put in: @@ -383,10 +378,10 @@ The app started as Laravel's React starter kit, with Fortify taken out and Keyri - New pages: `auth/challenge` (second step and step-up), and the pages emailed links open, each with one button that posts the link's token or signature in the body: `auth/email-change`, `auth/device-report` and `auth/email-verification`. Login gained passkey sign-in, and shows Keyring's message for whatever sent you there. - A key for a logo, and a sidebar link to Keyring's docs. - A welcome page about the demo instead of Laravel's, a dashboard of things to try, sidebar links to this repository, and emailed codes turned on, to show what they are. -- Settings → Security lists sign-in methods (the password form opens from the password's row), where you're signed in (devices and sessions, with one "Sign out everywhere else"), and recent activity. It talks to Keyring's JSON routes through `@keyringjs/keyring` (`resources/js/keyring/actions.ts` handles the 423 step-up answer and shows Keyring's own messages). +- Settings → Security lists sign-in methods (the password form opens from the password's row), where you're signed in (devices and sessions, with one "Sign out everywhere else"), and recent activity. It talks to Keyring's JSON routes through `@keyringjs/keyring`, with `run()` from the shared `keyring/actions.ts` (`resources/js/keyring/actions.ts` in the Inertia kit) handling the 423 step-up answer and showing Keyring's own messages. - `HandleInertiaRequests` shares the flashed `status` and its message from `Keyring::statusMessage()`. - Settings → Profile changes the name directly and the email through Keyring's confirmed flow. -- Laravel's Fortify tests were rewritten against Keyring (`php artisan test`), and `npm test` renders the welcome page and the dashboard. +- Laravel's Fortify tests were rewritten against Keyring (`php artisan test`), and `npm test` runs the frontend's own tests (the Inertia kit's render the welcome page and the dashboard). ## OWASP ASVS @@ -419,14 +414,30 @@ Two things in the demo aren't for a real app: it registers emailed codes, to sho ## Browser tests -`tests/e2e` drives the real pages in Chromium with Playwright, including passkeys and security keys through Chrome's virtual authenticator: +`tests/e2e` drives the real pages in Chromium with Playwright, including passkeys and security keys through Chrome's virtual authenticator. The same specs run against each React kit, picked with `E2E_KIT`: ```bash npx playwright install chromium # once -npm run test:browser +npm run test:browser # the Inertia kit (E2E_KIT=inertia-react) +npm run test:browser:tanstack # the TanStack kit (E2E_KIT=tanstack-start) +``` + +They build the assets and serve the app with a throwaway SQLite database (`database/e2e.sqlite`) and their own `.env.e2e` (`tests/e2e/serve.sh`): the Inertia kit on `http://localhost:8137`, or the TanStack kit's production server on `http://localhost:3765` with Laravel headless behind it on `127.0.0.1:8765`. Mail is written to `storage/logs/laravel.log`, where the tests read the links and codes it carries. Before starting, they check that the booted app really uses that database, so your dev database and server are left alone. Run one kit at a time: both use the same database. Each kit is its own Playwright project, named after it. + +The specs don't know which kit they drive: the paths, labels and words are the same. Two things really differ, and `tests/e2e/helpers.ts` says so once each: a page that needs a session sends a guest to `/login?redirect=...` in the TanStack kit, where Laravel keeps the page in the session (`sentToLogin`), and the TanStack kit's requests to Laravel go through `/backend` (`laravelPath()`). + +### Screenshots + +`tests/e2e/screenshots.spec.ts` shoots every page (the guest pages, the second step and step-up, the dashboard and the settings pages, a held user's security page, and the pages emailed links open), in light and dark, at a desktop's and a phone's width. Both kits compare against the same screenshots, in `tests/e2e/screenshots`, made from the Inertia kit, so a page that drifts from the other kit's fails. They're made with the browser in Playwright's Docker image (`mcr.microsoft.com/playwright:v-noble`), the one CI's browser job runs in, so they match to the pixel: no more than 50 pixels of a page may differ, which one missing control or changed word is far over. Only times and IP addresses are masked, each on its own (`components/keyring/details.tsx` puts them in a `