Getting started
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.
This guide covers local development, the supported account lifecycle and the disposable real-browser verification harness. It does not make the application production-qualified. Read deploy/README.md before serving it to anyone else.
Prerequisites
| Component | Verified version / limit |
|---|---|
| Node.js | 22.23.1 (declared engine range >=22.23.1 <23) |
| npm | 10.9.8 (lockfile v3) |
| API | melodee-api tag v1.0.0 / commit f77dba9e…, contract 1.0.0, PostgreSQL, SMTP, WebAuthn and writable protected storage |
| Browser qualification | Chromium 159 through Playwright 1.65.1, HTTPS with a trusted test CA |
| Integration host | Linux with Docker, psql, OpenSSL, NSS certutil, Rust 1.100.1 |
| CLI | Observed pin aaaeb46 still declares contract 1.6.2; joint CLI qualification against 1.0.0 is pending, so the harness uses a deterministic native device client |
The ordinary unit/build gate does not need an API, database, SMTP account, browser or network. Only the integration harness does.
Install and run locally
npm ci
npm run dev
Vite listens on http://localhost:5173 and proxies /api and /healthz to
http://127.0.0.1:8080. Set VITE_API_PROXY for a different local API origin.
This proxy is a development convenience; production uses the same-origin nginx
front door.
Set the API's public base to the browser origin, even in development:
export MELODEE_PUBLIC_BASE_URL=http://localhost:5173
The API uses this value for the absolute device verification link, the Google
browser return URL and its same-origin CSRF check. A mismatch causes
approved-looking pages to fail with 403.
For passkeys:
export MELODEE_WEBAUTHN_RP_ID=localhost
export MELODEE_WEBAUTHN_RP_NAME="Melodee"
export MELODEE_WEBAUTHN_ORIGIN=http://localhost:5173
A writable storage volume must be registered with the API because passkey public
keys are protected files, never database binary objects. The Auth UI reads
passkey.protectedStorageWritable from capability discovery and disables
enrollment with an operator-prerequisite message when it is false.
For Google linking, build the UI with the same public client ID as the API:
export VITE_GOOGLE_CLIENT_ID="<google-web-client-id>"
export MELODEE_GOOGLE_CLIENT_ID="<same-id>"
export MELODEE_GOOGLE_CLIENT_SECRET="<server-only-secret>"
export MELODEE_GOOGLE_REDIRECT_URI="http://localhost:5173/api/v1/auth/google/sign-in/callback"
export MELODEE_AUTH_BROWSER_RETURN_URL="http://localhost:5173/auth/account?google=signedin"
The client ID is public; the secret stays in the API. Browser Google sign-in uses the API authorization-code flow. Browser Google linking uses the API's account-bound nonce plus Google Identity Services, because the API's link callback returns JSON and shares one redirect URI with sign-in. See Google.
Ordinary gate
npm run gate
This is the reproducible fast gate: Prettier check, ESLint, strict TypeScript, OpenAPI contract drift, CalVer/release-metadata checks, secret/privacy checks, offline production license review, dependency review, Vitest and the production build. Do not treat it as browser qualification.
Contract refresh
npm run contract:generate
npm run contract:check
The vendored artifact must be copied byte-for-byte from the tagged API commit.
See contracts/openapi/README.md. Never
hand-edit src/api/schema.d.ts.
Fresh installation
An empty Melodee installation has no sign-in path and deliberately exposes no open registration. The operator provisions the first administrator locally:
MELODEE_DATABASE_URL='postgres://melodee@db/melodee' \
MELODEE_PUBLIC_BASE_URL='https://auth.example.test' \
./melodee-api bootstrap --name "Ada Administrator"
The command prints a one-time 64-hex challenge. Open
https://auth.example.test/auth/bootstrap, enter it, and complete the challenge.
The Auth UI then has one ordinary HttpOnly cookie session; it is not a permanent
privileged endpoint. Immediately add a verified contact or passkey before
signing out. The challenge is single-use and is shown only once. See
recovery and bootstrap.
Account flows
Sign in
/auth/login discovers enabled methods and offers only those:
- Email link — neutral request feedback for known and unknown addresses. Opening the link does not sign in; the confirmation page removes the token from the URL and requires an explicit button action.
- Passkey — discoverable, server-challenged WebAuthn sign-in; the browser receives only HttpOnly cookies.
- Google — only when the provider and a same-origin browser return URL are configured. Only an already-linked identity can sign in; matching email never creates or links an account.
- Recovery — a one-time recovery link for a verified contact.
- Bootstrap — only while an operator challenge is pending.
Account security
After sign-in, /auth/account summarises only real server data. From there:
- add/verify a contact;
- link or unlink Google;
- add, label, step up and remove passkeys;
- review and revoke sessions, or sign out other sessions;
- create/revoke scoped automation credentials and reveal a secret once;
- create/revoke OpenSubsonic/Jellyfin compatibility credentials and reveal a secret once.
Sensitive mutations that the API marks 403 reauthentication_required open an
explicit step-up dialog. A passkey step-up uses a genuine assertion; the email
alternative issues a new session after explicit confirmation. Nothing is
automatically approved.
Device consent
A CLI/device starts a grant and prints a user code and the API-supplied URI
(https://<auth-host>/auth/device). Enter the code, sign in if needed, then
review the immutable account/client/scope/expiry snapshot. Elevated scopes are
marked; unknown scopes block approval. Consent must be ticked before approval.
Denial needs no consent. The page reports success only after the API confirms it.
Real browser integration
npm ci
bash tests/integration/run.sh
What the harness does:
- Verifies the API
v1.0.0tag target and exports that exact commit withgit archive; it never consumes a sibling working tree. - Builds the API with
cargo build --release --locked, starts disposable PostgreSQL 18 and Mailpit, and provisions the installation with the API's own operator bootstrap command. It then adds two marked test accounts and a writable protected-object volume with the API's controlled-test helper. - Generates a disposable CA for
localhost, trusts it only in a disposable NSS database under the workspace, and uses normal Chromium certificate validation. NoignoreHTTPSErrorsbypass is used. - Starts a controlled OpenID Connect fixture over disposable HTTPS for Google sign-in and ID-token linking; no live Google credential is used.
- Builds the Auth UI OCI image (with a public fixture Google client ID) and
serves it through HTTPS nginx in front of the real API, proxying
/api/and the compatibility protocol paths while keeping unknown API paths JSON/empty, never SPA HTML. - Runs Playwright Chromium:
- device grant through a deterministic native client, approval, denial, expiry/rate-limit, least privilege and self-revocation;
- passkey enrollment, labels, discoverable sign-in, step-up, cancellation, cross-account and last-path protection with a virtual authenticator;
- Google linking, conflict policy, browser sign-in and cancellation with the fixture;
- contacts, sessions, automation, compatibility, recovery and bootstrap;
- accessibility, headers, route precedence, safe continuation, cookie and CSRF negatives, and log/browser-storage redaction.
Sanitized JSON evidence is published to
design/evidence/A3-DEVICE-LIVE-REPORT.json, A4-LIVE-REPORT.json,
A5-LIVE-REPORT.json, A6-A8-LIVE-REPORT.json,
A8-BOOTSTRAP-LIVE-REPORT.json and A10-SECURITY-LIVE-REPORT.json. Raw logs
stay under the git-ignored tests/integration/.state/ only when a run fails.
Never copy raw traces, tokens, codes or emails into Git.
Environment overrides: MELODEE_API_SRC, MELODEE_IT_PG_PORT,
MELODEE_IT_SMTP_PORT, MELODEE_IT_MAILPIT_PORT, MELODEE_IT_API_PORT,
MELODEE_IT_UI_PORT, MELODEE_IT_GOOGLE_HTTP_PORT,
MELODEE_IT_GOOGLE_HTTPS_PORT, MELODEE_KEEP_STATE=1,
MELODEE_REUSE_STATE=1 (reuse a retained API build while iterating) and
MELODEE_PLAYWRIGHT_TARGET (run selected spec files).
Supported limits
- Chromium 159 is the only browser qualified by the automated harness. Firefox, Safari, mobile browsers and screen readers have not been independently qualified.
- Passkey tests use a Chromium virtual authenticator. Physical security keys, platform biometrics, synchronized passkeys, mobile devices and protected-object recovery are not qualified.
- Google is qualified against a controlled OpenID Connect fixture, not live Google. Real Google consent, client configuration and provider outage behavior remain external.
- The observed CLI pin still rejects API 1.0.0 because it declares contract
1.6.2. The unchanged device wire flow is proven withtests/integration/device-client.mjs; joint CLI qualification is pending the CLI's own 1.0.0 adoption. - Linux with user
systemd-creds256+ is the only store qualified by the older CLI evidence; the Auth UI harness does not test the CLI store. - TLS uses a disposable test CA on loopback. No production certificate, public hostname, DNS, load balancer or backup qualification is included.
- Independent security review and owner release/deployment authorization remain mandatory before public or production use.