The most comprehensive authentication framework for Nuxt.
export default defineNuxtConfig({
modules: ['@onmax/nuxt-better-auth'],
hub: { database: true },
runtimeConfig: {
oauth: { github: {}, google: {} },
},
routeRules: {
'/dashboard/**': { auth: 'user' },
'/admin/**': { auth: 'admin' },
},
})
27+ Plugins
Two-factor auth, organizations, API keys, magic links, and more. All plugins work out of the box. Learn more
33+ OAuth Providers
Google, GitHub, Discord, Apple, and 30+ more social providers ready to use. Learn more
NuxtHub Database
Uses NuxtHub database with Drizzle ORM. SQLite, PostgreSQL, or MySQL - your choice. Learn more
Auto Schema Generation
Auth tables generated automatically from your plugins. Zero manual migrations. Learn more
SSR-Safe Sessions
useUserSession composable works seamlessly on server and client with automatic hydration. Learn more
Declarative Route Protection
Protect routes with routeRules. Define auth requirements once, enforce everywhere. Learn more