A demo of using Better Auth with Nuxt & NuxtHub (Cloudflare D1 & KV).
A demo of using BetterAuth with NuxtHub (Cloudflare Pages with D1 & KV).
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.
The BETTER_AUTH_SECRET should be a random string of your choosing used by Better Auth for encryption and generating hashes.
The GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET should be your GitHub OAuth application credentials (see create an OAuth application).
The NUXT_UI_PRO_LICENSE should be your Nuxt UI Pro license key (only required for production), if you don’t have one, you can purchase one here.
Start the development server on http://localhost:3000:
pnpm dev
Build the application for production:
pnpm build
Deploy the application on the Edge with NuxtHub on your Cloudflare account:
npx nuxthub deploy
Then checkout your server logs, analaytics and more in the NuxtHub Admin.
You can also deploy using Cloudflare Pages CI.
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.