Melodee Auth UI
0bf9bd04697609fc3d8b82eb933b1d1d29e84059. Version 2026.11.0-rc.0. License MIT. Status: A0–A10 implemented and verified on a disposable real API 1.0.0 stack; not published, tagged or deployed. This is the component's committed documentation, not proof of a distribution release or production qualification.
Browser sign-in, explicit consent, account security and recovery for Melodee.
This repository is a separately built static application served on the same
origin as melodee-api; it is not an identity server and holds no identity
database.
Status: A0–A10 implemented and verified on a disposable real API 1.0.0 stack.
The device grant, passkeys, Google (controlled provider), account contacts,
sessions, automation credentials, compatibility credentials, recovery and
installation bootstrap have automated real-browser evidence. Publication,
production deployment, live Google, physical/synchronized authenticators and
independent security approval remain external. The application version is CalVer
2026.11.0-rc.0; it is not published, tagged or deployed. See the
master completion audit,
status and acceptance register.
What it does
| Route | Purpose |
|---|---|
/auth/login | Capability-driven sign-in: magic link, discoverable passkey, Google, recovery and pending-installation bootstrap. |
/auth/magic-links/confirm | Explicitly confirm an emailed sign-in link. Opening the page never consumes it. |
/auth/recovery | Request a neutral account-recovery link. |
/auth/recovery/confirm | Explicitly confirm recovery, with session-invalidation warning. |
/auth/contacts/verify | Explicitly verify an enrolled email address. |
/auth/bootstrap | Consume the operator-issued one-time installation challenge. Never open registration. |
/auth/device | Look up a device request, review the immutable account/client/scope/expiry snapshot, consent, approve or deny. |
/auth/account | Account overview: sign-in methods, sessions, automation and compatibility links. |
/auth/account/contacts | Verified email inventory, enrollment and verification resend. |
/auth/account/identities | Linked Google identities, explicit linking and unlinking. |
/auth/account/passkeys | Discoverable sign-in, enrollment, labels, metadata, step-up and revocation. |
/auth/account/sessions | Current/other sessions, revoke one or sign out other sessions. |
/auth/account/automation | Scoped automation credentials with one-time secret reveal and revocation. |
/auth/account/compatibility | OpenSubsonic and Jellyfin per-device credentials, one-time secret reveal and revocation. |
Unknown routes show a deliberate not-found page. Authentication is an API-owned HttpOnly cookie. The UI never stores a session bearer, refresh credential, magic-link secret, one-time secret or device code in local/session storage, IndexedDB, a URL or a log.
Architecture
Browser ── HTTPS, same origin ── nginx ─┬─ static Auth UI (this repository)
├─ /api/v1/* → melodee-api
├─ /rest, /System, /Users, /Items, … → compatibility adapters
└─ /healthz
Native client ── device grant/polling ──── melodee-api
└─ PostgreSQL + SMTP + protected-object storage
The API owns accounts, credentials, sessions, cookies, CSRF/origin enforcement, grants, scopes, capabilities, recovery and audit. The UI displays validated server responses and requests deliberate user actions. It does not create grants, verify tokens, implement cryptography or duplicate authorization logic. The production container serves static files on nginx; no Node.js runtime is required and no API base URL is compiled into the bundle.
Development
Prerequisites: Node 22.23.1, npm 10.9.8, and a running Melodee API 1.0.0 for
live flows. The committed lockfile is deterministic:
npm ci
npm run dev
Vite serves http://localhost:5173 and proxies /api and /healthz to
http://127.0.0.1:8080 by default. Set VITE_API_PROXY for another local API.
The API's MELODEE_PUBLIC_BASE_URL must equal the browser origin for same-origin
cookies and CSRF.
The ordinary gate needs no network, database or provider:
npm run gate
It runs Prettier check, ESLint, strict TypeScript, OpenAPI contract drift, CalVer
and release-metadata checks, secret/privacy scanning, an offline production
license review, deterministic dependency checks, the Vitest suite and a
production build. CI runs the same command after npm ci.
The gate is not real-browser qualification. Run the separate disposable stack:
bash tests/integration/run.sh
It builds API v1.0.0 from its exact annotated tag with git archive, provisions
a fresh database through the API's own operator bootstrap command, adds two marked
test accounts, starts Mailpit, a controlled OpenID Connect fixture and the API
with WebAuthn and writable protected storage, builds and serves the UI behind an
HTTPS nginx front door with a disposable test CA, and runs Chromium. It covers the
device grant with a deterministic native client (the CLI pin predates 1.0.0),
passkeys with a virtual authenticator, Google linking/sign-in with a controlled
provider, contacts, sessions, automation, compatibility, recovery, bootstrap,
accessibility, headers, route precedence and log/browser-storage hygiene.
See tests/integration/README.md.
Contract
The authoritative OpenAPI artifact is vendored byte-for-byte at
contracts/openapi/v1/openapi.json from API
tag v1.0.0 / commit f77dba9e…, contract 1.0.0, SHA-256 98abbf13…. The
generated bindings are in src/api/schema.d.ts. npm run contract:check verifies
the digest, surface, required operations/schemas and generated output. The
application declares support for API >=1.0.0 <2.0.0 separately from its CalVer
version in release-metadata.json.
Observed upstream gaps are recorded in contracts/API-BASELINE.md, including undocumented account DTOs, Google browser-linking return limitations and the CLI's development-era contract pin. No route or field is invented in this repository.
Security model
- Same-origin only. No cross-origin credentialed fallback and no runtime API base URL in the browser bundle.
- HttpOnly, Secure, SameSite=Lax session cookie on HTTPS; the readable CSRF
cookie is sent as
X-CSRF-Tokenon mutations. The API also requires a matching Origin. The UI never reads or persists the session bearer. - A stale browser session is refreshed once via the cookie-only API endpoint,
single-flight across tabs through the Web Locks API. A
401after refresh is re-authentication, not a retry loop. - Recent-authentication
403 reauthentication_requiredopens an explicit step-up dialog: a genuine passkey assertion when available, or an email re-authentication redirect. No action is approved automatically. - Magic-link, recovery and contact-verification tokens are read once into memory, removed from the visible URL, and consumed only by an explicit button action. Prefetch, reload without the token and replay are covered by tests.
- Passkeys use the native WebAuthn API and server-issued ceremonies, with only base64url conversion in the browser. No signature verification, credential storage or protected-object handling lives in the UI. The API owns recent-auth and last-usable-path checks. Biometric data never reaches Melodee.
- Device consent is bound to an immutable reviewed snapshot. Editing the code, relooking up, expiry, a stale response or an account/session change invalidates the review and resets consent. Approval is blocked for unknown scopes; denial needs no consent.
- Automation and compatibility secrets are held only in the reveal dialog's component state, cleared when it closes, and never placed in storage, a URL or telemetry. Compatibility credentials are explicitly described as player credentials, not interactive sessions.
- Google linking requires a server-issued account-bound nonce and a verified ID token; matching email addresses never link accounts. Browser Google sign-in returns only cookies. The public GIS script is loaded only on an explicit link action; CSP allows only the documented Google origins.
Cache-Control: no-storeon auth pages and API responses, CSP withframe-ancestors 'none', no-referrer, nosniff, frame denial and a narrow Permissions Policy are actual HTTP headers indeploy/nginx/.- Access logs use the path only (
$uri), not query strings. The UI has no analytics, external fonts, CDNs, third-party images or service worker. - Light/dark themes meet WCAG AA contrast; automated axe checks cover every principal page at desktop and mobile widths.
Versioning and releases
Application releases use Calendar Versioning YYYY.M.PATCH with an unpadded
month and a patch sequence starting at zero, as required by ecosystem ADR 0010.
The current truthful candidate is 2026.11.0-rc.0; no release date is assigned.
VERSION, package.json, package-lock.json, release-metadata.json, the
emitted version.json, the UI footer and OCI labels are checked by
npm run version:check. scripts/release-build.sh builds and labels a local
candidate but never tags, pushes, publishes or deploys.
Production serving
Build the OCI image and configure the API public base, TLS and optional Google client ID per deploy/README.md. Do not expose the UI without HTTPS or from a different origin; that would break the API's same-origin CSRF contract and the Secure cookie. Do not deploy to production without owner authorization and independent security review.
Supported limits
Passkey verification is virtual-authenticator only in automated evidence.
Physical security keys, platform biometrics, synchronized passkey providers,
Android/iOS devices, protected-object recovery and hardware replacement are not
qualified. Google is exercised against a controlled OpenID Connect fixture, not
live Google. The CLI pin observed here still declares contract 1.6.2 and is not
joint-qualified against 1.0.0; the unchanged device wire flow is proven with a
deterministic native client. No official Melodee logo asset is present, so the UI
uses neutral text branding rather than inventing one.
Documentation
- Getting started: local development, bootstrap, sign-in, account, device and integration.
- Operations: serving, configuration, headers, logs, compatibility, backup and rollback.
- Troubleshooting: cookies, CSRF, links, passkeys, Google, recovery, automation, compatibility and devices.
- Account security, passkeys, Google, automation credentials and recovery/bootstrap.
- Deployment notes: OCI/nginx candidate and HTTPS front door.
- Design and status: PRD, SPEC, ADRs, acceptance register and evidence (the historical starter is START-HERE).
- Master completion audit and security review.
Branding and licence
No official Melodee logo asset is present in the source. The UI uses neutral “Melodee” text branding and does not invent a logo; obtaining an authorized official asset remains an owner/design dependency. The repository's existing MIT licence is retained. The vendored upstream OpenAPI artifact is proprietary per its own metadata; its provenance and redistribution dependency are recorded in contracts/openapi/README.md.