Auth overview
ShipFree uses Better-Auth with a Drizzle adapter, email OTP, and optional social providers.Key files
src/lib/auth/auth.tsfor the server-side auth configurationsrc/lib/auth/auth-client.tsfor client-side helperssrc/app/api/auth/[...all]/route.tsfor Next.js route handlers
Email OTP flow
Email OTP is enabled through Better-Auth plugins and uses the email system for delivery.- OTP length is 6 digits
- OTP expires after 15 minutes
- OTP emails go through
sendEmailinsrc/lib/messaging/email
Email verification
EMAIL_VERIFICATION_ENABLED toggles email verification enforcement. When verification succeeds, a welcome email is sent through src/components/emails.
If no email provider is configured, OTPs will be logged to the server console by the log provider.
Sessions
Session settings are insrc/lib/auth/auth.ts:
- 30-day session expiry
- 24-hour refresh interval
- 1-hour fresh age
