
undefined⚠️ This repo is a fork of https://github.com/atinux/nuxthub-better-auth
A demo of using BetterAuth with Nuxt and PostgreSQL. This template is designed to be deployed anywhere, with specific instructions for Vercel + Neon Database.
useAuth() Vue composable for easy authenticationserverAuth() composable for accessing Better Auth instance on the serverMake sure to install the dependencies with pnpm:
pnpm install
Copy the .env.example file to .env and update the variables with your own values.
DATABASE_URL: Your PostgreSQL connection string (use Neon Database for Vercel deployment)BETTER_AUTH_SECRET: A random string used by Better Auth for encryption and generating hashesBETTER_AUTH_URL: Your application URL (set to production URL when deploying)GITHUB_CLIENT_ID & GITHUB_CLIENT_SECRET: GitHub OAuth credentials (optional, see create an OAuth application)NUXT_UI_PRO_LICENSE: Your Nuxt UI Pro license key (only required for production), purchase hereDATABASE_URLDATABASE_URL to your Vercel environment variablesDATABASE_URL in your .env fileStart the development server on http://localhost:3000:
pnpm dev
Generate migration files when you modify the schema:
pnpm db:generate
Run migrations to update your database:
pnpm db:migrate
For development, you can also push schema changes directly:
pnpm db:push
Build the application for production:
pnpm build
After deployment, visit the /api/migrate endpoint to run database migrations.
Right now, we don’t automatically run migrations on deployment. You can manually run them by visiting the /api/migrate endpoint after deploying.
We use cookies
We use cookies to analyze traffic and improve your experience. You can accept or reject analytics cookies.