skills.vishalvoidskills/vishalvoid
Technical & DevelopmentIntermediate

better-auth-best-practices

Configure Better Auth server and client, set up database adapters, manage sessions, add plugins, and handle environment variables.

Developer Setup

Setup & Installation

bash
npx skills add https://github.com/better-auth/skills --skill better-auth-best-practices

Overview

What This Skill Does

Provides best practices for installing and configuring the Better Auth server and client, including database adapter setups, environment variable configuration, CLI migrations, and session management.

Application

When to use this Skill

Documentation

Show Skills.md file

Better Auth Integration Guide

Always consult better-auth.com/docs for code examples and latest API.


Setup Workflow

  1. Install: npm install better-auth
  2. Set env vars: BETTER_AUTH_SECRET and BETTER_AUTH_URL
  3. Create auth.ts with database + config
  4. Create route handler for your framework
  5. Run npx @better-auth/cli@latest migrate
  6. Verify: call GET /api/auth/ok — should return { status: "ok" }

Quick Reference

Environment Variables

  • BETTER_AUTH_SECRET - Encryption secret (min 32 chars). Generate: openssl rand -base64 32
  • BETTER_AUTH_URL - Base URL (e.g., https://example.com)

Only define baseURL/secret in config if env vars are NOT set.

Lines 1 - 25 of 75

Recommendations

Explore other random skills

All skillsMy patterns