SKILL.md
Better Auth Setup
Instructions
- Check if Better Auth is already installed in the project
- Install Better Auth if not present:
``bash npm install better-auth ``
- Create the main auth configuration file (usually
src/auth.tsor similar) - Set up the basic configuration with required options
- Configure the database connection
- Set up the client-side configuration if needed
- Create necessary database tables using migrations
Configuration Steps
- Create auth server instance with basic options
- Configure the database adapter (PostgreSQL, MySQL, SQLite, etc.)
- Set up session options
- Configure social providers if needed
- Add the auth API routes to your application
Example Setup
import { betterAuth } from "better-auth";
import { drizzleAdapter } from "better-auth/adapter-drizzle";
import { db } from "./db"; // your database instance
export const auth = betterAuth({
database: drizzleAdapter(db, {
// your database options
}),
secret: process.env.AUTH_SECRET,
emailAndPassword: {
enabled: true,
},
socialProviders: {
// configure social providers here
},
});