Sign-in flow

Email registration, sign-in cookies, default user group membership, and session handling on Cloudflare.

Home desk with laptop, external monitor, and keyboard in a living space
Household members check the same dashboard from wherever they already work. Photo: David Wellbeloved / Flickr. CC BY 2.0

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

  1. User signs in through Better Auth on the same site (password or OAuth).
  2. Signed, HttpOnly session cookie scoped to the site domain.
  3. Server routes read the session and query Postgres, scoped to that user or household.

What auth protects

Security notes

Never expose the database connection string or auth secret to the browser. Relay security for public JSON: relay security.