Authentication
End-to-end user authentication, session cookies, and route handlers with Better Auth.
Authentication Package (`@repo/auth`)
Morax provides complete authentication out-of-the-box using Better Auth, tightly integrated with your shared Drizzle database and environment configuration.
Better Auth Setup
The authentication engine is defined once in packages/auth:
packages/auth/src/index.ts
Mounting Auth Endpoints
You can mount the authentication router in Hono, Express, or Next.js with one line:
Mounting Auth Routes
Client Authentication
In your frontend applications, instantiate the client to sign in and read sessions:
React Client Hook
Route Protection
Verify sessions on incoming requests before executing protected business logic:
Session Verification