Interactive setup wizard for better-auth authentication. Guides through database, framework, OAuth providers, and plugin configuration.
Guides through interactive setup for better-auth with database, framework, OAuth, and plugin configuration.
/plugin marketplace add secondsky/claude-skills/plugin install better-auth@claude-skillsThis command walks through configuring better-auth for your project.
Use the AskUserQuestion tool to collect configuration preferences:
Which database will you use?
- Cloudflare D1 (Recommended for Cloudflare)
- PostgreSQL (Drizzle)
- PostgreSQL (Prisma)
- MongoDB
- MySQL
- SQLite
Which ORM do you prefer?
- Drizzle ORM (Recommended)
- Prisma
- Kysely
- None (Direct adapter)
Which framework are you using?
- Cloudflare Workers + Hono
- Next.js (App Router)
- Next.js (Pages Router)
- Nuxt 3
- Remix
- SvelteKit
- Express
- Fastify
- Expo (React Native)
Which OAuth providers do you need? (Select all that apply)
- Google
- GitHub
- Microsoft/Azure AD
- Apple
- Discord
- Twitter/X
- None (Email/password only)
Which features do you need? (Select all that apply)
- Two-Factor Authentication (2FA)
- Passkeys (WebAuthn)
- Magic Links
- Organizations (Multi-tenancy)
- API Keys
- Admin Dashboard
- None
Based on answers, generate the appropriate files:
src/auth.ts (or lib/auth.ts)
Database Schema
src/db/schema.tsprisma/schema.prismaAuth Route
src/index.ts with Honoapp/api/auth/[...all]/route.tspages/api/auth/[...all].tsserver/api/auth/[...all].tsapp/routes/api.auth.$.tsxsrc/routes/api/auth/[...all]/+server.tsClient
src/lib/auth-client.ts or framework equivalentEnvironment Variables Template
.env.example with all required variablesLoad references/core-setup.md and references/cloudflare-binding.md for:
Load references/frameworks/nextjs.md for:
Load references/frameworks/nuxt.md for:
Load references/frameworks/expo-mobile.md for:
# Create D1 database
wrangler d1 create auth-db
# Generate schema
bunx drizzle-kit generate
# Apply migrations
wrangler d1 migrations apply auth-db --local
# Generate migrations
bunx drizzle-kit generate
# OR for Prisma
bunx prisma generate
# Apply migrations
bunx drizzle-kit push
# OR for Prisma
bunx prisma migrate dev
No migrations needed - collections created automatically.
Generate .env.example:
# Required
BETTER_AUTH_SECRET= # Generate: openssl rand -base64 32
APP_URL=http://localhost:3000
# Database (choose one)
DATABASE_URL= # PostgreSQL/MySQL
MONGODB_URI= # MongoDB
# OAuth (if selected)
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
# Cloudflare (if applicable)
# Set via: wrangler secret put BETTER_AUTH_SECRET
Run the generate-secret script:
./scripts/generate-secret.sh
Or manually:
openssl rand -base64 32
After setup, verify configuration:
# Run validation script
npx tsx scripts/validate-config.ts
# Test auth endpoints
./scripts/test-auth-health.sh
Provide user with:
✓ Created src/auth.ts (Cloudflare D1 + Drizzle)
✓ Created src/db/schema.ts (user, session, account, verification)
✓ Created src/lib/auth-client.ts
✓ Created .env.example
✓ Updated wrangler.jsonc with D1 binding
Next steps:
1. Generate secret: ./scripts/generate-secret.sh
2. Set secret: wrangler secret put BETTER_AUTH_SECRET
3. Create D1 database: wrangler d1 create auth-db
4. Generate migrations: bunx drizzle-kit generate
5. Apply migrations: wrangler d1 migrations apply auth-db --local
Documentation:
- Setup guide: references/core-setup.md
- D1 integration: references/cloudflare-binding.md
- OAuth setup: https://better-auth.com/docs/authentication/social-sign-in