giuseppe-trisciuoglio/developer-kit / plugins/developer-kit-typescript/skills/better-auth
better-auth
UnverifiedProvides Better Auth integration patterns for NestJS backend and Next.js frontend with Drizzle ORM and PostgreSQL. Use when setting up Better Auth with NestJS backend, integrating Next.js App Router frontend, configuring Drizzle ORM schema, implementing social login (GitHub, Google), adding plugins (2FA, Organization, SSO, Magic Link, Passkey), implementing email/password authentication with session management, or creating protected routes and middleware.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 9.3 KB |
| assets/env.example | other | 1.8 KB |
| assets/nestjs/auth.controller.ts | script | 1.6 KB |
| assets/nestjs/auth.guard.ts | script | 1.5 KB |
| assets/nestjs/auth.module.ts | script | 479 B |
| assets/nestjs/auth.schema.ts | script | 2.8 KB |
| assets/nestjs/auth.service.ts | script | 1.5 KB |
| assets/nestjs/database.module.ts | script | 220 B |
| assets/nestjs/database.service.ts | script | 536 B |
| assets/nextjs/auth-client.ts | script | 462 B |
| assets/nextjs/auth-route.ts | script | 143 B |
| assets/nextjs/dashboard-page.tsx | other | 2.2 KB |
| assets/nextjs/middleware.ts | script | 388 B |
| assets/nextjs/sign-in-page.tsx | other | 6.3 KB |
| assets/nextjs/use-session.ts | script | 780 B |
| references/best-practices.md | markdown | 4.4 KB |
| references/examples.md | markdown | 7.8 KB |
| references/mfa-2fa.md | markdown | 7.6 KB |
| references/nestjs-setup.md | markdown | 9.6 KB |
| references/nextjs-setup.md | markdown | 12.0 KB |
| references/passkey.md | markdown | 10.1 KB |
| references/patterns.md | markdown | 2.8 KB |
| references/plugins.md | markdown | 9.4 KB |
| references/schema.md | markdown | 9.1 KB |
| references/social-providers.md | markdown | 9.1 KB |
assets/env.example
View on GitHub# Database
DATABASE_URL=postgresql://user:password@localhost:5432/dbname
# Better Auth
BETTER_AUTH_SECRET=your-secret-key-min-32-chars-generate-with-openssl-rand-base64-32
BETTER_AUTH_URL=http://localhost:3000
# Frontend URL (if separate from backend)
NEXT_PUBLIC_BETTER_AUTH_URL=http://localhost:3000
# GitHub OAuth
AUTH_GITHUB_CLIENT_ID=your_github_client_id
AUTH_GITHUB_CLIENT_SECRET=your_github_client_secret
# Google OAuth
AUTH_GOOGLE_CLIENT_ID=your_google_client_id
AUTH_GOOGLE_CLIENT_SECRET=your_google_client_secret
# Microsoft OAuth
AUTH_MICROSOFT_CLIENT_ID=your_microsoft_client_id
AUTH_MICROSOFT_CLIENT_SECRET=your_microsoft_client_secret
AUTH_MICROSOFT_TENANT_ID=common
# Facebook OAuth
AUTH_FACEBOOK_CLIENT_ID=your_facebook_client_id
AUTH_FACEBOOK_CLIENT_SECRET=your_facebook_client_secret
# Discord OAuth
AUTH_DISCORD_CLIENT_ID=your_discord_client_id
AUTH_DISCORD_CLIENT_SECRET=your_discord_client_secret
# LinkedIn OAuth
AUTH_LINKEDIN_CLIENT_ID=your_linkedin_client_id
AUTH_LINKEDIN_CLIENT_SECRET=your_linkedin_client_secret
# Apple Sign In
AUTH_APPLE_CLIENT_ID=your_apple_client_id
AUTH_APPLE_CLIENT_SECRET=your_apple_client_secret
AUTH_APPLE_KEY_ID=your_apple_key_id
AUTH_APPLE_TEAM_ID=your_apple_team_id
# Email Configuration (for magic links and verification)
SMTP_HOST=smtp.example.com
SMTP_PORT=587
SMTP_SECURE=false
SMTP_USER=your-smtp-user
SMTP_PASSWORD=your-smtp-password
SMTP_FROM=noreply@example.com
SMTP_FROM_NAME=Your App Name
# Redis (for session storage in production)
REDIS_URL=redis://localhost:6379
# Session Configuration
SESSION_EXPIRY=604800 # 7 days in seconds
# 2FA Configuration
TWO_FACTOR_ISSUER=YourApp
# Organization Configuration
ORGANIZATION_ENABLED=true
# Rate Limiting
RATE_LIMIT_MAX=100
RATE_LIMIT_WINDOW=900000 # 15 minutes in ms
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| deprecation-and-migrationaddyosmani/agent-skillsManages deprecation and migration. Use when removing old systems, APIs, or features. Use when migrating users from one implementation to another. Use when migrating a database schema in production, such as renaming or dropping a column without downtime (expand/contract). Use when deciding whether to maintain or sunset existing code. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| performance-optimizationaddyosmani/agent-skillsOptimizes application performance across frontend, backend, queries, and databases. Use when performance requirements exist, when you suspect performance regressions, when Core Web Vitals or load times need improvement, when N+1 query patterns need fixing, or when profiling reveals bottlenecks. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| Agent Cost Reportthedotmack/claude-memBelievable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |
| Agent Cost Reportthedotmack/claude-memBelievable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |