better-auth-best-practices

Configure Better Auth authentication setups into a deployment plan for TypeScript applications.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It helps you set up Better Auth correctly so you can launch secure authentication without wrestling with server config, client integration, database adapters, or session behavior.

Core Features & Use Cases

  • Server and Client Setup: Configure auth.ts, route handlers, and client helpers for frameworks that use Better Auth.
  • Database and Session Management: Choose adapters, map ORM model names correctly, and control session storage, caching, and expiration.
  • Security and Plugins: Apply secure cookie settings, CSRF and origin protections, rate limiting, and plugin configuration for features like OAuth, passkeys, and two-factor auth.
  • Use Case: Use this Skill when building a TypeScript app that needs email and password sign-in, social login, session persistence, and production-ready authentication rules.

Quick Start

Ask the assistant to set up Better Auth for your app by defining the required environment variables, auth configuration, route handler, database adapter, and any plugins you need.

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 email and password login in a TypeScript app?

To set up Better Auth for email and password login, you need to configure the server environment variables, initialize the auth configuration file, map your database ORM models, and define framework route handlers to process authentication requests.

What is the best way to configure database adapters and session storage for Better Auth?

Configuring database adapters and session storage in Better Auth requires mapping your ORM model names correctly to the adapter and defining session expiration rules to ensure reliable session persistence and caching behavior across your application.

Do I need specific environment variables to configure Better Auth securely?

Yes, secure Better Auth configuration requires accurate environment variables for your server setup, OAuth providers, and database connections to properly apply secure cookie settings, CSRF protection, and rate limiting.

Can I use OAuth providers and two-factor authentication plugins with Better Auth?

Yes, Better Auth supports configuring plugins for OAuth providers, passkeys, and two-factor authentication, which involves applying plugin-specific schema updates and defining the necessary hooks within your TypeScript application.

How does Better Auth handle secure cookies and rate limiting for production authentication?

Better Auth handles production security by enforcing secure cookie settings, applying origin and CSRF protections, and implementing rate limiting rules within the server configuration to protect authentication endpoints from abuse.

Why are my Better Auth sessions expiring immediately or failing to persist?

Better Auth sessions fail to persist when ORM model names are mapped incorrectly to the database adapter or when session storage configurations and expiration rules mismatch the defined schema updates required by specific plugins.