Accounts and sign-in
Authentication is Better Auth, configured in packages/core/src/lib/auth.ts
and served at /api/auth/* — proxied to apps/api when API_INTERNAL_URL is
set, local otherwise. The browser only ever talks to the web origin, so cookies
behave the same either way.
Sign-in routes
Section titled “Sign-in routes”| Route | Purpose |
|---|---|
/auth/login |
Email OTP and social sign-in |
/auth/sign-up |
Account creation |
/membership |
Marketing page for the free account, with an inline join form |
- When
APP_VARIANTis notproduction, the OTP is hardcoded666666. That is what lets beta and local testing run without a mailbox. - In production a random OTP is generated and the real email is sent. There is no bypass.
Sessions on mobile
Section titled “Sessions on mobile”The mobile app authenticates against /v1/auth/* and receives a Better Auth
session token (also returned in the set-auth-token response header), which it
sends as Authorization: Bearer <token>. Credentialed requests must carry an
Origin header matching the API origin. See REST /v1.
Avatars
Section titled “Avatars”The header menu, /profile and the /v1 auth and profile responses show
user_profiles.avatar_url, falling back to the OAuth picture (Google or Apple)
from the auth user. The fallback uses ||, not ??, because the old-app import
wrote '' rather than NULL. Migration 0140 cleaned up those rows, and
profile.update stores '' as NULL. Keep || anyway.
Trusted origins
Section titled “Trusted origins”BETTER_AUTH_TRUSTED_ORIGINS is comma-separated. A new preview or custom
domain that cannot sign in is usually missing from that list.
