better-auth-best-practices

Configure Better Auth for TypeScript backends with email/password, social login, and plugins.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Configuring a robust Better Auth setup to ensure secure, scalable authentication across server and client layers, minimizing misconfigurations and security gaps.

Core Features & Use Cases

  • Setup and configuration of Better Auth across server and client sides, including environment variables, adapters, and session management.
  • Plugin selection and management, plus guidance on migrations and verification to maintain a stable auth flow.
  • End-to-end integration workflow for building TypeScript backends with email/password, OAuth, and plugin-based authentication strategies.

Quick Start

Install better-auth, configure BETTER_AUTH_SECRET and BETTER_AUTH_URL, create auth.ts with the database adapter, apply migrations, and verify the setup with GET /api/auth/ok.

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 OAuth and email/password in a TypeScript backend?

Setting up Better Auth requires installing the package, configuring environment variables like BETTER_AUTH_SECRET, creating an auth.ts file with a database adapter, and running CLI migrations to enable email/password and OAuth social login.

What is the best way to manage plugins and session management in Better Auth?

Managing plugins and session management in Better Auth involves selecting appropriate plugins during the auth.ts configuration and relying on the framework's built-in session handling to maintain a consistent, secure authentication experience across server and client layers.

How does database adapter configuration work for Better Auth?

Database adapter configuration in Better Auth works by defining your database connection within the auth.ts file, allowing the authentication framework to securely store and retrieve user credentials and session data through your chosen database adapter.

Do I need to run migrations before using Better Auth in my application?

Yes, you need to run Better Auth migrations before using it. Applying CLI migrations creates the required database schema, and you can verify the setup is complete by checking the GET /api/auth/ok endpoint.

Can I use Better Auth for secure authentication across both server and client layers?

Yes, you can use Better Auth for secure authentication across both server and client layers. It provides a unified configuration that enforces environment setup and adapter management to ensure a consistent auth experience throughout your application.