better-auth-best-practices

Configure Better Auth server and client setups for TypeScript applications.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Configures a Better Auth server and client setup for TypeScript applications. This Skill guides teams to align environment variables, adapters, sessions, and plugins to enable robust authentication flows.

Core Features & Use Cases

  • Setup and migrate a Better Auth schema with Prisma/Drizzle adapters, integrate email/password and social providers, and manage session storage across frameworks.
  • Use cases include securing a new SaaS API, adding user authentication to a Next.js or Express app, and extending authentication with plugins like two-factor or magic links.

Quick Start

Install better-auth, set BETTER_AUTH_SECRET and BETTER_AUTH_URL, create an auth.ts with your adapter, and run migrate.

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 setup Better Auth with TypeScript in a Next.js or Express app?

To setup Better Auth with TypeScript, you install the package, define environment variables like BETTER_AUTH_SECRET, create an auth.ts file with your database adapter, and run migrations to generate the schema.

How does session management work when configuring TypeScript authentication with Better Auth?

Session management in Better Auth relies on configuring database adapters and plugins to securely handle and store user sessions across your chosen TypeScript frameworks like Next.js or NestJS.

Can I use Better Auth with ORM adapters like Prisma or Drizzle for database migrations?

Yes, Better Auth supports ORM adapters like Prisma and Drizzle. You configure the adapter in your auth.ts file and use the built-in migration tooling to setup and update your authentication schema.

What is the best way to add OAuth social providers and two-factor authentication to a SaaS API?

The best way to add OAuth social providers and two-factor authentication is by extending a Better Auth server setup with plugin-based authentication workflows configured directly within your TypeScript application.

Do I need specific environment variables to enable email/password and magic link authentication in Better Auth?

Yes, you need to define environment variables including BETTER_AUTH_SECRET and BETTER_AUTH_URL to securely manage email/password logins and enable magic link plugins within your TypeScript application.

Why should SaaS teams use plugin-based authentication workflows for TypeScript applications?

SaaS teams use plugin-based authentication workflows to align environment variables, adapters, and sessions, enabling robust and scalable secure login flows like two-factor or magic links across frameworks.