tool-better-auth

Integrate Better Auth in TypeScript/Next.js projects with session and cookie handling.

339|58|Updated Jan 10, 2026
One-click install
npx skills add https://github.com/Heyvhuang/ship-faster --skill tool-better-auth
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tool-better-auth
Source: https://github.com/Heyvhuang/ship-faster/tree/main/skills/tool-better-auth
Command: npx skills add https://github.com/Heyvhuang/ship-faster --skill tool-better-auth

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a structured approach to implementing authentication with the Better Auth framework in TypeScript/Next.js projects, ensuring secure sessions, cookies, and provider integration.

Core Features & Use Cases

  • Session management with secure cookies and configurable expiry.
  • Provider integrations including OAuth, magic links, and passkeys, plus CSRF protection and safe redirects.
  • Production guidance for middleware placement, auditability, and deployment-ready configurations.

Quick Start

Install and bootstrap by running the Better Auth CLI commands: migrate to apply schemas, generate to scaffold adapters, and then configure BETTER_AUTH_SECRET and BETTER_AUTH_URL in your environment before starting the dev server.

Frequently Asked Questions about tool-better-auth

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up Better Auth session management in a Next.js application?

Better Auth session management in Next.js is set up by configuring session strategies and secure cookies with configurable expiry. You use the Better Auth CLI to migrate schemas and configure environment variables before handling sessions across API routes and pages.

What environment variables do I need to configure for Better Auth in production?

You need to configure BETTER_AUTH_SECRET and BETTER_AUTH_URL environment variables for Better Auth in production. Setting these variables ensures safe redirects, secure cookie handling, and proper provider integration when deploying your Next.js application.

Does Better Auth provide CSRF protection and safe redirects for Next.js API routes?

Yes, Better Auth provides CSRF protection and safe redirects for Next.js API routes. It covers provider integrations including OAuth and magic links, ensuring production-ready configurations with secure middleware placement and auditability across both API routes and pages.

How do I generate database schemas when integrating Better Auth with TypeScript?

To generate database schemas for Better Auth in TypeScript, run the Better Auth CLI commands. Use the migrate command to apply schemas and the generate command to scaffold adapters, ensuring your authentication database structure is correctly initialized.

Can I use passkeys and OAuth providers with Better Auth in a Next.js project?

Yes, you can use passkeys and OAuth providers with Better Auth in a Next.js project. The framework supports plugin-based authentication, allowing integration of these providers alongside magic links and secure session management within your TypeScript application.

What is the best way to handle middleware placement for Better Auth in production?

The best way to handle middleware placement for Better Auth in production is by following deployment-ready configuration guidance. This ensures proper session validation, secure cookie handling, and auditability across your Next.js application's protected routes and API endpoints.