BetterStarter logo
BetterStarter
Docs
Features

Authentication

Email OTP and Google OAuth authentication powered by Better Auth.

Docs are in beta — content is improving rapidly. Found something missing? Open an issue on GitHub or reach out on Twitter (X).

BetterStarter uses Better Auth — a self-hosted, open-source auth library with full TypeScript support.

What's Included

  • Email OTP — users sign in with a 6-digit code sent to their email. No passwords.
  • Google OAuth — one-click sign-in with Google
  • Session management — 30-day sessions with daily refresh (users stay logged in indefinitely while active)
  • Type-safe client and server — full TypeScript types for user, session, and auth state

Local Development

For the fastest local setup:

  • Email auth flows work without Plunk in development
  • OTP codes, magic-link URLs, and reset-password links are logged to the server console
  • If you configure Plunk locally, BetterStarter sends real emails
  • In production, you need Plunk or another real email provider for email-based auth flows

Sessions

Sessions expire after 30 days of inactivity. Each request refreshes the session expiry, so active users stay logged in.

User signs in → session expires in 30 days
User visits next day → session refreshed, expires in 30 days from today
No activity for 30 days → session expires, user must sign in again

Configuration

Auth is configured in src/lib/auth/index.ts. The emailOTP plugin calls sendOTPEmail to deliver codes via Plunk.

Guides

On this page