better-auth-best-practices

Configure Better Auth in TypeScript projects with adapters, plugins, and session management.

26|2|Updated Jun 16, 2025
One-click install
npx skills add https://github.com/besidka/besidka --skill better-auth-best-practices-besidka
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: better-auth-best-practices
Source: https://github.com/besidka/besidka/tree/main/.ai/skills/better-auth-best-practices
Command: npx skills add https://github.com/besidka/besidka --skill better-auth-best-practices-besidka

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill codifies best practices for integrating Better Auth into TypeScript projects, simplifying secure authentication setup and long-term maintenance.

Core Features & Use Cases

  • Framework-agnostic integration strategy for Better Auth in diverse TS apps.
  • Config & Adapters guidance for common databases (Drizzle, Prisma, MongoDB) and environment-based configuration.
  • Security & Workflows coverage of email/password, OAuth, magic links, passkeys, and plugin architecture for extensibility.
  • Use cases include building scalable login flows, multi-provider sign-in, and robust session management in web applications.

Quick Start

  1. Install the Better Auth CLI and core packages, for example: npm i -D @better-auth/cli @better-auth/core
  2. Create or update your auth config (baseURL, secret) and enable desired flows via plugins.
  3. Run migrations and generate schemas as needed:
    • npx @better-auth/cli@latest migrate
    • npx @better-auth/cli@latest generate
    • Optional: mcp commands for multi-cloud provider integration

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 set up Better Auth in a TypeScript project?

To set up Better Auth, install the core packages and CLI, configure your base URL and secret, enable desired plugins like OAuth or magic links, then run migrations and generate database schemas. This establishes a secure authentication foundation for TypeScript web applications.

What is the best way to manage sessions with Better Auth?

The best way to manage sessions with Better Auth is by leveraging its built-in session management features configured through your auth config. Proper session management ensures scalable and secure user authentication across web applications using email/password or OAuth.

Does Better Auth support Drizzle and Prisma database adapters?

Yes, Better Auth supports configuration with common database adapters including Drizzle, Prisma, and MongoDB. You can configure these adapters in your auth setup to map authentication data structures to your preferred database environment.

Can I use passkeys and magic links for authentication in Better Auth?

Yes, you can use passkeys and magic links for authentication in Better Auth by enabling the respective plugins. This allows you to build versatile login flows that support passwordless and multi-provider sign-in mechanisms.

How do I generate database schemas when integrating Better Auth?

To generate database schemas when integrating Better Auth, run the command npx @better-auth/cli@latest generate after configuring your auth instance. This command creates the necessary database schema structures required by your enabled authentication flows.