2026-05-18backend

Better Auth introduced (Google + GitHub OAuth)

  • Change: better-auth added as the authentication library. Server instance lives in app/lib/auth.ts (guarded by import "server-only"). Client helpers (signIn, signOut, useSession) exported from app/lib/auth-client.ts. A catch-all route handler at app/api/auth/[...all]/route.ts handles all auth API traffic.
  • Why: Needed user identity to protect admin-only features; social OAuth avoids building a credential system from scratch.
  • Affected Modules: app/lib/auth.ts, app/lib/auth-client.ts, app/api/auth/[...all]/, app/auth/page.tsx, package.json
  • Trade-offs:
    • Pro: Handles session management, CSRF, token refresh, and social provider OAuth out of the box.
    • Con: Requires several environment variables (BETTER_AUTH_SECRET, BETTER_AUTH_URL, OAuth client IDs/secrets); initial setup used a non-Prisma in-memory adapter that was later replaced.