# Working on the pages This adds to the root `AGENTS.md` for work in `web/`. - `web/` is the OAuth authorization pages: sign in, the email code, choosing an account, consent, the passkey page, and the error page. It is one Svelte 5 app (runes, TypeScript), built by Vite, with no SvelteKit and no router. `spec/OAUTH-PAGES.md` says what the pages show and what each control calls; `spec/OAUTH.md` and `spec/PASSKEYS.md` say what the server puts in each page (`__authorizeData`, `__sessions`, `__passkeyOptions`, `__passkeyData`, `__errorData`) and what the API takes and answers. The app reads those statements from `window`. It calls only the API, and the browser's WebAuthn for passkeys (`webauthn.ts`), and the server makes everything else. - `npm ci` once, then `npm run build`. The build writes `web/dist`, and `pds-server` embeds it when it is compiled (`just build` does both). `npm run check` is svelte-check with warnings as errors. - `src/email/email.html` is the HTML part of the server's emails (`spec/EMAIL.md`, "The message"): one table-laid template, every style on its element, nothing loaded, as mail clients read little more. Its colours, sizes and spaces are tokens too, `var(--x)` (light) and `dark(--x)`, which the build (`vite.config.ts`) writes in as values, to `web/dist/email.html`. The server fills its `{{…}}` slots. Draw it with `just look email `. - The app is built from `spec/` alone, as `crates/` is (root `AGENTS.md`). Read no source of the reference's pages (`@atproto/oauth-provider-ui` and the rest under `harness/node_modules`). `harness/checks/pages.mjs` may be read, to see what is checked. - Before changing a page, load the `ui` skill (`.claude/skills/ui`). It has the house rules (sentence case, space, one primary button) and `just look`, which draws any view, in any state, as pictures to open. Look at every state you touch before pushing. - The components in `web/src/lib` are layered in atomic design's way: - `atoms`: one element, such as an icon, an avatar, a button or a field; - `molecules`: a few atoms that mean something together, such as an account (avatar, name, handle) or a labelled field with its error; - `organisms`: a part of a view, such as the sign-in form, the list of accounts, or the list of what a scope asks for; - `templates`: a view's layout without its data, such as the card with the server's host, a heading, a body and a row of actions. A component uses its own layer and those below it, never one above. The views in `web/src/views` (`SignIn`, `EmailCode`, `ChooseAccount`, `Consent`, `AddPasskey`, `PasskeyAdded`, `ErrorPage`) fill a template with the page's data and the API's answers. `App.svelte` picks the view. Nothing in `lib` imports a view. `harness/layers.mjs` checks this, among the code gates. - What is not a component goes in `web/src/lib` beside the layers, as plain TypeScript with no markup: the API client (`api.ts`: headers, CSRF, errors as values), the page's data and its types (`data.ts`), the words for each scope (`scopes.ts`), and the alerts' texts (`words.ts`). Keep the words of `spec/OAUTH-PAGES.md` in one place, so a change of words is one change. - Styles: each component's own `