better-auth-best-practices

Configure Better Auth server and client integration in TypeScript projects.

Updated Apr 10, 2024
One-click install
npx skills add https://github.com/Xenous-Inc/turborepo-template --skill better-auth-best-practices-xenous-inc
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: better-auth-best-practices
Source: https://github.com/Xenous-Inc/turborepo-template/tree/main/.agents/skills/better-auth-best-practices
Command: npx skills add https://github.com/Xenous-Inc/turborepo-template --skill better-auth-best-practices-xenous-inc

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Facilitates quick, reliable setup of Better Auth across both server and client in TypeScript projects, including environment configuration, adapters, sessions, and plugins.

Core Features & Use Cases

  • Streamlined server/client integration for Better Auth in TypeScript apps.
  • Environment variable setup, secret management, and migration workflow.
  • Adapter and plugin configuration with verification via API endpoints.

Quick Start

Install the Better Auth package, configure BETTER_AUTH_SECRET and BETTER_AUTH_URL, create an auth.ts with the selected database adapter, then run migrate to initialize the schema.

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 TypeScript across server and client?

To set up Better Auth with TypeScript, install the package, configure BETTER_AUTH_SECRET and BETTER_AUTH_URL environment variables, create an auth.ts entry with a database adapter, and integrate the client. Run the migrate command to apply the database schema.

What is the best way to configure email/password and OAuth authentication in Better Auth?

The best way to configure email/password and OAuth authentication in Better Auth is by defining your providers within the auth.ts entry file, utilizing the plugin-based configuration system to manage sessions and adapters across your server and web apps.

Do I need to run a database migration when integrating Better Auth?

Yes, you need to run the migrate command after creating your auth.ts entry file and selecting a database adapter. This migration initializes and applies the required database schema for Better Auth to function correctly.

Can I use Better Auth plugins with multiple database adapters in different environments?

Yes, Better Auth supports multiple database adapters and plugin-based configurations across various environments. You configure your selected adapter and plugins within the auth.ts file, then verify the setup via API endpoints.

What environment variables are required for a secure Better Auth setup?

A secure Better Auth setup requires the BETTER_AUTH_SECRET and BETTER_AUTH_URL environment variables. Proper secret management and environment configuration are essential for streamlined server and client integration.