Authentication & Sessions
Quick links: Frontend β’ Backend
Frontendβ
apps/web/src/lib/firebaseClient.tsinitializes Firebase and exposes helpers:getFirebaseAuth()returns the client auth instance- Passwordless helpers:
sendEmailSignInLink,completeEmailLinkSignInIfPresent
apps/web/src/context/AuthContext.tsxtracksuserand subscription view state.- Session sync: on ID token changes, the client POSTs the token to the backend endpoint to mint an HTTPβonly cookie.
Related backend: see Backend
Backendβ
apps/web/src/app/api/auth/session/route.jscreates/clears the HTTPβonly__sessioncookie via Firebase AdmincreateSessionCookie().apps/web/src/middleware.jsenforces presence of__sessionon protected paths (e.g./dashboard,/api/billing/*).
Related frontend: see Frontend