Copy-paste code examples for common patterns.
| Recipe | Level | Description |
|---|---|---|
| Protected Dashboard | 🟢 | Basic protected page setup |
| Invite Flow | 🟡 | Organization invitation UI |
import { ProtectedRoute } from "@repo/auth-ui/guards/react-router";
export default function Dashboard() {
return (
<ProtectedRoute>
<h1>Dashboard</h1>
<p>This is protected content.</p>
</ProtectedRoute>
);
}import { SignedIn, SignedOut } from "@daveyplate/better-auth-ui";
export default function HomePage() {
return (
<>
<SignedIn>
<p>Welcome back!</p>
<a href="/dashboard">Go to Dashboard</a>
</SignedIn>
<SignedOut>
<p>Please sign in to continue.</p>
<a href="/auth/sign-in">Sign In</a>
</SignedOut>
</>
);
}import { authClient } from "@/lib/auth-client";
function UserProfile() {
const { data: session, isPending } = authClient.useSession();
if (isPending) return <p>Loading...</p>;
if (!session) return <p>Not logged in</p>;
return (
<div>
<p>Name: {session.user.name}</p>
<p>Email: {session.user.email}</p>
</div>
);
}