better-auth-best-practices

Configure Better Auth in TypeScript projects with adapters, plugins, and security practices.

1|Updated Jan 31, 2026
One-click install
npx skills add https://github.com/lyzno1/flux --skill better-auth-best-practices-lyzno1
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: better-auth-best-practices
Source: https://github.com/lyzno1/flux/tree/main/.agents/skills/better-auth-best-practices
Command: npx skills add https://github.com/lyzno1/flux --skill better-auth-best-practices-lyzno1

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a structured guide to integrating Better Auth in TypeScript projects, covering secure configuration, adapters, plugins, and common pitfalls to avoid.

Core Features & Use Cases

  • Security-first configuration: Guidelines for baseURL, secret management, and CSRF considerations.
  • Adapter and plugin usage: Instructions for using drizzle/prisma adapters and popular plugins like twoFactor, magicLink, or oauth providers.
  • Use Case: Teams implementing authentication flows across API and web clients with proper session handling and user management.

Quick Start

Install Better Auth in your project, configure environment variables, then run the CLI commands to migrate, generate, and integrate authentication into your app.

  • pnpm add @better-auth/cli
  • npx @better-auth/cli migrate
  • npx @better-auth/cli generate

Frequently Asked Questions about better-auth-best-practices

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I integrate Better Auth into a TypeScript project?

Better Auth integration involves installing the package, configuring environment variables such as baseURL and secret, then running CLI commands to migrate and generate authentication schemas for your TypeScript application.

What's the best way to configure OAuth providers and plugins in Better Auth?

Configuring OAuth providers and plugins in Better Auth requires using its plugin system to enable features like twoFactor and magicLink, while following security-first practices for session handling and user management.

Does Better Auth work with Drizzle and Prisma adapters?

Better Auth works with both Drizzle and Prisma adapters, providing instructions for connecting authentication flows to your existing database schema for proper session handling and user management.

How do I handle CSRF considerations and secret management for authentication?

Handling CSRF considerations and secret management involves applying security-first configuration guidelines for your baseURL and secret environment variables to protect API and web application authentication endpoints.

Can I use Better Auth for both API and web client authentication flows?

Yes, you can use Better Auth for both API and web client authentication flows, providing proper session handling and user management across different client types within your TypeScript application.

Why should I run the Better Auth CLI generate command?

Running the `npx @better-auth/cli generate` command creates the necessary authentication schema files, ensuring your database structure matches your configured adapters and plugins for secure user authentication.