better-auth-best-practices

Configure Better Auth authentication flows in TypeScript applications.

1|Updated Nov 8, 2025
One-click install
npx skills add https://github.com/henningsieh/greedex-calculator --skill better-auth-best-practices-henningsieh
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: better-auth-best-practices
Source: https://github.com/henningsieh/greedex-calculator/tree/main/.github/skills/better-auth-best-practices
Command: npx skills add https://github.com/henningsieh/greedex-calculator --skill better-auth-best-practices-henningsieh

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a structured approach to integrating Better Auth, a TypeScript-first authentication framework, into applications, ensuring secure and scalable user management.

Core Features & Use Cases

  • Comprehensive integration guidance: wiring Better Auth into TypeScript apps, including environment setup, adapters, and plugins.
  • Security-focused configuration: guidance on tokens, sessions, and defenses, with CLI workflows for migrations and schema generation.
  • Use Case: For a multi-tenant SaaS, configure authentication with Google OAuth and email/password, and generate adapters for Prisma and Drizzle ORM.

Quick Start

Install Better Auth in your TypeScript project, set environment variables BETTER_AUTH_SECRET and BETTER_AUTH_URL (or baseURL/secret in config), then run the CLI commands migrate and generate to prepare adapters.

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 with multiple providers in a TypeScript application?

To set up Better Auth with multiple providers, configure your TypeScript project with environment variables like BETTER_AUTH_SECRET, then use the CLI to run migrations and generate adapter schemas for your chosen ORMs. This enables multi-provider authentication flows including OAuth and email/password.

Does Better Auth support both Prisma and Drizzle ORM adapters?

Yes, Better Auth supports adapter-based customization across Prisma, Drizzle, and MongoDB. You can generate the necessary adapter schemas and execute migrations using the provided CLI commands, ensuring seamless integration with your preferred database ORM.

What environment variables do I need to configure for Better Auth session management?

Better Auth requires the BETTER_AUTH_SECRET and BETTER_AUTH_URL environment variables for secure session management. You can alternatively define these directly in the core configuration file as baseURL and secret to establish secure authentication flows.

What is the best way to secure authentication tokens in a Better Auth TypeScript project?

The best way to secure authentication tokens in Better Auth is by applying the framework's security-focused configuration options for sessions and defenses. Properly setting environment secrets and utilizing plugin-based customization ensures scalable and secure user management.

Can I use Better Auth CLI commands to generate database schemas for a multi-tenant SaaS?

Yes, you can use Better Auth CLI commands to generate database schemas and run migrations for a multi-tenant SaaS. This workflow supports configuring authentication with providers like Google OAuth while preparing adapters for ORMs like Prisma and Drizzle.

When should I use Better Auth plugins in my authentication flow?

You should use Better Auth plugins when you need plugin-based customization for your authentication flow beyond core configuration. Plugins enable extended functionality across adapters and session management, allowing tailored security settings for complex TypeScript applications.