User accounts run on Better Auth inside the app: email and password, or Google, GitHub, and Discord, with an authenticator app (TOTP), YubiKey OTP, or passkey as extra protection. The web session is a signed HttpOnly cookie; the Android and desktop apps send the same session as a Bearer token. Every query for history and feed configuration runs on the server, scoped in SQL to the signed-in user or household. The Astro site validates sessions on protected routes before rendering dashboard HTML or API mutations.
Session lifecycle
- User signs in through Better Auth on the same site (password or OAuth).
- Signed, HttpOnly session cookie scoped to the site domain.
- Server routes read the session and query Postgres, scoped to that user or household.
What auth protects
- Feed URLs and probe labels: temperature feeds.
- History rows: history browsing.
- CSV export: subscription gating.
- Admin tools: admin features.
Security notes
Never expose the database connection string or auth secret to the browser. Relay security for public JSON: relay security.