comparar · Authentication
Both work with Next.js. In a kit you pick one, and your agent gets the rule to use only that one.
| Better Auth | Clerk | |
|---|---|---|
| What it is | Auth in your own database: email, OAuth, 2FA, organizations. | Managed auth with ready-made login components. |
| Frameworks | Next.js | Next.js |
| Paquetes | better-auth @better-auth/drizzle-adapter | @clerk/nextjs |
| Skill oficial | better-auth/skills@better-auth-best-practices, better-auth/skills@better-auth-security-best-practices | clerk/skills@clerk-nextjs-patterns |
| How your agent uses it | Read the session on the server with `auth.api.getSession({ headers: await headers() })` (from `@/lib/auth`) and on the client with `authClient.useSession()` (from `@/lib/auth-client`). Add providers and plugins in `src/lib/auth.ts`. | Protect routes in `src/proxy.ts` with `clerkMiddleware` and read the user with `auth()` / `currentUser()` from `@clerk/nextjs/server`. Use its components (`<SignInButton>`, `<UserButton>`) instead of building login forms. |
| Kits that offer it | saas-ai-next, saas-next-better-auth, saas-next-supabase | saas-ai-next, saas-next-better-auth, saas-next-supabase |
| Chosen in | 0 installs | 0 installs |