Authentication
Features
- Email/password authentication
- Session management
- Protected routes
- Password reset flow
Usage
The authentication system is built with Better Auth and Zustand. Use the useAuth hook in your components:
import { useAuth } from "@/hooks/use-auth";
function MyComponent() {
const { user, isAuthenticated, login, logout } = useAuth();
if (!isAuthenticated) {
return <div>Please log in</div>;
}
return <div>Welcome, {user?.name}!</div>;
}Protected Routes
Use the AuthWrapper component to protect routes:
import { AuthWrapper } from "@/components/auth/auth-wrapper";
export default function ProtectedPage() {
return (
<AuthWrapper>
<div>This content is protected</div>
</AuthWrapper>
);
}Source captured: 2026-10-11