Back to articles
Better Auth Has Free Authentication for Any Framework — Here's Why It's Replacing NextAuth

Better Auth Has Free Authentication for Any Framework — Here's Why It's Replacing NextAuth

via Dev.to WebdevAlex Spinov

NextAuth is great for Next.js. But what about Hono, SvelteKit, Nuxt, or Express? Better Auth works everywhere. What is Better Auth? Better Auth is a framework-agnostic authentication library for TypeScript. It supports email/password, OAuth, magic links, passkeys, 2FA, and more — with any framework and any database. Quick Start bun add better-auth // auth.ts import { betterAuth } from ' better-auth ' ; import { drizzleAdapter } from ' better-auth/adapters/drizzle ' ; import { db } from ' ./db ' ; export const auth = betterAuth ({ database : drizzleAdapter ( db , { provider : ' pg ' }), emailAndPassword : { enabled : true }, socialProviders : { google : { clientId : process . env . GOOGLE_CLIENT_ID ! , clientSecret : process . env . GOOGLE_CLIENT_SECRET ! , }, github : { clientId : process . env . GITHUB_CLIENT_ID ! , clientSecret : process . env . GITHUB_CLIENT_SECRET ! , }, }, }); Client Setup // auth-client.ts import { createAuthClient } from ' better-auth/react ' ; // or /vue, /svel

Continue reading on Dev.to Webdev

Opens in a new tab

Read Full Article
2 views

Related Articles